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

Created on 2017-04-27.12:00:03 by alanb, last changed 2018-03-11.20:23:32 by jeff.allen.

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.
msg11604 (view) Author: Tom Alexander (teeohhem) Date: 2017-09-26.17:39:30
This is no longer an issue. Java 9 decided to launch with --permit-illegal-access as the default, so no cmd arg is necessary. That being said, it won't be the default in Java 10 (and it may go away all together).
msg11782 (view) Author: Jeff Allen (jeff.allen) Date: 2018-03-11.20:23:32
I created an issue #2656 for the "illegal access" problem in general, unaware of this one.

I'm not totally convinced that that is what was making the prompt disappear. Our attempt to use Console.encoding is already guarded with a try-catch to leave encoding null. If I force that, it falls back on file.encoding (yeah, I know) and if I force it still to be null, I end up with cp1252 (Latin-1). No failure with encoding here makes the prompt disappear.

And yet I've seen the like myself (with Java 9 I think). I can't reproduce it on demand now I want to.
Date User Action Args
2018-03-11 20:23:32jeff.allensetkeywords: + Java Roadmap
priority: normal
messages: + msg11782
components: + Core, - Any
nosy: + jeff.allen
2017-09-26 17:39:30teeohhemsetnosy: + teeohhem
messages: + msg11604
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