Which Java uses Eclipse?

I downloaded the Eclipse IDE for Java EE developers for Linux from eclipse.org. I can write, compile and run Java programs. But I do not understand what JDK / JRE is used.

If I launched the new "Java Project", I can choose which JRE to use, but if I choose, for example, "JavaSE-1.6", I still do not know what it is? Oracle? IBM? And I do not know where this JRE is located in my file system.

Let's say I want to use the same JRE to execute my Java program from the command line, how do I find the java executable?

+6
source share
5 answers

If you want to know where Java is located on your system, run it in the whereis java terminal.

If you want to know which Java is used on your system, run it in the terminal which java .

If you want to know what the default Java version is, run it in java --version terminal

If you want to know which JDK is used in Eclipse, refer to Project-> Properties-> Java Compiler.

If you want to know which JRE is used in Eclipse, see Windows-> preferences-> Installed JREs

+7
source

It depends on your configuration.

Go to the Windows / Preferences section, then check:

Java / Installed JRE and Java / Compiler /

You can also override your settings for each project: project preferences, Java compiler.

+3
source

While you are in Eclipse:

  • Open Help β†’ About Eclipse
  • Click "Installation Details"
  • select tab

find record

 eclipse.vm= 

There must be a path to the used JRE.

+2
source

Eclipse gives you the option to select JDK in for each project , as well as for all projects.

For all projects:

Windows ---> Settings ---> Java Compiler ---> Compiler Compliance Level ---> Select the JDK you want to work with.

For specific projects:

Project ---> Properties ---> Java Compiler ---> Compiler Compliance Level ---> Select the JDK you want to work with.

Settings for a specific project take precedence over the settings of all projects ...

+1
source

(comment too long)

Let's say I want to use the same JRE to execute my Java program from how can I find the java executable?

On Linux, the java executable is the first executable file named "java" found in your path.

For instance:

 ... $ echo $PATH /home/f/jdk1.6.0_33/bin:/usr/local/bin:/usr/bin:/bin ... $ which java /home/f/jdk1.6.0_33/bin/java 

You can install as many JRE / JDKs as you want. You can even trivially create user accounts with Java (for example, a user account for development) and a user account without Java (for example, a user account without Java, which you will use only for viewing on the Internet [see Comment]).

If you try to start Eclipse when $ PATH does not contain the Java executable, and if you did not install the JRE / JDK inside ~ / eclipse /, then Eclipse should file a complaint and refuse to run:

"JRE or JDK must be installed to run Eclipse"

At this point, and if you installed Java, you can simply add it to $ PATH, and Eclipse should run:

 ... $ export PATH=~/jdk1.6.0_33/bin:$PATH 
+1
source

Source: https://habr.com/ru/post/925515/


All Articles