Hi,

I can get this to work within an applet, but not standalone. When running standalone, I have the "plugin.jar" file in the classpath (it was also obviously in the classpath at compile time)... However, when standalone, it fails to load a dependent DLL..

Here's the code:

package sandbox;
import sun.plugin.net.proxy.*;
public class Test
{
public static void main(String[] args)
{
WIExplorerProxyConfig wiExplorerProxyConfig = new WIExplorerProxyConfig();
BrowserProxyInfo browserProxyInfo = wiExplorerProxyConfig.getBrowserProxyInfo();
System.out.println(browserProxyInfo.getHttpHost());
}
}


And here's the stack trace:

java.lang.UnsatisfiedLinkError: initIDs
at sun.plugin.services.WinRegistry.initIDs(Native Method)
at sun.plugin.services.WinRegistry.init(WinRegistry.java:113)
at sun.plugin.net.proxy.WIExplorerProxyConfig.getBrowserProxyInfo(WIExplorerProxyConfig.java:45)
at sandbox.Test.main(Test.java:18)


And (going over the top), here's the launch command:
C:\java\jdk1.4.2\bin\java -Didea.launcher.port=7533 -Didea.launcher.library=C:\java\idea\bin\breakgen.dll -Dfile.encoding=windows-1252 -classpath "C:\java\jdk1.4.2\jre\lib\charsets.jar;C:\java\jdk1.4.2\jre\lib\jce.jar;C:\java\jdk1.4.2\jre\lib\jsse.jar;C:\java\jdk1.4.2\jre\lib\plugin.jar;C:\java\jdk1.4.2\jre\lib\rt.jar;C:\java\jdk1.4.2\jre\lib\sunrsasign.jar;C:\java\jdk1.4.2\jre\lib\ext\dnsns.jar;C:\java\jdk1.4.2\jre\lib\ext\ldapsec.jar;C:\java\jdk1.4.2\jre\lib\ext\localedata.jar;C:\java\jdk1.4.2\jre\lib\ext\sunjce_provider.jar;C:\Documents and Settings\christopher.brown\IdeaProjects\SIS-Demat-Applets\classes;C:\java\projects\demat-applet\java\lib\assembla_msks_jce.jar;C:\java\projects\demat-applet\java\lib\commons-codec-1.3.jar;C:\java\projects\demat-applet\java\lib\commons-httpclient-3.0-alpha2.jar;C:\java\projects\demat-applet\java\lib\commons-logging.jar;C:\java\idea\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain sandbox.Test


Any thoughts?

Thanks,
Chris

I obviously need some other file in the path, but I don't know which...

From: Bruce McHaffie <[EMAIL PROTECTED]>
Reply-To: "Commons HttpClient Project" <[EMAIL PROTECTED]>
To: "'Commons HttpClient Project'" <[EMAIL PROTECTED]>
Subject: RE: Auto-detecting proxy settings in a standalone Java app
Date: Fri, 22 Oct 2004 09:41:57 -0400


Hi Chris,

You may also want to take a look at the plugin.jar that ships with the JRE.
You'll find some good stuff in sun.plugin.net.proxy.WIExplorerProxyConfig.
Here are the registry entries that Sun looks for in that class.

private static final String REGSTR_PATH_INTERNET_SETTINGS =
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
private static final String REGSTR_VAL_PROXYENABLE = "ProxyEnable";
private static final String REGSTR_VAL_PROXYSERVER = "ProxyServer";
private static final String REGSTR_VAL_PROXYOVERRIDE = "ProxyOverride";
private static final String REGSTR_VAL_AUTOCONFIGURL = "AutoConfigURL";



There are also proxy detection classes for other browsers in the same package.

Bruce.



-----Original Message-----
From: Roland Weber [mailto:[EMAIL PROTECTED]
Sent: October 22, 2004 7:16 AM
To: Commons HttpClient Project
Subject: Re: Auto-detecting proxy settings in a standalone Java app


Hello Chris,

setting a fantasy proxy server in IE and searching for it in the registry
yields:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings
-> ProxyServer
-> ProxyEnable


a quick search on Google for "Java Windows Registry" yields:

http://www.trustice.com/java/jnireg/
A public domain solution to access the Windows registry.

http://sourceforge.net/projects/jregistrykey/
An LGPL-licensed solution to access the Windows registry.


hope that helps, Roland





"Chris Brown" <[EMAIL PROTECTED]>
22.10.2004 12:45
Please respond to
"Commons HttpClient Project"


To [EMAIL PROTECTED] cc

Subject
Re: Auto-detecting proxy settings in a standalone Java app






Hi,

Thanks for all the rapid feedback so far.

I don't have VB or the VB runtime, although perhaps I could use the
JNIWrapper software to access this information (if I knew where it
was...!).
  Pity the Webstart proxy detection stuff isn't available for all to see,
as
it returns (I think) appropriate params, whether you use IE or Mozilla or
whatever.

On the other hand, given that JNIWrapper is commercial software, perhaps
someone would know how to write a simple C program with "mingw" or
whatever
(easy to compile).  It could detect params and return them on STDOUT, to
be
picked up either by a startup.bat or even through Runtime.exec() (solving
the "restart the JVM" problem discussed earlier in this thread).

First thing's first though... does anyone know where this information is
stored in Windows ?  IE and Mozilla/Firefox seem good targets for
starters.

Hey, why not even a little optional subproject for HTTPClient (requiring
JNI
and a compiler, preferably not *requiring* the MS tool chain), with a
simple
ProxyDetector interface, and a series of platform-specific implementations

(to go further than my current Windows-only need) ?

Any thoughts on these big ideas, or at least as far as solving the
immediate
problem (where are these settings stored and how can I get at them?)

Thanks to all,
Chris




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



_________________________________________________________________
Hotmail : bientôt 250 Mo de stockage ! http://www.imagine-msn.com/hotmail/fr-fr/



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to