Start eclipse with java version

How to run Eclipse under different version of JDK or JRE

In this article, I will guide you how to change JDK/JRE that runs Eclipse IDE, on Windows operating system. First, you need to know exactly which version of Java on which Eclipse is running.

1. Find the JDK / JRE that runs Eclipse

In Eclipse, click menu Help > About Eclipse IDE. Then in the About Eclipse IDE dialog, click the Installation Details button. Then in the next screen, click Configuration tab. Wait for a moment while Eclipse is retrieving configuration information, and you will see a screen as below:

eclipse vm configuration

Find the line that starts with –vm and the value in the next line shows the exact path of JDK/JRE on which Eclipse is running. In the above screenshot, you see Eclipse is running on OpenJDK 11.0.2.

2. How to Change JDK / JRE for Eclipse

You know, Eclipse IDE is written in Java so it needs a JDK/JRE installed to run. By default, the first instance of JDK/JRE found in the PATH environment variable is used to run Eclipse. Consider a typical value of the PATH environment variable like this:

path1;path2;path3;…;%JAVA_HOME%\bin;

In this case, the Java Virtual Machine found in the JAVA_HOME path will run Eclipse IDE. So changing the Java version that run Eclipse is just a matter of updating the value of the JAVA_HOME variable.

However, sometimes it doesn’t work like that. You changed JAVA_HOME points to a newer JDK/JRE, but Eclipse still runs under the old one. Why? What happens?

  • An installation of Oracle Java putting its path before your JAVA_HOME, or
  • Your Eclipse IDE is configured to stick with a JDK/JRE in its configuration file.

Edit the PATH environment variable on Windows, and you may see a screen as below:

java path environment variable setting

Here, an installation of Oracle Java puts the following line before your JAVA_HOME :

C:\Program Files (x86)\Common Files\Oracle\Java\javapath

That means the JDK/JRE found in this path is always used to run Eclipse. Your JAVA_HOME is ignored. So to change, just move your JAVA_HOME before Oracle’s javapath using the Move Up and Move Down buttons; or delete that Oracle’s javapath. Then restart Eclipse and check configuration again to make sure Eclipse is actually running on the JDK/JRE you specified.

If that doesn’t work, it’s very likely that your Eclipse is somehow configured to stick with a specific version of Java Virtual Machine in its configuration file.

Читайте также:  Css style one word

Open the eclipse.ini file in Eclipse’s installation directory in a text editor like Notepad. You may see something like this:

eclipse vm setting

Now, you can change the path after the –vm line to point to a different path of JDK, or delete these two lines to use the Java version specified in the PATH system environment variable.

Phew! That’s how to change the version of Java virtual machine that powers your Eclipse IDE. I hope you found this article helpful.

You can also watch the video version below:

Other Eclipse Tutorials:

About the Author:

Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.

Источник

Выбор версии Java в Eclipse

Для выбора версии Java в Eclipse выберите пункт главного меню Window Preferences, как показано на картинке ниже.

Eclipse Главное меню Window - data-lazy-src=

В следующем окне выберите каталог, в котором установлена, например, JDK 17:

Eclipse select JDK home

В результате окно станет выглядеть примерно вот так:

Eclipse после выбора каталога с Java

Кликните на экранную кнопку “Finish” в правом нижнем углу окна.

В окне “Installed JREs” теперь будет новый пункт с добавленной JDK. Выберите её и кликните на “Apply and Close”:

Eclipse installed JREs JDK 17

Теперь вы можете обновить проекты (для проектов Maven комбинация клавиш Alt+F5).

Кроме версии Java, с которой Eclipse собирает и запускает проекты, есть ещё версия Java, на которой он запускается сам.

Это могут быть две абсолютно разные версии. Версия Java, на которой запускается Eclipse, указывается в файле “eclipse.ini”. В самом файле написано обычно что-то вроде:

Источник

How to Change Java Version in an Eclipse Project

announcement - icon

The Kubernetes ecosystem is huge and quite complex, so it’s easy to forget about costs when trying out all of the exciting tools.

To avoid overspending on your Kubernetes cluster, definitely have a look at the free K8s cost monitoring tool from the automation platform CAST AI. You can view your costs in real time, allocate them, calculate burn rates for projects, spot anomalies or spikes, and get insightful reports you can share with your team.

Connect your cluster and start monitoring your K8s costs right away:

We rely on other people’s code in our own work. Every day.

It might be the language you’re writing in, the framework you’re building on, or some esoteric piece of software that does one thing so well you never found the need to implement it yourself.

Читайте также:  Registration system PHP and MySQL

The problem is, of course, when things fall apart in production — debugging the implementation of a 3rd party library you have no intimate knowledge of is, to say the least, tricky.

Lightrun is a new kind of debugger.

It’s one geared specifically towards real-life production environments. Using Lightrun, you can drill down into running applications, including 3rd party dependencies, with real-time logs, snapshots, and metrics.

Learn more in this quick, 5-minute Lightrun tutorial:

announcement - icon

Slow MySQL query performance is all too common. Of course it is. A good way to go is, naturally, a dedicated profiler that actually understands the ins and outs of MySQL.

The Jet Profiler was built for MySQL only, so it can do things like real-time query performance, focus on most used tables or most frequent queries, quickly identify performance issues and basically help you optimize your queries.

Critically, it has very minimal impact on your server’s performance, with most of the profiling work done separately — so it needs no server changes, agents or separate services.

Basically, you install the desktop application, connect to your MySQL server, hit the record button, and you’ll have results within minutes:

announcement - icon

DbSchema is a super-flexible database designer, which can take you from designing the DB with your team all the way to safely deploying the schema.

The way it does all of that is by using a design model, a database-independent image of the schema, which can be shared in a team using GIT and compared or deployed on to any database.

And, of course, it can be heavily visual, allowing you to interact with the database using diagrams, visually compose queries, explore the data, generate random data, import data or build HTML5 database reports.

announcement - icon

The Kubernetes ecosystem is huge and quite complex, so it’s easy to forget about costs when trying out all of the exciting tools.

To avoid overspending on your Kubernetes cluster, definitely have a look at the free K8s cost monitoring tool from the automation platform CAST AI. You can view your costs in real time, allocate them, calculate burn rates for projects, spot anomalies or spikes, and get insightful reports you can share with your team.

Connect your cluster and start monitoring your K8s costs right away:

We’re looking for a new Java technical editor to help review new articles for the site.

1. Overview

In the Java ecosystem, as the new releases of JDK are introduced at least once a year, we’ll probably need to switch to a newer version at some point.

In this quick tutorial, we’ll show how to check the available JREs, add a JRE to Eclipse, and change a Java version in an Eclipse project, so we’ll be ready when that time comes.

Читайте также:  Date format with timestamp in php

2. Check Whether the JRE Is Available in Eclipse

After being sure that we have installed the version that we want to use, we’ll need to ensure that it’s available to use in Eclipse.

Let’s take a look at Window -> Preferences, and within that, Java -> Installed JREs:

window preferences before adding jre extended window 1

If the JRE we want is listed, then we’re good to go.

But, suppose we need to use JRE 9, 10, or 11. Since we only have JDK 8 installed, we’ll have to add it to Eclipse.

3. Adding a JRE to Eclipse

Next, from the Window -> Preferences dialog, let’s click the Add… button. From here, we need to specify the JRE type. We’ll choose Standard VM:

add jre standard vm option 1

And finally, let’s specify the location of the new JRE (under the JRE home) and click Finish:

add jre with location 1

As a result, we now have two JREs configured in our IDE:

new jre added 2

4. Change the Java Version of Our Project

Now, let’s suppose that we were using Java 8 in our project and now we want to change it to Java 10:

project in project tree before changing jdk

First, we’ll navigate to the Project properties and then to the Java Build Path:

project with java8 before changing jdk 1

and hit the Remove button on the existing JRE:

java build path empty 1

Now, we’ll use the Add Library button and choose the JRE System Library:

add library window 2

Let’s choose JavaSE-10 from the JDK that we recently installed and click the Finish button:

jre system library window 1

Now, as we can see, we’ve correctly configured our project’s Java Build Path:

java build path after change to java 10 1

We need to do one additional step — make sure we’re using the correct Compiler Compliance Level for the Java Compiler:

java compiler after switch 1

In our case it says Java 10, so we’re all good:

project with java 10

In case the Compiler Compliance Level is not the correct one, we can simply uncheck the Use compliance from execution environment option and choose the correct one.

5. Conclusion

In this quick article, we learned how to add a new JRE into our Eclipse workspace and how to switch to a different Java version in our current Eclipse project.

announcement - icon

Slow MySQL query performance is all too common. Of course it is. A good way to go is, naturally, a dedicated profiler that actually understands the ins and outs of MySQL.

The Jet Profiler was built for MySQL only, so it can do things like real-time query performance, focus on most used tables or most frequent queries, quickly identify performance issues and basically help you optimize your queries.

Critically, it has very minimal impact on your server’s performance, with most of the profiling work done separately — so it needs no server changes, agents or separate services.

Basically, you install the desktop application, connect to your MySQL server, hit the record button, and you’ll have results within minutes:

Источник

Оцените статью