Reputation: 4523
I am trying to use eclipse on my installed jdk, which I thought should be simple to do in ubuntu (as it is in windows), but it turned out to be a surprisingly complex task. Firstly, the installations and running the eclipse are done like this:
$ which javac
/home/xx/jdk1.8.0_192/bin/javac
$ java -version
/home/xx/jdk1.8.0_192/bin/java
$ echo $JAVA_HOME
/home/xx/jdk1.8.0_192
$ dpkg --print-architecture
amd64
$ /home/xx/eclipse.j/java-2018-09/eclipse/eclipse -vm /home/xx/jdk1.8.0_192/bin/java
eclipse-help-about shows the version as "2018-09 (4.9.0)", and when I see eclipse-help-about-installation_details-configure and search for -vm, shows that my specified jdk version is being used. And I am using ubuntu-18.04.
However, when I am creating a new project in eclipse, I am seeing that it still uses JRE System Library "java-11-openjdk-amd64". How do I change this to use my version of jdk? Do I need to set some more environment variables, do I need to configure eclipse in some other way?
I have looked at questions 16843976 and 3026897, but they are not really helping.
A second related question (after the above is answered): I have some extra jar files (eg for antlr) in a directory named /home/xx/jar. How do I tell eclipse to pick up the extra jars from this directory?
Upvotes: 1
Views: 1193
Reputation: 1371
To configure java on eclipse use
Look for Preferences and them search for Java -> Installed JREs
Please find below screenshot for more information. If none is present Click Add
Also for extra jars add them to your Build path. Right click the Project -> Build Path -> Configure Build Path
Upvotes: 1