Ashfaq Rahman
Ashfaq Rahman

Reputation: 85

Can't run java in OSX Mountain Lion, comes up with error

I need to run a jar file in my macbook pro running Mountain Lion. But I can't run java from command line. It comes up with error when I tried to check java version or help command

Ashfaqur-Rahmans-MacBook-Pro:~ inganious$ java help

Exception in thread "main" java.lang.NoClassDefFoundError: help
Caused by: java.lang.ClassNotFoundException: help
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Please anyone help .

Thanks

Upvotes: 0

Views: 350

Answers (1)

Sumit Singh
Sumit Singh

Reputation: 15896

java take class file name as its parameter. When you type java help, the JVM thinks help is a class file name, and it throws the NoClassDefFoundError exception because it doesn't find it.

What you are trying to do is using the help option.

java -help

Upvotes: 1

Related Questions