Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5491

UnsupportedClassVersionError - If I set the NetBeans Runtime to Java 16, I cannot run a project created in Java 15.

    XMLWordPrintableJSON

Details

    Description

      Hello,

      I installed Java 16 and set it in the etc\netbeans.conf file

      netbeans_jdkhome="C:\Program Files\Java\jdk-16"

      However, upon startup, all projects reported an error. NetBeans automatically set the Java Platform to JDK 16 for them, but the Source / Binary Format was still JDK 15.

      So it was enough to change it to JDK 16, except for one project that still can't be run and I didn't figure out why.

      To run this project I need to close NetBeans and run it again in Java 15.

      Creating a new project in Java 16 would probably solve the problem, but why should I do it when there was no problem with all the other projects.

      Please help.

      Thank you

      PS.

      run:
      Error: LinkageError occurred while loading main class example.TextHeight
      	java.lang.UnsupportedClassVersionError: example/TextHeight (class file version 59.65535) was compiled with preview features that are unsupported. This version of the Java Runtime only recognizes preview features for class file version 60.65535
      C:\Users\NAME_OF_USER\AppData\Local\NetBeans\Cache\12.3\executor-snippets\run.xml:111: The following error occurred while executing this line:
      C:\Users\NAME_OF_USER\AppData\Local\NetBeans\Cache\12.3\executor-snippets\run.xml:68: Java returned: 1
      BUILD FAILED (total time: 1 second)
      

      Attachments

        1. obr�zek02.png
          27 kB
          Michal Rama
        2. obr�zek41.png
          26 kB
          Michal Rama

        Activity

          People

            sdedic Svatopluk Dedic
            Michal_cat Michal Rama
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: