Martijn Courteaux
Martijn Courteaux

Reputation: 68847

How to get Apple Java Extensions (com.apple.eawt) work on JDK 7 and higher?

TL;DR: Apple has dropped native feature support in Java. Especially touchpad gestures are not working any longer. I wrote a library that does the job using JNI. Take a look at my answer below.


I'm searching for about hours to make the Apple Java Extensions work on JDK 7 or 8. I have been trying all I can think of. All threads on the internet about this simply blame the JDK for this. I think this should be solvable, because it worked in JDK 6. For clarity: I can make it work in JDK 6, but I don't want this legacy dependency, because not everybody that will use my application has JDK 6 or knows how to install it, let's say. The goal is to make a double-clickable JAR file that will run as expected with the OS X features (menu bar, gestures, about handler, etc...) with every version of Java installed (greater than JDK 6).

Upvotes: 10

Views: 7387

Answers (4)

Amber
Amber

Reputation: 2463

I had the same problem with "pinch to zoom" - it works in java 6 but not 7 or 8. I came across this bug in the jdk which seems to be responsible. It says it is fixed in Java 9.

Upvotes: 0

Martijn Courteaux
Martijn Courteaux

Reputation: 68847

Since the developer preview release of OS X El Capitan, it became impossible for 99% of average computer users to install Java 6, so this was no longer an option for me. I finally decided to write a native library that will inform Java about gestures through JNI. The project works great and is hosted on GitHub.

Take a look at it here: https://github.com/mcourteaux/MultiTouch-Gestures-Java

Upvotes: 5

u09
u09

Reputation: 499

Go on your project Properties and select the Java Build Path Libraries, your JRE System Library should have an Access rules field like the one displayed in the image

enter image description here

Hit the Edit button and add an access rule to allow access to the com.apple.eawt package.

enter image description here

Upvotes: 2

Ken
Ken

Reputation: 61

I just happened to run across your question and noted that it has not been answered yet. I have a Java program that I have been developing on the Mac, and noted that when I ran it under Java 7, the menu bar, Preferences, Quit and About all worked fine using rt. jar in the program's libraries folder and using a MacAppMenuHandler class that I wrote to provide functionality for those items.

However, when I switched to Java 8, they no longer worked. I'm not sure what the issue is though reading other web sites today suggest a "permissions" issue in Java 8 regarding these files.

However, I solved the problem by copying the rt. jar from Java 7 into the program's libraries, and it has continued to work for me while continuing to develop under Java 8.

I suggest this as one possible solution to the problem.

Hope this helps.

Upvotes: 2

Related Questions