Reputation: 11651
I have an old Java 6 Project in Eclipse. To use functionality of Java 7 I would like to switch to Java 7. I am not able to do it :
Goal->No compilation errors in my Java Code . See red underlinded the compilation error when using ZipFile
with 2 parameters used for Java 7. The Constructor of ZipFile
in Java 6 has one argument. In Java 7 there are 2 arguments:
My Environment in my project:
Compilation Error is:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The constructor ZipFile(String, Charset) is undefined
The constructor ZipFile(String, Charset) is undefined
at ZipCompare.compare(ZipCompare.java:103)
at ZipCompare.main(ZipCompare.java:77)
When I create a new Project from scratch, there are no compilation errors. I compared all settings from my old project and the new one and did not find any differences so far ?
Any help ?
Upvotes: 3
Views: 2602
Reputation: 128
Here are the exact steps in case anyone in the future needs them:
In the Package Explorer window, right-click your project and select "Properties" from the context menu, or go to File > Properties.
In the Properties dialog window, select "Java Build Path" from the left sidebar menu, then click the Libraries tab on the right-hand side.
Select your 'JRE System Library' and click the "Edit..." button. Assuming you have the latest JRE installed, you should be able to change the "Execution environment" there.
If not, go to "Alternate JRE:" and click the "Installed JREs..." button.
Assuming you don't see the one you want listed, click "Add...", ensure "Standard VM" is selected, click "Next", click "Directory" and navigate to your new JRE root folder (i.e., "C:\Program Files\Java\jre1.8.0_20").
Once you click "Finish" and then "OK", you should be able to switch back to "Execution environment" and select the JRE you desire.
Click "Finish" and then select "Java Compiler" from the left sidebar menu. Double check that under JDK Compliance you have "Use compliance from execution environment...." checked.
Now your project should compile and run under the new JDK/JRE.
Upvotes: 1
Reputation: 11651
My messy solution. I don't know if there are sideeffects. So far no:
I would really like to know the right way. I only gave this solution for probably help other peoples with the same issue. Use this Method on your own RISK! Its messy.
Upvotes: 0