如何为跨平台的Jar调用OS X特定的方法? [英] How can I call an OS X-specific method for my cross-platform Jar?
本文介绍了如何为跨平台的Jar调用OS X特定的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个已编译的可执行JAR文件,该文件在Windows平台上失败.
I have a compiled executable JAR file that fails on Windows platforms.
之所以这样做,是因为我想正确地集成某些特定于OS X的属性,例如关于"窗口.
The reason for this is because I want to properly integrate certain OS X-specific properties — such as the About window.
即使我使用条件条件专门关闭了代码,但JAR在执行的第一行仍然崩溃并显示NoClassDefFoundError
.
Even though I specifically cordoned off the code using a conditional, the JAR is still crashing with a NoClassDefFoundError
on the very first line of execution.
if (isOSX()) {
com.apple.eawt.Application application = com.apple.eawt.Application.getApplication();
application.setAboutHandler(new com.apple.eawt.AboutHandler() {
@Override
public void handleAbout(com.apple.eawt.AppEvent.AboutEvent ae) {
new AboutWindow();
}
});
application.setDefaultMenuBar(MenuSystem.createMenu());
}
是否可以在我的JAR文件中包含此代码,以便我可以拥有一个一致的代码库?
Is it possible to include this code in my JAR file so I can have one consistent codebase?
推荐答案
查看全文