Created on 2017-04-27.12:00:03 by alanb, last changed 2017-05-02.17:45:20 by stefan.richthofer.
|msg11327 (view)||Author: Alan Bateman (alanb)||Date: 2017-04-27.12:00:02|
`java -jar jython-standalone-2.7.0.jar` does not does not prompt for input. Running with `--permit-illegal-access` (new option in JDK 9 to reveal code doing bad things) may help understand what is going on, it seems that Jython has code that is trying to access a few JDK internal classes and fields. $ java --permit-illegal-access -jar jython-standalone-2.7.0.jar WARNING: --permit-illegal-access will be removed in the next major release WARNING: Illegal access by jnr.posix.JavaLibCHelper (file:/jython/jython-standalone-2.7.0.jar) to method sun.nio.ch.SelChImpl.getFD() (permitted by --permit-illegal-access) WARNING: Illegal access by jnr.posix.JavaLibCHelper (file:/jython/jython-standalone-2.7.0.jar) to field sun.nio.ch.FileChannelImpl.fd (permitted by --permit-illegal-access) WARNING: Illegal access by jnr.posix.JavaLibCHelper (file:/jython/jython-standalone-2.7.0.jar) to field java.io.FileDescriptor.fd (permitted by --permit-illegal-access) WARNING: Illegal access by org.python.core.PySystemState (file:/jython/jython-standalone-2.7.0.jar) to method java.io.Console.encoding() (permitted by --permit-illegal-access) Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java9-internal Type "help", "copyright", "credits" or "license" for more information. >>> >>> >>>
|msg11328 (view)||Author: Stefan Richthofer (stefan.richthofer)||Date: 2017-04-27.20:46:40|
Apart from java.io.Console.encoding() this looks mainly like a jnr issue. Maybe an update of jnr to a recent release can help...? (see https://github.com/jnr/jnr-posix/releases) Any ideas for a workaround of the java.io.Console.encoding()-thing?
|msg11330 (view)||Author: Alan Bateman (alanb)||Date: 2017-04-28.08:06:01|
There isn't any supported API for getting the console encoding. It comes up periodically but there it's never clear whether it's the right thing to do or not. Here is a relatively recent thread on the topic: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-September/043617.html
|msg11339 (view)||Author: Stefan Richthofer (stefan.richthofer)||Date: 2017-05-02.17:45:19|
Regarding java.io.Console.encoding I'd suggest first immediate action would be to try/catch the illegal access. Then we can fallback to some default value or maybe we can call: https://github.com/jline/jline2/blob/master/src/main/java/jline/internal/Configuration.java#L225 (Jython bundles JLine already) If that isn't sufficient, we can maybe implement something like http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-September/043638.html for the major platforms via JNI. (If possible add it to the launcher.) I will also try if maybe a JNI-call to java.io.Console.encoding still permits the access (as JNI calls traditionally do) without the exception. Regarding jnr, we'll have to try most recent version and if that fails, raising a bug at their tracker (i.e. making it a SEP :-) https://en.wikipedia.org/wiki/Somebody_else's_problem) -- I suppose jnr also wants to be conveniently workable on Java 9.
|2017-05-02 17:45:20||stefan.richthofer||set||messages: + msg11339|
|2017-04-28 08:06:02||alanb||set||messages: + msg11330|
messages: + msg11328