1

how should i enforce eclipse to use java 1.5 version for a project. I have the jdk 1.6 on my system.

I did these: project properties --> java compiler --> enabled project specific settings(checked), use compliance from ....(checked). I tried to uncheck that and check the use default compliance settings. I also tried adding this to my POM.

            <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
            <source>1.5</source>
            <target>1.5</target>
            <verbose>false</verbose>
            </configuration>
        </plugin>           

But eclipse is still taking java 1.6 version.

vjk
  • 2,163
  • 6
  • 28
  • 42
  • Do you have a 1.5 JDK as well as 1.6? Do you want to compile with JDK 1.5, or compile with 1.6 and allow a 1.5 JVM to run it? What do you mean by "taking 1.6 version"? – davidfmatheson Sep 24 '12 at 15:01
  • I have JDK 1.6 on my system. I want to compile with JDK 1.5 and run it with 1.5 JVM. – vjk Sep 24 '12 at 15:03
  • 2
    Seems like you need to install JDK 1.5. – davidfmatheson Sep 24 '12 at 15:05
  • no other way to let eclipse to use 1.5 for compilation rather than installing JDK 1.5 – vjk Sep 24 '12 at 15:09
  • Eclipse can only compile with compilers that you have installed. Why is it not adequate to specify 1.5 compliance with JDK 1.6 like you have above? – davidfmatheson Sep 24 '12 at 15:31
  • This is being discussed well in another SO question: http://stackoverflow.com/questions/12588537/how-to-change-jdk-version-for-an-eclipse-project/12588545#comment16964898_12588545 – davidfmatheson Sep 25 '12 at 18:48

2 Answers2

0

Make sure your JAVA_HOME environment variable is set to the JDK 1.5 directory.

MacBrave
  • 58
  • 5
  • I don't have JDK 1.5 on my system. I only have JDK 1.6. Is it not possible to change any settings in eclipse to compile in 1.5 – vjk Sep 24 '12 at 15:13
0

There are two corresponding Eclipse settings, that are useful here:

  • The used JRE System Library: open project properties, and select the Java Build Path page, go to the Libraries tab, and there select the JRE system library entry, edit it, and there you can select a Java 1.5 execution environment (that would also use the same Java 1.6 environment already installed).
  • You may need also configure the selected Java Compiler: open the Java compiler page in the project properties, and explicitly set the compliance to Java 1.5.

If you need to set this up more globally, you could look for these preferences in the workspace preferences under the Java category.

Zoltán Ujhelyi
  • 13,788
  • 2
  • 32
  • 37