M. Eric DeFazio created NETBEANS-1131: -----------------------------------------
Summary: "Execute Java Shell" fails when in a non-modular project Key: NETBEANS-1131 URL: https://issues.apache.org/jira/browse/NETBEANS-1131 Project: NetBeans Issue Type: Bug Components: apisupport - Project Affects Versions: 9.0 Environment: Product Version: Apache NetBeans IDE 9.0 (Build incubator-netbeans-release-334-on-20180708) Java: 10.0.2; Java HotSpot(TM) 64-Bit Server VM 10.0.2+13 Runtime: Java(TM) SE Runtime Environment 10.0.2+13 System: Windows 10 version 10.0 running on amd64; Cp1252; en_US (nb) User directory: C:\Users\Eric\AppData\Roaming\NetBeans\9.0 Cache directory: C:\Users\Eric\AppData\Local\NetBeans\Cache\9.0 Reporter: M. Eric DeFazio Attachments: NetbeansShellError.png I can use the "Execute Java Shell" option when right clicking on a Module Project BUT, when I have another project that depends on the Modular project, if I try the "Execute Java Shell" option I get the following failure: {{Could not initialize JShell: Launching JShell execution engine threw: Failed remote launch: java.util.concurrent.ExecutionException: com.sun.jdi.connect.VMStartException: VM initialization failed for: C:\Program Files\Java\jdk-10.0.2\bin\java -classpath C:\Users\Eric\Downloads\incubating-netbeans-java-9.0-bin\netbeans\java\modules\ext\nb-mod-jshell-probe.jar;C:\Users\Eric\Documents\NetBeansProjects\ModProj\dist\M.jar;C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes --add-modules M,jdk.jshell --add-reads jdk.jshell=ALL-UNNAMED --module-path C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes -Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug2032,suspend=y org.netbeans.lib.jshell.agent.AgentWorker 63903 @ com.sun.jdi.CommandLineLaunch (defaults: home=C:\Program Files\Java\jdk-10.0.2, options=, main=, suspend=true, quote=", vmexec=java) -- \{home=home=C:\Program Files\Java\jdk-10.0.2, options=options=-classpath C:\Users\Eric\Downloads\incubating-netbeans-java-9.0-bin\netbeans\java\modules\ext\nb-mod-jshell-probe.jar;C:\Users\Eric\Documents\NetBeansProjects\ModProj\dist\M.jar;C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes --add-modules M,jdk.jshell --add-reads jdk.jshell=ALL-UNNAMED --module-path C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes, main=main=org.netbeans.lib.jshell.agent.AgentWorker 63903, suspend=suspend=true, quote=quote=", vmexec=vmexec=java}}} {{| caused by: Failed remote launch: java.util.concurrent.ExecutionException: com.sun.jdi.connect.VMStartException: VM initialization failed for: C:\Program Files\Java\jdk-10.0.2\bin\java -classpath C:\Users\Eric\Downloads\incubating-netbeans-java-9.0-bin\netbeans\java\modules\ext\nb-mod-jshell-probe.jar;C:\Users\Eric\Documents\NetBeansProjects\ModProj\dist\M.jar;C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes --add-modules M,jdk.jshell --add-reads jdk.jshell=ALL-UNNAMED --module-path C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes -Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug2032,suspend=y org.netbeans.lib.jshell.agent.AgentWorker 63903 @ com.sun.jdi.CommandLineLaunch (defaults: home=C:\Program Files\Java\jdk-10.0.2, options=, main=, suspend=true, quote=", vmexec=java) -- \{home=home=C:\Program Files\Java\jdk-10.0.2, options=options=-classpath C:\Users\Eric\Downloads\incubating-netbeans-java-9.0-bin\netbeans\java\modules\ext\nb-mod-jshell-probe.jar;C:\Users\Eric\Documents\NetBeansProjects\ModProj\dist\M.jar;C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes --add-modules M,jdk.jshell --add-reads jdk.jshell=ALL-UNNAMED --module-path C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes, main=main=org.netbeans.lib.jshell.agent.AgentWorker 63903, suspend=suspend=true, quote=quote=", vmexec=vmexec=java}}} {{| caused by: com.sun.jdi.connect.VMStartException: VM initialization failed for: C:\Program Files\Java\jdk-10.0.2\bin\java -classpath C:\Users\Eric\Downloads\incubating-netbeans-java-9.0-bin\netbeans\java\modules\ext\nb-mod-jshell-probe.jar;C:\Users\Eric\Documents\NetBeansProjects\ModProj\dist\M.jar;C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes --add-modules M,jdk.jshell --add-reads jdk.jshell=ALL-UNNAMED --module-path C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes -Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug2032,suspend=y org.netbeans.lib.jshell.agent.AgentWorker 63903}} {{| caused by: VM initialization failed for: C:\Program Files\Java\jdk-10.0.2\bin\java -classpath C:\Users\Eric\Downloads\incubating-netbeans-java-9.0-bin\netbeans\java\modules\ext\nb-mod-jshell-probe.jar;C:\Users\Eric\Documents\NetBeansProjects\ModProj\dist\M.jar;C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes --add-modules M,jdk.jshell --add-reads jdk.jshell=ALL-UNNAMED --module-path C:\Users\Eric\Documents\NetBeansProjects\Java10App\build\classes -Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug2032,suspend=y org.netbeans.lib.jshell.agent.AgentWorker 63903}} Some sanity checks: BOTH projects are using the same JDK (JDK10) I built/ created a jar for the Module project Included is a screenshot of what happens Explanation of the screenshot: * the top JShell instance, was started by "Execute Java Shell" by right clicking on the Java10App (and it threw the stacktrace above) * the bottom JShell instance (Started from the ModProj project) was started by right clicking and "Execute Java Shell" works fine To minimize extraneous issues, neither project has anything extra in the modulepath/classpath there is only 1) module m in the ModProj project, and there is only 1) class m.AModClass To reproduce: (my names are in ()) 1) create a new "Java Modular Project" (ModProj) with Java9+VM 2) create a new Module (M) in the modular project 3) create a new (m) package 4) create a new class (AModClass) in the (m) package 5) update the "module-info.java" file to export the (m) package 6) right click on "Execute Java Shell" on the (ModProj) project... verify it starts, verify you can call the code (AModClass) 7) build the project 8) create a new Java Application (Java10App) with Java 9+ runtime 9) add a dependency to the existing Module (ModProj) 10) add a class in the project (J10App) and verify it can access class (AModClass) in the module {{package apackage;}} {{import m.AModClass;}} {{public class J10App {}} {{ public static void main(String[] args){}} {{ System.out.println( AModClass.aStaticMethod() );}} {{ }}} {{}}} 11) Right Click on the Java10App (project), select "Execute Java Shell" -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists