Title: No >>> prompt with JDK 9, seems to be caused by illegal access
Type: behaviour Severity: normal
Components: Any Versions: Jython 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: alanb, stefan.richthofer
Priority: Keywords:

Created on 2017-04-27.12:00:03 by alanb, last changed 2017-05-26.23:30:34 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 (permitted by --permit-illegal-access)
WARNING: Illegal access by jnr.posix.JavaLibCHelper (file:/jython/jython-standalone-2.7.0.jar) to field (permitted by --permit-illegal-access)
WARNING: Illegal access by jnr.posix.JavaLibCHelper (file:/jython/jython-standalone-2.7.0.jar) to field (permitted by --permit-illegal-access)
WARNING: Illegal access by org.python.core.PySystemState (file:/jython/jython-standalone-2.7.0.jar) to method (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 this looks mainly like a jnr issue.
Maybe an update of jnr to a recent release can help...? (see

Any ideas for a workaround of the
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:
msg11339 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-05-02.17:45:19
Regarding 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:
(Jython bundles JLine already)

If that isn't sufficient, we can maybe implement something like

for the major platforms via JNI. (If possible add it to the launcher.)
I will also try if maybe a JNI-call to 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 :-)'s_problem) -- I suppose jnr also wants to be conveniently workable on Java 9.
msg11408 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-05-26.23:30:34
Updated jnr-posix as of
If the jnr-posix aspects of this issue persist, we should bring this up on their issue tracker too.
Date User Action Args
2017-05-26 23:30:34stefan.richthofersetmessages: + msg11408
2017-05-02 17:45:20stefan.richthofersetmessages: + msg11339
2017-04-28 08:06:02alanbsetmessages: + msg11330
2017-04-27 20:46:41stefan.richthofersetnosy: + stefan.richthofer
messages: + msg11328
2017-04-27 12:00:03alanbcreate