Site-wide Tags:  Linux(17) | CommandLine(12) | Ubuntu(10) | RemoteAccess(7) | Tools(7) | Vim(7) | LiftWeb(5) | SBT(5) | SoftwareDev(5) | Mac(5) | Scripts(4) | WebDev(4) | Diagrams(4) | Lifty(3) | NetworkDrives(3) | Processwire(3) | Security(3) | Fog(3) | VCS(3) | BestPractices(3) | RaspberryPi(2) | WebDesign(2) | Encryption(2) | Windows(2) | SSH(2) | WinCommandPrompt(2) | GitHubRepos(2) | Emacs(2) | PHP(2) | IDE(2) | ErrorMsgs(2) | JVM(2) | Hardware(2) | Bash(2) | Networks(2) | Graphviz(2) | Cloning | Cygwin | Graphics | Java | SystemRecovery | lessc | Maven | Python | PXE | Samba | LXDE | PackageManagement | LifeHacks | LESS |

This site has been archived and will no longer be updated.
You can find my new homepage at neilpahl.com.

Run A .jar File From The Command Line

Tags:  Ubuntu   Linux   JVM   Java   
Created on Thu, 15 Dec 2011.
Last Modified on Wed, 04 Apr 2012.

Motivation Behind This Cheatsheet

.jar files run automatically in windows, but in linux they need to be called with java

The Cheatsheet

First, make sure you have the java runtime environment (JRE) installed. On an Ubuntu system, you could install it with using the apt package manager:

sudo apt-get install openjdk-6-jre

On other linux sytems, you can find it in their package manager.

then just cd to the folder which has the .jar file and type:

java -jar name_of_jar_file.jar

or, to free up your command line, you can detach by appending an ampersand  to the end:

java -jar name_of_jar_file.jar &


PLEASE let me know if I'm doing something wrong, or if you have any suggestions or requests~

blog comments powered by Disqus