I'm trying to pass a file path as parameter on Windows to be opened in a JAVA
JNLP
. Starting with the original JAR file, i created a wrapper BATCH
file runMyJar.bat
:
java -jar "%~dp0MyJarFile.jar" %*
Then i configure windows to open all *.test
files with my runMyJar.bat
which works fine: When i double click any *.test
file it run MyJarFile.jar
and passes the path of the *.test
file.
Now i want to do the same with a JNLP
to deploy my JAR
with webstart but to offer Windows Open with...
for my application. So my idea is to offer a BATCH
wrapper file again:
javaws -open %1 "http://urlToMyJNLP"
Unfortunately thats not working. When starting this wrapper batch with a file i'm just receiving a null object in my static void main
method for the parameter args
.
Any help is appreciated.
Update
Based on the answer i summarized it here.
It could be that due to security updates to Java your method of passing arugments to javaws no longer works.
Have you tried using the "association" tag in jnlp instead to achieve your goal?
Another option is to pass arguments using properties and then read that property in your java code:
javaws -J-Djnlp.arg0=%1 thefile.jnlp