I wrote a project in eclipse with an older version of java. Now on a different computer but running the same codes I'm getting a whole lot of red.
This is due to Version incompatibility. I've had my professor change the Java version from within the console window before. The code compiled just fine after he did so. I'm sure its the same case with this code.
After looking at other tutorials and google links I could only find command line approaches and @override methods. To be honest I still don't understand these.
What is the best way to change the version of a code originally written in an older code inside the eclipse console? thanks!
If you want to change any jdk version of A specific project than you have to click ---> Project --> JRE System Library --> Properties ---> Inside Classpath Container (JRE System Library) change the Execution Environment to which ever version you want e.g. 1.7 or 1.8.
Configure the default JRE Download and install a Java JDK v1. 7 or greater. Set it as the default in Eclipse by selecting Preferences -> Java -> Installed JREs. Add the installed JDK and select the checkbox, making it the default.
It can be added from the Window > Preferences > Java > Installed JREs > Add... page. It can also be added from the Package Explorer using the project's context menu. An option to set compiler compliance to 11 on a Java project is also provided.
In eclipse go to Window -> Preferences -> Java -> Compiler
, there you can change the java versions. Hope it helps.
Ideally if we want to have two different versions of Java [say 1.6 and 1.7], then we should have two workspace defined accordingly to avoid any mixup. We can also change the Project Facets if our projects has facets that is.
In Eclipse Follow steps given below: 1) Windows -> Preferences -> Java -> Compiler and as per the image set the compliance compiler level as per your requirements.
2) Windows -> Preferences -> Java -> Installed JRE's and check if your required jre/jdk is available or not as given in image below:
3) Right Click on Your Project and go to Java Build Path and check if your required Library is available or not as per image given below:
4) Now you can edit the JRE System Library or add one by clicking on button's available on last image's right side, then a pop up as given below will open up. Here, you can change the execution environment [default values also can be set]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With