Unable to run java file from command like Ubuntu
Posted
by
KodeSeeker
on Ask Ubuntu
See other posts from Ask Ubuntu
or by KodeSeeker
Published on 2012-04-06T14:45:24Z
Indexed on
2012/04/07
17:48 UTC
Read the original article
Hit count: 317
command-line
|java
I'm a newbie to Ubuntu and Im looking to run Java code from the command line. Ive checked that path as well. The interesting thing is the code compiles but fails to run
ie.
user@ubuntu:~/py-scripts$ javac Main.java' works well.
but when I do .
`user@ubuntu:~/py-scripts$ java Main
I get the following error
Exception in thread "main" java.lang.UnsupportedClassVersionError: Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: Main. Program will exit.'
© Ask Ubuntu or respective owner