More eclipse insanity. Wrong JDK is set on imported projects

牧云@^-^@ 提交于 2019-12-25 19:32:41

问题


Maybe its just me but almost everytime I import an Android project it does not compile. First I need to set the Android SDK. Thats reasonable. But then, I almost always need to reset the JDK. Usually from JDK 1.4 to JDK 1.6. Now I really don't think too many people are out there developing android with JDK 1.4. Perhaps they are, but its no where on my machine, and yet its often pre-selected on every Android project I import. Its an annoying extra step, and I cannot imagine xCode doing something like this. Does anyone know why Eclipse does this?

Now some of these projects are not the most recent. But what makes me think this is an eclipse issue is that often the error is that it won't compile because its not version 1.6 Which means that it must have been developed with the JDK 1.6. Its usually an error involving @Override that I see saying it can't be used without JDK 1.5 or 1.6+. I then check the JDK setting for the project and sure enough its at JDK 1.4. Never 1.5, Never 1.3.


回答1:


Set the project's JRE to an Execution Environment. It's an extra layer of indirection that keeps you from referencing a JRE by its name in your particular workspace, helping make the project more easily shared.



来源:https://stackoverflow.com/questions/12357619/more-eclipse-insanity-wrong-jdk-is-set-on-imported-projects

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