简体   繁体   中英

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

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.

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM