Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

macos

swing

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?

like image 588
H.Arias Avatar asked Dec 01 '25 04:12

H.Arias


1 Answers

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.

like image 62
Thunderforge Avatar answered Dec 02 '25 16:12

Thunderforge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!