Jul 15, 2017

OpenJDK 9: Jshell - Using Swing / doing GUI stuff

After the posts buitin commands of jshell and how to load and save scripts i tried to get swing components running.

I created a script  HelloWorld.java
import javax.swing.*;       

JFrame frame = new JFrame("HelloWorldSwing");
JLabel label = new JLabel("Hello World");
But this does not work with Ubuntu:
jshell HelloWorld.java
# A fatal error has been detected by the Java Runtime Environment:
#  SIGSEGV (0xb) at pc=0x00007f61041bb009, pid=7440, tid=7442
# 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
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to /home/schroff/core.7440)
# An error report file with more information is saved as:
# /home/schroff/hs_err_pid7440.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.
|  State engine terminated.
|  Restore definitions with: /reload restore
|  Resetting...
|  Welcome to JShell -- Version 9-internal
|  For an introduction type: /help intro
Hmmm. This does look good.

On a Windows 10 host it works without any problem:

I hope this bug will be fixed soon...
EDIT: After downloading a new version from java.net it worked:

./java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+178)
Java HotSpot(TM) 64-Bit Server VM (build 9+178, mixed mode)

No comments:

Post a Comment