简体   繁体   中英

Open file with JNLP / Webstart

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM