JEP 311: Java Packager API & CLI (original) (raw)

Michael Hall mik3hall at gmail.com
Fri Oct 20 08:29:07 UTC 2017


On Oct 20, 2017, at 1:51 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

On 19/10/2017 22:37, Michael Hall wrote: : Thanks. I couldn’t figure out how to use it with the current javapackager. It turned out I needed —add-modules, I’m new to modular concerns. This was for JShell. It also seemed that this needed a java executable in the bin directory. I added that manually and was able to use JShell from a OS X java 9 application.

I realize this is going off-topic but can you elaborate more on this. There should never be a need to copy binaries into the bin directory. The jdk.jshell module includes jshell launcher for example.

I got a JShell JRE with —add-modules I initialize a JShell shell with… private static final JShell shell = JShell.create(); Without java in the bin directory the first time I try to use the shell with…

        List<SnippetEvent> result = shell.eval(sb.toString());
        for (SnippetEvent evt : result) {
            System.out.println(evt.value());
        }

I get…

int x = 5 java.lang.ExceptionInInitializerError at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.cmdline.psuedoGestalt.Runner.invoke(Runner.java:207) at org.cmdline.psuedoGestalt.Runner.runStatic(Runner.java:234) at org.cmdline.psuedoGestalt.Runner.runMain(Runner.java:226) at org.cmdline.psuedoGestalt.Runner.run(Runner.java:144) Caused by: java.lang.IllegalStateException: Launching JShell execution engine threw: Failed remote listen: java.io.IOException: Cannot run program "/Users/mjh/HalfPipe/HalfPipe7.app/Contents/PlugIns/Java.runtime/Contents/Home/bin/java": error=2, No such file or directory @ com.sun.jdi.SocketListen (defaults: timeout=, port=, localAddress=) -- {timeout=timeout=5000, port=port=, localAddress=localAddress=127.0.0.1} at jdk.jshell/jdk.jshell.JShell.(JShell.java:139) at jdk.jshell/jdk.jshell.JShell$Builder.build(JShell.java:405) at jdk.jshell/jdk.jshell.JShell.create(JShell.java:420) at us.hall.repl.JShellReplImpl.(JShellReplImpl.java:8) ... 8 more Caused by: java.lang.InternalError: Failed remote listen: java.io.IOException: Cannot run program "/Users/mjh/HalfPipe/HalfPipe7.app/Contents/PlugIns/Java.runtime/Contents/Home/bin/java": error=2, No such file or directory @ com.sun.jdi.SocketListen (defaults: timeout=, port=, localAddress=) -- {timeout=timeout=5000, port=port=, localAddress=localAddress=127.0.0.1} at jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300) at jdk.jshell/jdk.jshell.execution.JdiInitiator.listenTarget(JdiInitiator.java:199) at jdk.jshell/jdk.jshell.execution.JdiInitiator.(JdiInitiator.java:111) at jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:103) at jdk.jshell/jdk.jshell.execution.JdiExecutionControlProvider.generate(JdiExecutionControlProvider.java:148) at jdk.jshell/jdk.jshell.spi.ExecutionControl.generate(ExecutionControl.java:179) at jdk.jshell/jdk.jshell.spi.ExecutionControl.generate(ExecutionControl.java:296) at jdk.jshell/jdk.jshell.execution.FailOverExecutionControlProvider.generate(FailOverExecutionControlProvider.java:103) at jdk.jshell/jdk.jshell.spi.ExecutionControl.generate(ExecutionControl.java:179) at jdk.jshell/jdk.jshell.spi.ExecutionControl.generate(ExecutionControl.java:296) at jdk.jshell/jdk.jshell.JShell.(JShell.java:136) ... 11 more Caused by: java.io.IOException: Cannot run program "/Users/mjh/HalfPipe/HalfPipe7.app/Contents/PlugIns/Java.runtime/Contents/Home/bin/java": error=2, No such file or directory at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071) at jdk.jshell/jdk.jshell.execution.JdiInitiator.listenTarget(JdiInitiator.java:173) ... 20 more Caused by: java.io.IOException: error=2, No such file or directory at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) at java.base/java.lang.ProcessImpl.(ProcessImpl.java:339) at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:270) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107) ... 22 more



More information about the jdk-dev mailing list