I'm running 32-bit Ubuntu 12.04 (on a 64-bit machine - don't ask). I have Oracle Java 8 installed as the default java version (confirmed using both 'java -version' and 'update -alternatives'), but also OpenJDK 6 and 7. which I prefer for some applications.

My question:

I have a .jar file, Start.jar (for a work program written in Java) which I use regularly. It opens and runs fine when run from the terminal (by switching to the relevant directory and running java -jar Start.jar), but won't run from a .desktop file. Why is this?

The .desktop file contains the following:

[Desktop Entry]
Exec=java -jar /home/jez/progname/Start.jar

I've also tried it with:

Exec=java -jar Start.jar

The program includes a .sh file to launch a different .jar (we'll call it Alt.jar) to run the program. Alt.jar runs happily using a .desktop file very similar to the above to run the .sh file.

Simply amending the one line .sh file to run Start.jar rather than Alt.jar doesn't work either. (Again it opens and immediately closes a terminal window.)

The developer has recently informed me that I should be running Start.jar, not Alt.jar, hence my efforts to find an easy way to run Start.jar.

Both .jar files, the .sh file and the .desktop file all have their permissions set to 'Allow executing file as program'.

Note also that the program needs to run using Oracle Java 8, as it is not fully compatible with OpenJDK.

For completeness, the program in question is a computer-aided translation package called CafeTran (www.cafetran.com).

  • I'm pretty sure Path= refers to the location of the command. Take that field completely out and try it. – TheWanderer Apr 13 '16 at 13:49
  • Path should read Path=/home/jez/progname – Harris Apr 13 '16 at 13:54
  • @Harris why? The path is meant to be a folder, isn't it? – TheWanderer Apr 13 '16 at 13:59
  • Yes sure, but currently the jar file is in /home/jez/progname/, which is different than the one in PATH name variable. – Harris Apr 14 '16 at 20:24

The comments above got me thinking, and a little searching on askubuntu led me to the answer - the terminal parameter is wrong.

The problem is fixed by changing it to:


Clearly running Java is a little different from running a .sh.

Thank you to all for your assistance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.