Mike
Mike

Reputation: 2339

everything is red in eclipse

I just downloaded jre7 (C:\Program Files\Java\jre7) and eclipse (Eclipse IDE for Java Developers Version: Indigo Service Release 1) (C:\Documents and Settings\mike\Desktop\eclipse2) and everything is showing up with a red underline in my code. What is causing this and how can i resolve it?

I also get a "Could not find main class." error when I run anything. And this error:

java.lang.UnsupportedClassVersionError: Miner_and_Alchemist_v2 (Unsupported major.minor version 50.0)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main" 

Upvotes: 0

Views: 3591

Answers (3)

RanRag
RanRag

Reputation: 49567

UnsupportedClassVersionError error usually comes when

JVM (Java Virtual Machine) attempts to read a class file and finds that the major and minor version numbers in the particular class file are not supported. This happens in the cases when a higher version of Java Compiler is used to generate the class file than the JVM version which is used to execute that class file and viceversa.

So, try changing your jre to a lower version or specify your jre in eclipse and than try compiling.

Upvotes: 0

Edwin Buck
Edwin Buck

Reputation: 70909

Odds are you installed the new JRE (version 7) but left your eclipse setup configured to run in JRE (verison 6 or lower). As such, the IDE has no means of understanding any classes compiled in the newer version of Java.

Check your installed JRE list, and add the appropriate references to include JRE (version 7). Then go back to your project configuration and reconfigure it to use the newly added JRE configuration.

Upvotes: 0

Gus
Gus

Reputation: 6871

Did you specify your JRE in your runtime settings? It's probably pointing to the old jre causing the stack trace.

Upvotes: 2

Related Questions