Java.lang.UnsupportedClassVersionError in eclipse

I am not a Java programmer, so I am posting this question. The exception is java.lang.UnsupportedClassVersionError in my main class in the eclipse project. If I comment on the import that this class has, it compiles and works fine. If I return the import back, this will not work. Does this mean that the libraries I import were compiled with a newer or older version of java than mine? when i do java -version on system i get 1.5_07

I could have sworn it actually worked last week, but maybe some settings in eclipse have changed? Is the Java Build Path in eclipse what I need to check the JRE and compiler versions?

+5
source share
6 answers

In Eclipse, the compiler version is installed regardless of the JRE version. This means that you can install the compiler on Java version 1.6 and use JRE 1.5. In this case, compiled classes cannot be run.

You can check the settings in Window / Preferences / Java / Compilerfor the default compiler matching level or your project properties for the compiler matching level for a specific project. Compare this level with the JRE used in your project ( Project / Properties / Java Build Path -> Libraries / JRE System Library) and in the program launch configuration (via the menu Run / Run Configurations...).

+14
source

UnsupportedClassVersionError , Java, , , . , Java Java, , , Java 6 Java 5.

, Eclipse , JDK, Java 6, Java 5.

, Java Eclipse.

+2

Eclipse JDK, , - JRE. , , JRE, Eclipse. . "//Java/ JRE", , JRE (. "" ).

0

(.. ), , JRE, , .

0

Maven Eclipse, Maven , Maven "". .

0

, OLD-, .

Eclipse Ant.

  • Eclipse Kepler (Java 1.7)
  • Ant 1.7
  • Project = Java 1.5

, Java 1.5 , Eclipse.

Ant java.lang.UnsupportedClassVersionError eclipse - , .

:

Windows > Preferences > Ant > Runtime > Global Entries

Java 1.7 tools.jar

I added a new external jar (in the right menu) and pointed it to Java 1.5 tools.jar

I deleted the original entry (for 1.7 tools.jar) and my Ant builds started working.

0
source

All Articles