Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 9 incompatibilities on macOS #121

Closed
felker opened this issue Feb 27, 2018 · 4 comments
Closed

Java 9 incompatibilities on macOS #121

felker opened this issue Feb 27, 2018 · 4 comments

Comments

@felker
Copy link

felker commented Feb 27, 2018

Is TurboVNC 2.1 supposed to be Java 9 compatible? I was unable to find a definitive answer in the documentation, but I know from #59 and the latest roadmap that Java 9 considerations are involved in the planning of 2.2.

I encountered issues on macOS 10.13.3 High Sierra after upgrading from JDK 1.8.0_162 whereby the .app container would refused to open or crash when trying to establish a connection. I don't know Java, but running the JAR from the console revealed the use of com.apple.eawt APIs which are not accessible by default in JDK 9

/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/java -jar VncViewer.jar 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.turbovnc.vncviewer.VncViewer (file:/Applications/TurboVNC/TurboVNC%20Viewer.app/Contents/Resources/Java/VncViewer.jar) to method com.apple.eawt.Application.getApplication()
WARNING: Please consider reporting this to the maintainers of com.turbovnc.vncviewer.VncViewer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
main: Could not set look & feel:
main:   java.lang.ClassNotFoundException: com.apple.eawt.OpenFilesHandler
Exception in thread "Thread-1" java.util.ServiceConfigurationError
	at java.base/java.nio.channels.spi.SelectorProvider.loadProviderFromProperty(SelectorProvider.java:104)
	at java.base/java.nio.channels.spi.SelectorProvider.access$000(SelectorProvider.java:69)
	at java.base/java.nio.channels.spi.SelectorProvider$1.run(SelectorProvider.java:178)
	at java.base/java.nio.channels.spi.SelectorProvider$1.run(SelectorProvider.java:176)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.nio.channels.spi.SelectorProvider.provider(SelectorProvider.java:175)
	at com.turbovnc.network.SocketDescriptor.defaultSelectorProvider(SocketDescriptor.java:74)
	at com.turbovnc.network.SocketDescriptor.<init>(SocketDescriptor.java:33)
	at com.turbovnc.network.TcpSocket.<init>(TcpSocket.java:72)
	at com.turbovnc.vncviewer.CConn.<init>(CConn.java:156)
	at com.turbovnc.vncviewer.VncViewer.run(VncViewer.java:809)
	at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.ClassNotFoundException: sun.nio.ch.PollSelectorProvider
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:375)
	at java.base/java.nio.channels.spi.SelectorProvider.loadProviderFromProperty(SelectorProvider.java:99)
	... 11 more
nat-oitwireless-inside

@dcommander
Copy link
Member

I haven't gotten around to testing Java 9 yet. :( I'll look into it, but it may be a week or two, as I'm churning and burning on a libjpeg-turbo release right now.

You said com.apple.eawt isn't accessible by default. Is there a way to enable access to it?

@felker
Copy link
Author

felker commented Feb 27, 2018

Thanks for the quick reply @dcommander . It might be worth adding a note to the documentation that Java 9 isn't yet supported.

According to https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-97C1D0BB-D5D3-4CAD-B17D-03A87A0AAF3B,

The java.awt.Desktop class contains replacements for the APIs in the Apple–specific com.apple.eawt and com.apple.eio packages. The new APIs supersede the macOS APIs and are platform-independent.

The APIs in the com.apple.eawt and com.apple.eio packages are encapsulated, so you won’t be able to compile against them in JDK 9. However, they remain accessible at runtime, so existing code that is compiled to old versions continues to run. Eventually, libraries or applications that use the internal classes in the apple and com.apple packages and their subpackages will need to migrate to the new API.

The com.apple.concurrent and apple.applescript packages are removed without any replacement.

@dcommander
Copy link
Member

I believe this is finally fixed in the latest PR build for 2.1.x:
https://turbovnc.org/DeveloperInfo/PreReleases
I will post a more thorough analysis to the mailing list.

@dcommander
Copy link
Member

NOTE: If anyone reading this knows how to do the equivalent of com.apple.eawt.Application.requestToggleFullScreen() and com.apple.eawt.FullScreenListener.addFullScreenListenerTo() using non-deprecated APIs, please let me know. I looked at the JDK source for Java 9 and Java 10, and it didn't appear as if the low-level hooks for toggling OS X full-screen mode are exposed in any other place, despite com.apple.eawt being marked deprecated. I'm also really upset that Oracle decided to deprecate Java Web Start without offering a viable replacement, given that they've spent many years promoting JWS as a migration path for applets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants