One of the problems of Java is that developers need to do some tricks to deploy applications for generic users. For example, Microsoft Windows uses .exe files as applications, while Java uses .jar. Windows users (and the operating system itself) feel better if they see an application file that they can launch, link, associate with files and so on. Native compilers for Java are expensive and targeted to specific needs, so many programmers might prefer to search for a simpler and cheaper solution to this kind of problem.

Here you can find a small .exe file that launches another command line and works fine with Java. This application, named JLauncher, calls javaw.exe to execute a class named Main.class in a Jar file named program.jar located in the same folder. Of course, this program passes its arguments to the Java application.

Download Download JLauncher

You might probably want to customize JLauncher to suit your needs: change the command line, the icon and the version info. The best way to do this is to download Resource Hacker and modify the resources with that great visual program.

For example, to use jlauncher to launch Isaac with the Microsoft Java VM, you need to change the command line from javaw -cp program.jar Main to wjview /cp:p isaac.jar Isaac. Open JLauncher.exe with Resource Hacker, edit the string in String Table, 1, 0 and click on Compile Script. To change the icon, choose Icon Group, 1, 1040, select Action, Replace Icon and browse to find your icon file. You can add other icons with Action, Add a new resource (you must give a name to the resource).

Then edit Version Info, 1, 1033 and save the file with a new name. Resource Hacker can do many other things: just browse the help of the program to learn more.

JLauncher can be used to run non-Java programs, too. For example, I use it to launch Firefox specifying a profile. The command line is program\\firefox.exe -profile profile (my Firefox folder contains the launcher, a folder named program and a folder named profile). This is nicer than using a batch file since it doesn't open the empty command window and since Resource Hacker can import the program icon from the Firefox executable.

JLauncher is a free utility. You can freely download, use and distribute it.


Feb 11, 2010 10:03 PM

que bom

Comments are closed.