One of the errors mentions trying to run an app compiled on a newer version (18) while running with an older JRE (11).
> se.trixon.nbrunfile.RunFileMain > java.lang.UnsupportedClassVersionError: se/trixon/nbrunfile/RunFileMain > has been compiled by a more recent version of the Java Runtime (class file > version 62.0), this version of the Java Runtime only recognizes class file > versions up to 55.0 See https://javaalmanac.io/bytecode/versions/ Have you cleaned and build with current JDK and JRE? Is your maven using the correct JDK? Eric On Thu, Aug 18, 2022 at 1:01 PM Patrik Karlström <[email protected]> wrote: > Den lör 7 maj 2022 kl 18:04 skrev Patrik Karlström <[email protected]>: > > > I can't remember if this ever worked for me, > > but I have a problem using Run/File (Shift F6) on main classes within a > > platform module if the source/target level is greater than 11, with or > > without nbjavac. > > > > It works just fine for non platform projects. > > > > cd /home/patrik/git/slask/nbrunfile/nbrunfile-sample; > > JAVA_HOME=/home/patrik/.sdkman/candidates/java/18.0.1-tem > > M2_HOME=/home/patrik/.sdkman/candidates/maven/current > > /home/patrik/.sdkman/candidates/maven/current/bin/mvn -f > > /home/patrik/git/slask/nbrunfile/nbrunfile-sample/pom.xml -Dexec.vmArgs= > > "-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} > > ${exec.appArgs}" -Dexec.executable=java > > -Dexec.mainClass=se.trixon.nbrunfile.RunFileMain > > -Dexec.classpathScope=runtime -DskipTests=true -Dexec.appArgs= --debug > > --errors --debug --errors process-classes > > org.codehaus.mojo:exec-maven-plugin:3.0.0:exec > > Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0) > > Maven home: /home/patrik/.sdkman/candidates/maven/current > > Java version: 18.0.1, vendor: Eclipse Adoptium, runtime: > > /mnt/atlas/data-config/.sdkman/candidates/java/18.0.1-tem > > Default locale: sv_SE, platform encoding: UTF-8 > > OS name: "linux", version: "5.10.0-14-amd64", arch: "amd64", family: > "unix" > > Included > > /snap/netbeans/61/netbeans/java/maven-nblib/netbeans-eventspy.jar > > .... > > Executing command line: [java, -classpath, > > > /home/patrik/git/slask/nbrunfile/nbrunfile-sample/target/classes:/home/patrik/.m2/repository/org/netbeans/api/org-netbeans-api-annotations-common/RELEASE130/org-netbeans-api-annotations-common-RELEASE130.jar, > > se.trixon.nbrunfile.RunFileMain] > > Fel: LinkageError inträffade vid laddning av huvudklassen > > se.trixon.nbrunfile.RunFileMain > > java.lang.UnsupportedClassVersionError: se/trixon/nbrunfile/RunFileMain > > has been compiled by a more recent version of the Java Runtime (class > file > > version 62.0), this version of the Java Runtime only recognizes class > file > > versions up to 55.0 > > Command execution failed. > > > > If I do run exec:java manually from a shell it works fine. > > > > I managed to track down > > > https://github.com/apache/netbeans/blob/master/java/maven/src/org/netbeans/modules/maven/execute/defaultActionMappings.xml > > but I'm not sure where to go from there. > > > > As a side note it looks like global execution options get duplicated > too. --debug > > --errors --debug --errors > > > > I have this problem on Windows too. > > > > /Patrik > > > > > > I decided to try this with nb15-rc4 and it's even worse now as far as I can > tell. > With nb15 I'm even unable to do this with source/target<12, and that worked > in nb14. > > But it fails with a new error message. "File or directory does not exist" > (translated) > > cd /mnt/atlas/data/git/slask/nbrunfile/nbrunfile-sample; > JAVA_HOME=/home/pata/.sdkman/candidates/java/18.0.2.fx-zulu > M2_HOME=/home/pata/.sdkman/candidates/maven/current > /home/pata/.sdkman/candidates/maven/current/bin/mvn -Dexec.vmArgs= > "-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} > ${exec.appArgs}" -Dexec.executable=java > -Dexec.mainClass=se.trixon.nbrunfile.RunFileMain > -Dexec.classpathScope=runtime -DskipTests=true -Dexec.appArgs= > process-classes org.codehaus.mojo:exec-maven-plugin:3.0.0:exec > Scanning for projects... > > ---------------------< se.trixon:nbrunfile-sample >--------------------- > Building nbrunfile-sample 0.0.1-SNAPSHOT > --------------------------------[ nbm ]--------------------------------- > > --- maven-resources-plugin:3.2.0:resources (default-resources) @ > nbrunfile-sample --- > Using 'UTF-8' encoding to copy filtered resources. > Using 'UTF-8' encoding to copy filtered properties files. > Copying 1 resource > > --- maven-compiler-plugin:3.10.1:compile (default-compile) @ > nbrunfile-sample --- > Nothing to compile - all classes are up to date > > --- nbm-maven-plugin:4.7:manifest (default-manifest) @ nbrunfile-sample --- > NBM Plugin generates manifest > > --- exec-maven-plugin:3.0.0:exec (default-cli) @ nbrunfile-sample --- > Command execution failed. > java.io.IOException: Cannot run program "java" (in directory > "/mnt/atlas/data/git/slask/nbrunfile/nbrunfile-sample"): error=2, Filen > eller katalogen finns inte > at java.lang.ProcessBuilder.start (ProcessBuilder.java:1143) > at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073) > at java.lang.Runtime.exec (Runtime.java:615) > at org.apache.commons.exec.launcher.Java13CommandLauncher.exec > (Java13CommandLauncher.java:61) > -- Eric Bresie [email protected]
