Compiling java 7 for java 6 with Eclipse

别说谁变了你拦得住时间么 提交于 2019-12-02 14:58:23

问题


I need to compile a project for Java 6 to use with java 6 or 7 (I can't upgrade all of the computers in my life). I've been searching all over and found somewhat helpful stuff, but I'm rather new to java - I don't understand much of how to use the presented alternatives (ant-build, Maven, javac).

My program does not use any API methods that are not available in Java 6, but it does use the API of another external .JAR (it is a basic plugin for an example program)

Is there a simple way to do this with Eclipse's Export function, or do I need to use some other program/method?

If I need to use something other than Eclipse, how would I best go about doing it for a multi-class, multi-package file dependent on another external .jar's API?


回答1:


Right-click on your project in eclipse and open the project properties.

Then navigate to Java compiler and set the compliance level to 1.6.

That should do it.




回答2:


In Eclipse Juno SR1: right click your project -> Properties -> Java Compiler -> Compiler compliance level.

Set that to 1.6 and you're done. You might need to enable project specific settings and disable compliance with execution environment - 2 checkboxes in the same window.



来源:https://stackoverflow.com/questions/14705324/compiling-java-7-for-java-6-with-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!