Reputation: 162
Hi, I made two versions of executable programs: on linux and windows, which includes jre and .exe and .sh each.
While working on this, I just wondered that what if I could manage jar file on web server.
I mean, In my batch file, a jar file is executed by,
"start ./jre/bin/javaw.exe -jar ./lib/aaa.jar"
So is there any way to use "http://www.mywebserver.com/lib/aaa.jar" instead of "./lib/aaa.jar"?
Upvotes: 0
Views: 4957
Reputation: 190
Java does not let you execute a jar directly from the url due to security reasons. This would be very harmful to the system. Man in the middle attacks etc. This being said, you could still download the jar using the url and copy it to the classpath you specified and execute it.
For instance you could write java code to download the jar file.
https://alvinalexander.com/java/edu/pj/pj010011
Or you could use curl command. Etc..
Upvotes: 2