jshell on ios without process exec?

Robert Field robert.field at oracle.com
Fri Mar 11 19:19:21 UTC 2016


Hi Grigory,

It is theoretically possible to implement a (reduced functionality) 
in-process version of JShell, in fact the original prototypes were 
in-process.

At this point however, JDI (which is out of process) is well ensconced 
in the design.

I have intentionally left some support framework for in-process in the 
code to facilitate a possible future in-process option.  The code is 
open-source, so if you are inclined I'd be happy to give you pointers to 
re-implement in-process.

-Robert

On 03/11/16 08:45, Grigory Ptashko wrote:
> Hello.
>
> Long story short. I’ve just tried to use jshell on ios (both arm64 and simulator).
>
> I try this:
>
> JShell jshell = JShell.create();
> List<SnippetEvent> events = jshell.eval("2+2");
> System.out.println(events.get(0).value());
>
> And get the exception:
>
> Exception in thread "Thread-0" java.lang.Error: iOS is not a supported OS platform.
> 	at java.lang.ProcessImpl$Platform.get(ProcessImpl.java:171)
> 	at java.lang.ProcessImpl.<clinit>(ProcessImpl.java:175)
> 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1111)
> 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1075)
> 	at java.lang.Runtime.exec(Runtime.java:624)
> 	at java.lang.Runtime.exec(Runtime.java:483)
> 	at com.sun.tools.jdi.AbstractLauncher$Helper.launchAndAccept(AbstractLauncher.java:180)
> 	at com.sun.tools.jdi.AbstractLauncher.launch(AbstractLauncher.java:132)
> 	at com.sun.tools.jdi.SunCommandLineLauncher.launch(SunCommandLineLauncher.java:223)
> 	at jdk.jshell.JDIConnection.launchTarget(JDIConnection.java:303)
> 	at jdk.jshell.JDIConnection.open(JDIConnection.java:121)
> 	at jdk.jshell.JDIEnv.init(JDIEnv.java:49)
> 	at jdk.jshell.ExecutionControl.jdiGo(ExecutionControl.java:269)
> 	at jdk.jshell.ExecutionControl.launch(ExecutionControl.java:71)
> 	at jdk.jshell.JShell.executionControl(JShell.java:613)
> 	at jdk.jshell.ClassTracker$ClassInfo.getReferenceTypeOrNull(ClassTracker.java:81)
> 	at jdk.jshell.Unit.lambda$classesToLoad$3(Unit.java:266)
> 	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1422)
> 	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:591)
> 	at jdk.jshell.Unit.classesToLoad(Unit.java:264)
> 	at jdk.jshell.Eval.lambda$compileAndLoad$13(Eval.java:559)
> 	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
> 	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1422)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
> 	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:511)
> 	at jdk.jshell.Eval.compileAndLoad(Eval.java:560)
> 	at jdk.jshell.Eval.declare(Eval.java:462)
> 	at jdk.jshell.Eval.declare(Eval.java:448)
> 	at jdk.jshell.Eval.processExpression(Eval.java:291)
> 	at jdk.jshell.Eval.eval(Eval.java:118)
> 	at jdk.jshell.JShell.eval(JShell.java:350)
> 	at EvalJava.main(EvalJava.java:14)
>
> Is it possible to use jshell without exec’ing a process? Within the same process?
>
> Thank you.
>
> --
> Best regards,
> Grigory Ptashko
> Software developer at Biblio-Globus Touroperator
> g.ptashko at bgoperator.com
> Phone: +7 495 5042500 ext 1557
> Mobile: +7 916 1489766
>



More information about the kulla-dev mailing list