I have written an application in Java for both Mac OSx and Windows, but I've developed it on Windows. Therefore I used java.lang.reflect.*
in order to implement the 'About' and 'Quit' handler without receiving exceptions.
I've exported it as an Executable Jar and everything works fine on both operating systems. However, I want to obfuscate the application and I'm using ProGaurd to do so. I've specified the necessary libraries for it to work on Windows (rt.jar, jsse.jar, jce.jar) and it still does work fine on Windows, however ProGaurd is telling me that there is two unresolved dynamic references to classes or interfaces, and the obfuscated application no longer works properly on Mac (the About and Quit Handler don't work).
I read somewhere that the ui.jar
was required, so I copied it accross from my Mac and specified it in ProGaurd but that did not seem to solve the problem! Any solutions appreciated then...
Thanks in advance
UPDATE
I have now used AppleJavaExtensions in order to implement the handlers using com.apple.eawt.Application
rather than reflect. However, I'm still getting the exact same problem! Here is the code that I am currently using:
package ap;
import com.apple.eawt.AboutHandler;
import com.apple.eawt.AppEvent;
import com.apple.eawt.AppEvent.QuitEvent;
import com.apple.eawt.Application;
import com.apple.eawt.QuitHandler;
import com.apple.eawt.QuitResponse;
import com.gui.Tabs;
public class xa implements AboutHandler, QuitHandler {
// Constructor to register/install the necessary handler's
public xa(){
Application.getApplication().setAboutHandler(this);
Application.getApplication().setQuitHandler(this);
}
// Implemented method to catch the About menu item
@Override
public void handleAbout(AppEvent.AboutEvent e) {
Tabs.switchAbout();
}
// Implemented method to catch the Quit menu item
@Override
public void handleQuitRequestWith(QuitEvent arg0, QuitResponse arg1) {
Tabs.quit();
}
}
AND I am using the ProGuard GUI to obfuscate my application. In Obsfucation 'tab' at the bottom I've added class ap.xa
and specified that it extends/implements AboutHandler, QuitHandler
. I've also added the Class com.gui.Tabs
but it the problem still occurs.