com.apple.eawt - what exactly I should install

孤街醉人 提交于 2019-11-27 15:33:35

There is no JAR to download or anything extra to install, the classes are part of the JDK on Mac OS X. In Apple Java 6 JDKs they live in Contents/Classes/ui.jar under the JDK bundle (e.g. /System/Library/Java/JavaVirtualMachines/1.6.0.jdk or /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk), on Oracle Java 7 they are in lib/rt.jar under the JRE home directory (/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home or /Library/Java/JavaVirtualMachines/jdk1.7.0*.jdk/Contents/Home/jre).

Just like any other external library, you have to add the JAR containing those classes to your classpath. Just because you are running on a Mac does not mean the stock Java JDK is 'extended' -- otherwise, it would not be truly platform-independent.

Solution for Java 9 and later

In JDK 9, internal APIs such as those in the Mac OS X com.apple.eawt package will no longer be accessible.

see: http://openjdk.java.net/jeps/272 (later methods have been moved to java.awt.Taskbar)

com.apple.eawt has been replaced.
Some of the features are covered here: https://docs.oracle.com/javase/9/docs/api/java/awt/Taskbar.html

An example implementation of setting the dock icon in mac os can be found here:
https://stackoverflow.com/a/56924202/5276779

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!