Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Error running java classes

    Hi all,
    My java programs with correct syntax doesnt work.Even a hello world program. The reminal output is this:
    [goktug@compaq-presario-cq62 src]$ java TextEditor
    Exception in thread "main" java.lang.UnsupportedClassVersionError: TextEditor : Unsupported major.minor version 51.0
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClass(
    	at Method)
    	at java.lang.ClassLoader.loadClass(
    	at sun.misc.Launcher$AppClassLoader.loadClass(
    	at java.lang.ClassLoader.loadClass(
    Could not find the main class: TextEditor. Program will exit.
    I couldn't figure out this, might be easy but..
    I need a detailed explanation on the solution, because I don't know much on using environment variables or else, so if you tell me sth like add this path, create this variable w/out how to do these jobs, I won't be able to do it.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    What version of the JVM are you running (the command "java -version" will tell you)? In any case, the class loader is saying that the class TextEditor is from an unsupported version (Java 1.5.1 I think). I'm also suspicious of the indication in the top-most error that it is calling a native (JNI) method. What happens if you try a plain vanilla "Hello World" program? Here is an example (won't require a CLASSPATH environment to run):
     * The HelloWorldApp class implements an application that
     * simply prints "Hello World!" to standard output.
    class HelloWorldApp
        public static void main(String[] args)
            System.out.println("Hello World!"); // Display the string.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts