This site requires JavaScript, please enable it in your browser!
Greenfoot back
Forj4K
Forj4K wrote ...

2017/11/30

Java 9 - Installer crash

Forj4K Forj4K

2017/11/30

#
Hey there, I'm currently trying to install Greenfoot on an OpenJDK 9 enviroment. I need OpenJDK 9, there's no other option for me sadly because of the following error: https://stackoverflow.com/questions/34188495/how-can-i-work-around-the-classcastexception-in-java2d-bug-id-7172749 So I tried to start the Installer, but it crashes:
java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(java.desktop@9-internal/EventQueue.java:1323)
	at java.awt.EventQueue.invokeAndWait(java.desktop@9-internal/EventQueue.java:1298)
	at Installer.main(Installer.java:101)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 1
	at java.lang.String.checkBoundsBeginEnd(java.base@9-internal/String.java:3119)
	at java.lang.String.substring(java.base@9-internal/String.java:1907)
	at Installer.findJavaPath(Installer.java:188)
	at Installer.<init>(Installer.java:123)
	at Installer$1.run(Installer.java:103)
	at java.awt.event.InvocationEvent.dispatch(java.desktop@9-internal/InvocationEvent.java:303)
	at java.awt.EventQueue.dispatchEventImpl(java.desktop@9-internal/EventQueue.java:759)
	at java.awt.EventQueue.access$500(java.desktop@9-internal/EventQueue.java:97)
	at java.awt.EventQueue$3.run(java.desktop@9-internal/EventQueue.java:712)
	at java.awt.EventQueue$3.run(java.desktop@9-internal/EventQueue.java:706)
	at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-internal/ProtectionDomain.java:77)
	at java.awt.EventQueue.dispatchEvent(java.desktop@9-internal/EventQueue.java:729)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@9-internal/EventDispatchThread.java:192)
	at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@9-internal/EventDispatchThread.java:117)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@9-internal/EventDispatchThread.java:106)
	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-internal/EventDispatchThread.java:102)
	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-internal/EventDispatchThread.java:94)
	at java.awt.EventDispatchThread.run(java.desktop@9-internal/EventDispatchThread.java:83)
I think this error is related to the changed behaviour of: System.getProperty("java.specification.version"), which now returns "9" instead of "1.80" so the the substring is failing with an array out of bound exception. In addition I figured out that Java 9 doesn't contain the tools.jar anymore (l. 50 in Installer.java), so the check, if its a JDK path fails. So I simply touches a "tools.jar" file, which obviously result in the following JVM error
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fea1e985009, pid=15758, tid=15786
#
# JRE version: OpenJDK Runtime Environment (9.0) (build 9-internal+0-2016-04-14-195246.buildd.src)
# Java VM: OpenJDK 64-Bit Server VM (9-internal+0-2016-04-14-195246.buildd.src, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libjava.so+0x1d009]  JNU_GetEnv+0x19
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/soeren/Downloads/hs_err_pid15758.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted
So is there a way to make greenfoot run with Java 9? Do you maybe already have a developer version?
davmac davmac

2017/12/2

#
There is no way to make the current version of Greenfoot run with Java 9. The current development version of Greenfoot isn't publicly available and isn't in a usable state. However, the page you link to has a workaround that sounds like it should work with Java 8:
I figured out a workaround for the problem. In short: Start the JVM with the parameter -Dsun.java2d.xrender=false. With that option, I didn't see the problem anymore.
Greenfoot runs as two separate JVM instances, and to add that parameter to the correct one you need to identify which instance the error occurs in. Where do you see the stack trace? (In the Greenfoot terminal window, in the debug log, somewhere else?)
You need to login to post a reply.