문제

I am working on migrating my grails app from Java 6 to Java 7. In order to do this, the plan is to continue to compile in Java 6 and change the runtime environment to Java 7. This will get migrated up through the environments. After that is complete the build server we have will get upgraded to Java 7 so things start compiling in Java 7.

The issue I am having is replicating an environment on my local machine to work on issues such as Incompatible Class Change Error. I have set my Build Path to point to the Java 6 JDK as well as changed Preferences -> Java -> Compiler to 1.6 compliance as well as changed Preferences -> Java -> Installed JREs to use the Java 6 JDK.

When I call System.getProperty("java.class.version") I would expect to receive 50.0 indicating the class files were compiled with Java 6. However, I receive 51.0 indicating it is compiling in Java 7.

What else is there that I need to change?

도움이 되었습니까?

해결책 2

Taking a cue from an unrelated error with classpaths classpath container for Grails in STS I deleted .ivy2 and .grails folders. Somehow the previously compiled files were stale despite cleaning. I do have multiple workspaces for the same project (different branches) which may be using the same .ivy2 and .grails folders which very likely caused the problem.

다른 팁

Right click on your project -> Properties -> Java Compiler and uncheck the Enable project specific settings.

If this doesn't works go to [your grails workspace path]/.metadata.plugins\org.eclipse.debug.core.launches and then edit the files that contain the java path to spot the correct one

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top