Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Reset Java Version - Switch from 1.8 to 21
Reset Java Version - Switch from 1.8 to 21 [message #1863730] Fri, 23 February 2024 15:48 Go to next message
Donald Paul Winston is currently offline Donald Paul WinstonFriend
Messages: 3
Registered: February 2024
Junior Member
I'm a long tome Java developer and Eclipse user in the past. After 10 years of PHP web development I'm returning to Java and systems programming.

I've installed the latest Eclipse IDE (4.30)

All my projects are Maven projects.

I'm having difficulty switching the JRE from 1.8 to 21. It is ridiculous that this is not easy to do. I'm trying to use the new record type and my code won't compile.

How do I do this and also make the setting is permanent?
Re: Reset Java Version - Switch from 1.8 to 21 [message #1863733 is a reply to message #1863730] Fri, 23 February 2024 17:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
Window -> Preferences -> Java -> Installed JREs then Add... it, and make it the default.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Reset Java Version - Switch from 1.8 to 21 [message #1863734 is a reply to message #1863733] Fri, 23 February 2024 18:01 Go to previous messageGo to next message
Donald Paul Winston is currently offline Donald Paul WinstonFriend
Messages: 3
Registered: February 2024
Junior Member
There is NO Window -> Preferences

I use Eclipse->Settings->Java->Installed JREs

There is only one:

/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home/lib/jrt-fs.jar


I see the Windows->Preferences thing all the time looking for how to do things. I assume the Mac version doesn't have that menu and the Windows version does.

For some reason my projects except for one, (I have 8), are stuck on 1.8

I suspect if I deleted and then recreated them it would work properly but I don't want to do that.
Re: Reset Java Version - Switch from 1.8 to 21 [message #1863736 is a reply to message #1863734] Fri, 23 February 2024 18:29 Go to previous messageGo to next message
Erik BrangsFriend
Messages: 55
Registered: February 2010
Member
If you're using Maven, try updating the Maven project (IIRC the default keybind is Alt+F5) after changing the Java versions in your POM. This should update the compiler settings.
Re: Reset Java Version - Switch from 1.8 to 21 [message #1863737 is a reply to message #1863736] Fri, 23 February 2024 19:13 Go to previous messageGo to next message
Eitan Rosenberg is currently offline Eitan RosenbergFriend
Messages: 149
Registered: October 2018
Senior Member
Erik Brangs wrote on Fri, 23 February 2024 18:29
If you're using Maven, try updating the Maven project (IIRC the default keybind is Alt+F5) after changing the Java versions in your POM. This should update the compiler settings.


Like that:

index.php/fa/44001/0/


Re: Reset Java Version - Switch from 1.8 to 21 [message #1863743 is a reply to message #1863737] Sat, 24 February 2024 01:42 Go to previous messageGo to next message
Donald Paul Winston is currently offline Donald Paul WinstonFriend
Messages: 3
Registered: February 2024
Junior Member
Ok, that worked. Doesn't everyone use Maven? Not sure why I had to do that.

Thanks.
Re: Reset Java Version - Switch from 1.8 to 21 [message #1863744 is a reply to message #1863743] Sat, 24 February 2024 05:13 Go to previous message
Eitan Rosenberg is currently offline Eitan RosenbergFriend
Messages: 149
Registered: October 2018
Senior Member
Donald Paul Winston wrote on Sat, 24 February 2024 01:42
Ok, that worked. Doesn't everyone use Maven? Not sure why I had to do that.

Thanks.


I did not use Maven for many years, but I gave it a try, and I was hooked.

For me, the major benefits are:


I am a 71-year-old retired programmer. I use Java for brain training.
Using the shared components, I wrote a bunch of utilities to handle the house chores, and that was fun.

When the numbers of dependencies that you use starts to grow, a tool like Maven is a must.



Previous Topic:Java application accessible on smart devices
Next Topic:Project not using workspace Java compliance setting
Goto Forum:
  


Current Time: Wed Feb 05 08:54:49 GMT 2025

Powered by FUDForum. Page generated in 0.39816 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top