facebook

use java 14 preview features in tomcat launched from MyEclipse

  1. CodeMix & Angular IDE
  2.  > 
  3. Getting Help
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #667006 Reply

    knowledgeplaces
    Participant

    I have complex SQL requests to write and i want to take advantage of Java 14 preview feature “text block”.
    I have properly configured MyEclipse to use Java 14 using the –enable-preview parameter.
    I have also added the –enable-preview parameter in Java Windows setting, and done whar is recommended here:
    https://dev.dexterxx.pl/news/8

    When I code my Java classes in MyEclipse, it’s fine, I can use text blocks.

    However, when I build and run the application on Tomcat 9, I have the following error message:
    java.lang.UnsupportedClassVersionError: Preview features are not enabled for com/knowledgeplaces/metalmsapi/SigninResource (class file version 58.65535). Try running with ‘–enable-preview’ (impossible de charger la classe [com.knowledgeplaces.metalmsapi.SigninResource])

    Sounds like the feature is not enabled in the complied class file.

    Please advise.

    #667012 Reply

    Brian Fernandes
    Moderator

    I don’t believe the --enable-preview parameter is required for MyEclipse, if you’re using our latest 2020.9.16 release. Please see this page for instructions: https://www.eclipse.org/eclipse/news/4.16/jdt.php – you can follow those steps at the workspace level (in preferences) or at the project level (in project properties) too.

    Assuming you have the project JDK set to Java 14 and the preview features turned on, the compiled code should now work. Please let us know if this works for you.

    #667268 Reply

    knowledgeplaces
    Participant

    I had already done what is written in this page.

    However, when I select my Java project by right-clicking on it and selecting Configure > Enable preview features, the “Enable preview feature” menu is greyed, I can’t click on it.

    So it sounds like these features are not really applied to my project.

    How to enable this menu option?

    #667273 Reply

    knowledgeplaces
    Participant

    Found it!
    I needed to add –enable-preview as Java VM default argument (see attached screen copy).

    Attachments:
    You must be logged in to view attached files.
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: use java 14 preview features in tomcat launched from MyEclipse

You must be logged in to post in the forum log in