Specify Java version for your Eclipse

Sometime, your default Java machine and your Eclipse IDE couldn’t run using same Java version. For example, your default Java machine is Java 9 but the latest Eclipse IDE can only run on Java 8. So, how can we deal with this situation? In this tutorial, I will guide you how to specify Java version for your Eclipse.

To run the Eclipse IDE with specify Java version, we need open and modify the eclipse.ini file in Eclipse home folder.

For example, I am using Eclipse Oxygen (4.7) on macOS and installed both Java 8 and Java 9 but default Java version is Java 9. When I ran this Eclipse version, I received the error message like below:

Specify Java version for your Eclipse

That is cause the Eclipse Oxygen cannot run on Java 9.

To resolve this problem, let open your eclipse.ini file in Eclipse home folder. For me, it located at /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini.

The content of this file, something like below:

To let the Eclipse IDE run on Java 8, we need add more argument as below before the line “-vmargs” in this eclipse.ini file.

For my example:

Now, your Eclipse can start without any problems.

 

Đánh giá bài viết
Chia sẽ bài viết này ...Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin

Add Comment