H.Arias
H.Arias

Reputation: 81

How can I use apple com.apple.eawt functionality on Java 8?

I have recently started learning java and I am working/improving on a java IDE. I'm trying to find a way so that when you double click a file, the file is automatically opened with my program.

So far the only way I have found to do that is by using the apple extension com.apple.eawt (question found here). The only problem is that I have JDK 1.8 and this extension no longer works. Following this question, I looked for it on my computer and I believe it was last included in JDK 1.6.

My questions are: is there a way to use this extension in java 1.8? Or is there an Apple or non-Apple replacement that will do the same?

Upvotes: 3

Views: 1758

Answers (1)

Thunderforge
Thunderforge

Reputation: 20565

Java 9 has replicated most of com.apple.eawt in the java.awt.Desktop class

For instance, you pointed to a question that recommended using Application.getApplication().setOpenFileHandler(myOpenHandeler).

This is equivalent to Desktop.setOpenFileHandler(OpenFilesHandler openFileHandler).

This functionality is also now available on platforms other than macOS, such as Windows.

Upvotes: 5

Related Questions