Please go to myjavatools.com for the latest versions of this article and software. Thanks, Vlad




Title: Run From Web
Summary: Java program (source included) runs another program (executable/jar/script/batch) from URL or local drive. E.g.: run http://www.patryshev.com/snippets/Java2Demo.jar run notepad.exe
Description: Is not it strange that one can easily wget a file from the web, browse any public file there, but not execute it? This code is an example of how easy it is to do it, to execute files from the web. Having this tool, you'll hardly need to store enterprise-wide distrubutables on special "download" shared disks on file servers; instead, just give the users a URL, and they'll run it from there. It should make support easier too.

The command looks like this:

run [-clean] <url> <parameters>

('-clean' means that if the file already exists in cache, it is overwritten from the web)

Url can point to a file on a disk drive as well.

The full code is presented in this archive, together with Windows, Mac, Solaris and Linux executables. If your platform does not support these, you can always run

java -jar runajar.jar <url> <parameters>

Download run.zip
Source Run.java
Binaries Windows, Linux, Solaris, Mac