Thanks for your replies.
I have read parts of the article and my problem is that I gave the exec method one String argument, like if I was writing it on the command line. So I tried to split it but the result is the same.
As I understood, I don't need the "cmd /C" in front of the command since "jar" is not a windows executable.
And I get :
java.io.IOException: Cannot run program ""C:\Program": CreateProcess error=5, Access denied
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at script.main(script.java:21)
Caused by: java.io.IOException: CreateProcess error=5, Access denied
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 5 more
Apparently, it doesn't recognizes the whole path "\"%JAVA_HOME%/bin/jar\" represents. Because my Java directory is in Program Files, and Program Files contains a space, it got truncated. But to bypass this problem, I added quotes around it and it should work normally! So my conclusion is that Runtime.exec() can't translate my JAVA_HOME environment variable...am I correct ?
@James Sabre:
I'm looking into it now, but does it allow to modify a file inside a ZIP archive as well ? Because it seems you can mainly read it only.