Running Java Programs

From UVA Linux Users Group

Jump to: navigation, search

Running a Java Program

Often at UVa, students need to run .jar files, especially for first years, such as the chemistry checking programs that are used in the lab section. TA's and professors often say that these programs can only be run on Windows, but they can successfully be run on Linux based machines.

To run a .jar file natively in linux, you need to install a Java related package. At the time of this writing (December 2010) the current package to install is "sun-java6-jre". If you have apt, [apt:sun-java6-jre click here to install it].

To run a .jar file, for example a chemistry checking program, download the file to a directory, and make it executable. To do this, for example, open a terminal and type in: chmod +x /path/to/file.jar

Then, to run it, use the command: java -jar /path/to/file.jar

If you have problems with using the actual programs themselves, you will have to install wine and install java inside of it. To do so, download and install wine: sudo apt-get install wine (for debian systems)

and then follow the directions on: http://appdb.winehq.org/objectManager.php?sClass=version&iId=6626

You can then navigate to the file in a terminal, and type: wine java -jar /path/to/file.jar

This should let you run the .jar file without any problems.

Personal tools