What I want:
I want to install openjdk 9 on my ubuntu (server) machine and it should be available for all users.
What I have done:
- Try to install with
sudo apt-get install openjdk-9-jdk
Java version:
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
This version throws exceptions when using tomcat.
- Using sdkman (http://sdkman.io/)
Java version:
openjdk version "9.0.4" OpenJDK Runtime Environment (build 9.0.4+11) OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)
This version works well but it's only available for one user and the doc doesn't say how to install/configure it system wide for all users. It's also not working when I start an application as systemd service.
I don't have much experience with linux and just look for the simplest way to install a working Java 9 version. Please help.
Edit:
The exception I got when using the jdk in 1. is:
java.lang.IllegalAccessException: class org.apache.tomcat.util.buf.ByteBufferUtils cannot access class jdk.internal.ref.Cleaner (in module java.base) because module java.base does not export jdk.internal.ref to unnamed module @14d7c1f2
at sun.reflect.Reflection.throwIllegalAccessException(java.base@9-internal/Reflection.java:411) ~[na:na]
at sun.reflect.Reflection.throwIllegalAccessException(java.base@9-internal/Reflection.java:402) ~[na:na]
at sun.reflect.Reflection.ensureMemberAccess(java.base@9-internal/Reflection.java:99) ~[na:na]
at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(java.base@9-internal/AccessibleObject.java:355) ~[na:na]
at java.lang.reflect.AccessibleObject.checkAccess(java.base@9-internal/AccessibleObject.java:347) ~[na:na]
at java.lang.reflect.Method.invoke(java.base@9-internal/Method.java:525) ~[na:na]
at org.apache.tomcat.util.buf.ByteBufferUtils.<clinit>(ByteBufferUtils.java:67) ~[tomcat-embed-core-8.5.29.jar!/:8.5.29]
at org.apache.tomcat.util.net.SocketBufferHandler.expand(SocketBufferHandler.java:155) [tomcat-embed-core-8.5.29.jar!/:8.5.29]
at org.apache.tomcat.util.net.SecureNioChannel.processSNI(SecureNioChannel.java:334) [tomcat-embed-core-8.5.29.jar!/:8.5.29]
at org.apache.tomcat.util.net.SecureNioChannel.handshake(SecureNioChannel.java:175) [tomcat-embed-core-8.5.29.jar!/:8.5.29]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1436) [tomcat-embed-core-8.5.29.jar!/:8.5.29]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.29.jar!/:8.5.29]
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@9-internal/ThreadPoolExecutor.java:1158) [na:na]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@9-internal/ThreadPoolExecutor.java:632) [na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.29.jar!/:8.5.29]
at java.lang.Thread.run(java.base@9-internal/Thread.java:804) [na:na]
It seems that tomcat doesn't notice that it is running in Java 9. When I use the sdkman version I don't get that exception. And this exception causes that the SSL handshake is not working anymore.
I'm using the embedded tomcat of spring boot 2.0.1.RELEASE