2

My java project build in jdk 7 . I want to convert it into jdk 6. How can I do this? It is possible that convert it? in netbeans.

CompEng
  • 7,161
  • 16
  • 68
  • 122

2 Answers2

4

Add separate JDK (1.6) to your IDE preferences. In build path of project change used JRE Environment from 1.7 to just added 1.6.

UPD:

For NetBeans click Tools > Java Platforms > Add Platform where you specify additional JRE. Then go to your Project view > Right Click on libraries > Properties and select just added java platform.

mishadoff
  • 10,719
  • 2
  • 33
  • 55
0

You can configure your NetBeans project source code and binary output to be Java 6, see this answer:

In the Project tab, right click on the project and select Properties. In the Library category select Java Platform JDK 1.6. Then, in the Source category select Source/Binary Format JDK6.

Note, you don't have to since JDK 7 is backward compatible.

Alternatively, if it is a Maven based project, you can configure the maven-compiler-plugin to use version 1.6:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>
Community
  • 1
  • 1
matsev
  • 32,104
  • 16
  • 121
  • 156