Я установил OpenJDK 11 (версия 11.0.2) на MacOS Mojave (версия 10.14.2), выполнив эти шаги .Затем я попытался запустить JShell сеанс в Apache NetBeans IDE 10.0 , но я получаю эту ошибку:
| Could not initialize JShell: Launching JShell execution engine threw: Failed remote launch: java.util.concurrent.TimeoutException @ com.sun.jdi.CommandLineLaunch (defaults: home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home, options=, main=, suspend=true, quote=", vmexec=java) -- {home=home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home, options=options=-classpath /Users/Steve/Apps/netbeans/java/modules/ext/nb-mod-jshell-probe.jar:, main=main=org.netbeans.lib.jshell.agent.AgentWorker 49866, suspend=suspend=true, quote=quote=", vmexec=vmexec=java}
| caused by: Failed remote launch: java.util.concurrent.TimeoutException @ com.sun.jdi.CommandLineLaunch (defaults: home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home, options=, main=, suspend=true, quote=", vmexec=java) -- {home=home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home, options=options=-classpath /Users/Steve/Apps/netbeans/java/modules/ext/nb-mod-jshell-probe.jar:, main=main=org.netbeans.lib.jshell.agent.AgentWorker 49866, suspend=suspend=true, quote=quote=", vmexec=vmexec=java}
| caused by: null
Как устранить проблему?
Глядя на диспетчер платформ Java в IDE, я вижу, что JDK установлен правильно, а простое приложение Java SE с использованием Maven компилируется и работает нормально.
Обновление
Из О NetBeans:
Java: 11.0.2; OpenJDK 64-Bit Server VM 11.0.2+9
Runtime: OpenJDK Runtime Environment 11.0.2+9
Из плагинов:
Java Shell
Version: 1.2.1
Source: Apache NetBeans IDE 10.0 (Build
incubator-netbeans-release-380-on-20181217)
На компьютере не установлено никакого другого JDK.
Я могу вызвать jshell успешно в терминале NetBeans:
$ jshell
| Welcome to JShell -- Version 11.0.2
| For an introduction type: /help intro
jshell>
Журнал IDE при открытии оболочки Java Platform:
INFO [org.netbeans.modules.jshell.support.ShellSession]: Error in JSHell
java.util.concurrent.TimeoutException
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
at jdk.jshell/jdk.jshell.execution.JdiInitiator.timedVirtualMachineCreation(JdiInitiator.java:244)
at jdk.jshell/jdk.jshell.execution.JdiInitiator.launchTarget(JdiInitiator.java:137)
Caused: java.lang.InternalError: Failed remote launch: java.util.concurrent.TimeoutException @ com.sun.jdi.CommandLineLaunch (defaults: home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home, options=, main=, suspend=true, quote=", vmexec=java) -- {home=home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home, options=options=-classpath /Users/Steve/Apps/netbeans/java/modules/ext/nb-mod-jshell-probe.jar:, main=main=org.netbeans.lib.jshell.agent.AgentWorker 50384, suspend=suspend=true, quote=quote=", vmexec=vmexec=java}
at jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300)
at jdk.jshell/jdk.jshell.execution.JdiInitiator.launchTarget(JdiInitiator.java:141)
at jdk.jshell/jdk.jshell.execution.JdiInitiator.<init>(JdiInitiator.java:110)
at org.netbeans.lib.nbjshell.LaunchJDIAgent.create(LaunchJDIAgent.java:217)
at org.netbeans.lib.nbjshell.LaunchJDIAgent.access$000(LaunchJDIAgent.java:62)
at org.netbeans.lib.nbjshell.LaunchJDIAgent$1.generate(LaunchJDIAgent.java:180)
at org.netbeans.modules.jshell.tool.JShellLauncher$CaptureExecControl.generate(JShellLauncher.java:240)
at jdk.jshell/jdk.jshell.JShell.<init>(JShell.java:126)
Caused: java.lang.IllegalStateException: Launching JShell execution engine threw: Failed remote launch: java.util.concurrent.TimeoutException @ com.sun.jdi.CommandLineLaunch (defaults: home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home, options=, main=, suspend=true, quote=", vmexec=java) -- {home=home=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home, options=options=-classpath /Users/Steve/Apps/netbeans/java/modules/ext/nb-mod-jshell-probe.jar:, main=main=org.netbeans.lib.jshell.agent.AgentWorker 50384, suspend=suspend=true, quote=quote=", vmexec=vmexec=java}
at jdk.jshell/jdk.jshell.JShell.<init>(JShell.java:139)
at jdk.jshell/jdk.jshell.JShell$Builder.build(JShell.java:405)
at org.netbeans.modules.jshell.tool.JShellLauncher.createJShellInstance(JShellLauncher.java:258)
at org.netbeans.modules.jshell.support.ShellSession$Launcher.createJShellInstance(ShellSession.java:624)
at org.netbeans.modules.jshell.tool.JShellTool.resetState(JShellTool.java:745)
at org.netbeans.modules.jshell.tool.JShellLauncher.resetState(JShellLauncher.java:207)
at org.netbeans.modules.jshell.tool.JShellLauncher.ensureLive(JShellLauncher.java:195)
at org.netbeans.modules.jshell.tool.JShellLauncher.getJShell(JShellLauncher.java:201)
at org.netbeans.modules.jshell.support.ShellSession.initJShell(ShellSession.java:829)
at org.netbeans.modules.jshell.support.ShellSession.getJShell(ShellSession.java:309)
[catch] at org.netbeans.modules.jshell.support.ShellSession.lambda$null$2(ShellSession.java:514)
at org.netbeans.modules.jshell.model.ConsoleModel$ModelAccImpl.execute(ConsoleModel.java:1104)
at org.netbeans.modules.jshell.support.ShellSession.lambda$start$3(ShellSession.java:510)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)