简体   繁体   中英

Eclipse thinks my JRE is 1.6, when I've migrated to 1.7

I am having a problem with Eclipse Luna after an update. Despite showing in the tree for the project that it is using JRE system library 1.7 the error checking is reporting bugs with a switch using a string that it has a source level below 1.7 .

The specific error:

Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted

I have tried going into Properties > Build Path and adding and removing the library but this has not fixed the problem.

I moved from the Eclipse packaged with Debain Wheezy which uses the 1.6 JDK and the much older Eclipse 3.8 . I am now using CentOS 7 with the 1.7 JDK . The migration has not been as smooth as I hoped. Since there has some big version jumps, I need help getting this new 4.4 version working properly.

Window -> Preferences -> Java Compiler -> set the compiler level to 1.7

Same for Project -> Properties -> Java Compiler -> 1.7

If you can't find that option (by which I mean Compiler 1.7 ), you must specify the Installed JRE to be JDK 7 too.

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