1

I'm trying to run a Jar file on ubuntu 14.04. I've already installed OpenJDK Java 6 and 7 Runtime and turned the jar file to be executable. I double click on the file but nothing seems to happen!

I also read the given directions below but I cannot understand what to do:

#!/bin/bash
java -jar Hypatia_7.4_Masterclass.jar

Should I write something on the terminal in order to run the file?

MakisL
  • 11
  • Do you mean that you ran the lines above, or did you put it in a file and run it? Do you get any messages if you run java -jar Hypatia_7.4_Masterclass.jar on the command line? – tudor -Reinstate Monica- Mar 06 '17 at 01:10
  • First of all thanks for helping me. When I type *** java -jar filename.jar *** on the command line I get the following message: ** Unable to access jarfile filename.jar ** – MakisL Mar 06 '17 at 11:39

1 Answers1

1
#!/bin/bash
java -jar Hypatia_7.4_Masterclass.jar

This "set of instructions" you have is just bash script. If you're unfamiliar with shell scripting, here is a quick intro on WikiBooks, but you don't need to worry about that to run your file.

All you have to do to run a .jar file is open a terminal and type java -jar WhateverYourFileNameIs.jar.

muru
  • 197,895
  • 55
  • 485
  • 740
  • First of all thanks for helping me. Once I type *** java -jar filename.jar *** on the command line I get the following message: ** Unable to access jarfile filename.jar ** – MakisL Mar 06 '17 at 11:43
  • When you are typing that into your console, have you navigated to the directory that contains the file you want to use? Usually if you start a terminal in Ubuntu it starts at your home folder, which is ~ for short. You can change your directory with the cd command. Alternatively, you can navigate to the directory in nautilus, right click on the background of the directory window, and select Open in terminal. – lotuswatcher Mar 06 '17 at 14:18
  • I managed to navigate to the directory that contained the file (!!!) but I get the following message : – MakisL Mar 07 '17 at 23:25
  • I managed to navigate to the file's directory but I got the following message:

    AtlantisJava version (SVN tag): AtlantisJava (SVN tag n/a) Command line arguments:

    INFO 2017-03-08 01:31:33,730 Logging to console (System.out) initialised Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.(ImageIcon.java:205) at atlantis.utils.AUtilities.getFileAsImageIcon(AUtilities.java:339) at atlantis.gui.AStartupWindow.(AStartupWindow.java:42) at atlantis.Atlantis.initAtlantis(Atlantis.java:402) at atlantis.Atlantis.main(Atlantis.java:901)

    – MakisL Mar 07 '17 at 23:35