Community
Participate
Working Groups
Trying to create a Dynamic Web Project 5.0 fails with message saying it needs Java 1.8 or later. I have tried using both Java 11 and 17 as the runtime, but Eclipse spits out the message Dynamic Web Module 5.0 requires Java 1.8 or newer. I can easily create one with 4.0 and use the Project Facets to move it to 5.0. I'm using Eclipse for 6/2022 and plan on deploying to Glassfish 6.25.
What about on the current release?
Please clarify "current release"? If you mean 5.x, then no. But I need to work with Servlet 5.0. That's Eclipse IDE version 6/22.
I was referring to the 2022-09 release. There is a release every quarter.
My apologies. I am using the 9/22 release. Updated this ticket accordingly.
If you have not selected a target runtime in the wizard, the bug is that choosing 4.0 does not also prevent you from finishing the wizard. If you are choosing a target runtime that supports version 5 of the dynamic web facet, does the runtime's entry on the Server Runtime Environments preference page also refer to a 1.8 or newer JRE?
When creating a project, the IDE does not know anything about a server. I will be building WAR files which should be server agnostic. And, the only reference to Java version that I know of is in the Window->Preferences->Java->Installed JREs is set to Java 11. It's not until the project is created that I can change the project's Java version. So, the last comment is VERY confusing.
Server agnostic doesn't mean you can compile Servlets without the base types and interfaces being present to compile against, and those most often come from some sort of server. Perhaps you should add a screenshot, because I'm not sure you're setting values in the wizard that are required to Finish it.
I think I see the prompt you're referring to: Target Runtime. The server that I have installed is the latest version of Glassfish and the IDE has the latest Payara Tools installed. When I select the Payara tool, the Dynamic Web Module Version is maxed out at 4.0. At this point, I'm going to have to rethink the project I'm trying to create. Thanks for your time!!!!!
Hey, We have hit this as part of some testing, too. To reiterate the issue. Using the dynamic web project wizard, on Eclipse 2023-12. If you choose Dynamic web module version 4.0 or older, you are able to click next without selecting a Target runtime. If you choose Dynamic web module version 5.0 or newer, the wizard is prevented from continuing with the error "Dynamic Web Module 5.0 requires Java 1.8 or newer". I suspect that this is because in https://github.com/eclipse-jeetools/webtools.javaee/blob/master/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java for versions 4.0 and earlier, a Java facet is also added to the project. Is there a reason why from 5.0 and newer a user must add a target runtime, whereas they don't need to before then?
(In reply to Dave Nice from comment #13) > Is there a reason why from 5.0 and newer a user must add a target runtime, > whereas they don't need to before then? Only an oversight. Not adding a runtime leaves Servlets without the necessary classes to compile against. Is there a use case for not setting a runtime?
Thanks Nitin. Our product provides its own classpath container to resolve the classes available in our product, however it doesn't appear in the Target Runtime framework. So our customers use the approach of not selecting a target runtime, but adding in a library later that contains the appropriate Java code. So I think retaining the original behaviour seems reasonable? It's easy to change the Java library to a different version if needed but harder to change the dynamic web module version! I will see if I can open a PR with a suggested change.
I created PR https://github.com/eclipse-jeetools/webtools.javaee/pull/7 - happy to take comments. I wasn't sure of the right infrastructure to test the change so did it locally by hotswapping the contents of the method.