I’m writing application for downloading CSV file from web and inserting data into table in database. The problem is that I need to setup proxy via System.setProperty("http.proxyHost", "http-proxy.domain.com"); and so on. Application works fine when I’m running it on local system, but the problem is when I launch it from JNLP. At first I have had problems with signing the JARs (I’ve managed it to do it, somehow) and now I’m facing the problem, that even the application is running, it does not connect to the web – it throws exception with message “connection timeout: connect”.
JNLP file looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp href="launch.jnlp" spec="1.0+">
<information>
<title>TestImporter</title>
<vendor>hol</vendor>
<homepage href=""/>
<description>TestImporter</description>
<description kind="short">TestImporter</description>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+"/>
<jar href="TestImporter.jar" main="true"/>
<jar href="lib/ojdbc14.jar"/>
<jar href="lib/mail.jar"/>
</resources>
<application-desc main-class="cz.test.Importer">
</application-desc>
</jnlp>
I’m connecting to file by this code:
URLConnection yc = cnb.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
yc.getInputStream()));
Thanks in advance for any help!
You can try to wrap your code in a doPrivileged block. Check this one out:
http://download.oracle.com/javase/1.4.2/docs/api/java/security/AccessController.html
If after implementing it, your code still fails, maybe it will make some sense to paste your logs from java console.