TroyDev

Java Version

Some of my projects require Java version 8. If you started a project using your command line then the error will read "unsupported major.minor version 52".Update to Java 8 here.

Running a .jar on Windows

First check that you have a compatible version of java, press start and search for "CMD" to open a command window, then type "java -version" and press enter:

Command prompt

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\TrojanDev>java -version_

You should get an output similar to that below. If you do not have version 1.7 or higher (1.8 for new 2014 projects) or dont have java installed you should get the latest version from here.

Command prompt

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\TrojanDev>java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

C:\Users\TrojanDev>_

All of my java projects are .jar files which should run automatically when you double click on them, if that isn't the case you can try to set this to the default behaviour following this short guide, or you can try to run the program using the steps below:

You need to open the CMD at the location of the program you want to run. For this example I'm going to use FluidApp.jar which is located on my desktop, Desktop is inside my User/TrojanDev directory so all I need to type is "cd Desktop" where 'cd' means open.

Command prompt

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\TrojanDev>cd Desktop

C:\Users\TrojanDev\Desktop>_

I only need to type 'Desktop' because it is in my 'Users\TrojanDev' folder, to open any folder you can start with "C:\", for example:

Command prompt

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\TrojanDev>cd C:\Users\Public\Downloads

C:\Users\Public\Downloads>_

Once you are in the correct directory type "java -jar application.jar", if the name of the .jar has more than one word in it, you should surround it with brackets:

Command prompt

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\TrojanDev\Desktop>java -jar FluidApp.jar

C:\Users\TrojanDev\Desktop>java -jar "This program name uses spaces.jar"_

If the program does not run, an error message should be output into the console, if this happens, googling the error may help.

Running a .jar on MacOS

First check that you have a compatible version of java, Navigate to /Applications/Utilities and double-click on Terminal, then type "java -version" and press enter:

trojandev

Last login: Wed Aug 6 20:34:16 on console
macintosh:~ trojandev$ java -version _

You should get an output similar to that below. If you do not have version 1.7 or higher (1.8 for new 2014 projects) or dont have java installed you should get the latest version from here.

trojandev

macintosh:~ trojandev$
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

macintosh:~ trojandev$ _

Next, you need to open the CMD at the location of the program you want to run. For this example I'm going to use FluidApp.jar which is located on my desktop, Desktop is inside my User/trojandev directory so all I need to type is "cd ./Desktop" where 'cd' means open and './' means I'm opening a folder that is inside my current location.

Desktop

macintosh:~ trojandev$ cd ./Desktop
macintosh:~ Desktop trojandev$ _

I only need to type 'Desktop' because it is in my 'Users\trojandev' folder, to open any folder you can start with just "/", for example:

Desktop

macintosh:~ trojandev$ cd /users/trojandev/Desktop
macintosh:~ Desktop trojandev$ _

Once you are in the correct directory type "java -jar application.jar", if the name of the .jar has more than one word in it, you should surround it with brackets:

Desktop

macintosh:~ Desktop trojandev$ java -jar FluidApp.jar

macintosh:~ Desktop trojandev$ java -jar "This program name uses spaces.jar"_

If the program does not run, an error message should be output into the console, if this happens, googling the error may help.

Running a .jar on Linux

First you'll need to make sure you have a compatible version of java installed, open up a terminal and type "java -version" and press enter:

trojandev@ubuntu: ~

trojandev@ubuntu: ~$ java -version_

You should get an output similar to that below. If you do not have version 1.7 or higher (1.8 for new 2014 projects) or dont have java installed you should get the latest version fromhere.

trojandev@ubuntu: ~

trojandev@ubuntu: ~$ java -version
java version "1.7.0_15"
Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
Java HotSpot(TM) Client VM (build 23.1-b03, mixed mode, sharing)

trojandev@ubuntu: ~$_

You may run into problems if you are using an OpenJDK, in which case you'd get the following output:

trojandev@ubuntu: ~

trojandev@ubuntu: ~$ java -version
java version "1.6.0_36"
OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1)
OpenJDK Server VM (build 19.0-b09, mixed mode)

trojandev@ubuntu: ~$_

All of my java projects are .jar files which should run automatically when you double click on them, if that isn't the case you can try to set this to the default behaviour following this short guide, or you can try to run the program using the steps below:

You need to open the terminal at the location of the program you want to run. For this example I'm going to use FluidApp.jar which is located on my desktop, Desktop is inside my home directory so all I need to type is "cd Desktop" where 'cd' means open.

trojandev@ubuntu: ~

trojandev@ubuntu: ~$ cd desktop

trojandev@ubuntu: ~/desktop/$_

Once you are in the correct directory type "java -jar application.jar", if the name of the .jar has more than one word in it, you should surround it with brackets:

trojandev@ubuntu: ~

trojandev@ubuntu: ~$ cd desktop

trojandev@ubuntu: ~/desktop/$java -jar FluidApp.jar

trojandev@ubuntu: ~/desktop/$java -jar "This program name uses spaces.jar"_

If the program does not run, an error message should be output into the console, if this happens, googling the error may help.