Faustas - Programming, Projects, Psychology and Faust
Java .jar files are excellent, if you want to run your code on different operating systems. There are different ways to run a .jar file on a Windows or Unix system.
First you must install the Java Runtime Environment (JRE). The JRE makes it possible to run your Java application on different operating systems.
Unix makes it really simple to install the JRE:
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
If you want to check the currently installed version, just type:
java -version
That's it.
You can download the JRE from the sun download area:
Just install the JRE with the Windows installer.
Now you have to start your Java application with the JRE.
You can start the application (application.jar) with the following command:
java -jar application.jar
Normally, Windows recognizes the type of the .jar file and opens the application with the JRE. If this does not work properly, you can try one of the following alternatives.
You can click at the .jar file with the right mouse button. Choose the Open with... dialog and select the Java Runtime Environment out of the program list.
Open a new empty file and type the following line:
java -jar application.jar
Save the file as start.bat in the same directory like the application.jar file. Then start the application by clicking the start.bat file.
Good luck!