'How to use Different Java versions eclipse in Linux mint?
I have many Java versions installed on my laptop.
$ sudo update-alternatives --config java
[sudo] password for naruto:
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-9-oracle/bin/java 1091 auto mode
1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
* 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode
3 /usr/lib/jvm/java-9-oracle/bin/java 1091 manual mode
I had installed openjdk8 as sudo apt-get install openjdk-8-jdk
oracle jdk8 by
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
and oracle jdk9 by
sudo apt-get install oracle-java9-installer
I want to create new Java program which usages Oracle Java 8 or 9
(whenever I select Java 9 by sudo update-alternatives --config java
Eclipse doesn't lunch. I don't why that is happening) but Eclipse uses openjdk8.
So How can I create new Project with Oracle Java 8 in Eclipse (or 9 if possible)?
Solution 1:[1]
You may even set a different Java version for each project:
Open project's properties:
- Java Build Path > Libraries > Add Library > JRE System Library (I recommend to chose always an "execution evironment").
- Java Compiler > Check "Enable project settings", uncheck "Use compliance from execution environment..." and chose your preferred value from the dropdown.
- Project facets > Java: Set the same value from the dropdown.
Always keep these three parameters set to the same Java version on each project.
Solution 2:[2]
Go to Window > Preferences > java > Installed JREs and Add JRE you like
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Little Santi |
Solution 2 |