-6

How to run a jar file which holds a java program from command prompt?

Getting following exception while trying to run


Exception in thread "main" java.lang.NullPointerException at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


lspriya87
  • 21
  • 2
  • 2
  • 3
  • Getting following exception while trying to run****Exception in thread "main" java.lang.NullPointerException at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)*** – lspriya87 Mar 06 '13 at 12:03

1 Answers1

-1

Just go to the directory with "cd path to jar file".
And there you enter "filename.jar" and hit enter.
For me this works fine.

Edit: I put the "filename.jar" into brackets and the compiler did not show the filename.

j0chn
  • 1,103
  • 1
  • 7
  • 13
  • 3
    -1: This looks rather incomplete. As in it's missing the actual command. – Don Roby Mar 06 '13 at 12:00
  • I tested it before I posted the answer. And everything was fine. So it is not really incomplete. And cause he said with command prompt and no operating system: I think everything is fine! ;) – j0chn Mar 06 '13 at 12:03
  • As now edited, this may work for you, but it's very OS-specific. It's still a pretty weak answer. – Don Roby Mar 06 '13 at 12:13
  • OKay, I'm fine with you ;) – j0chn Mar 06 '13 at 12:18