I am trying to do something really simple but I don't know how to do it. I have a third party jar file which has the class definition. I have a class with the main method. The main class uses a class in the jar file. I compiled with this command option. There was no error complaint.
javac -classpath party.jar mymain.java
When I tried to run the program, I got the following error:
java -jar party.jar myMain
Exception in thread "main" java.lang.NullPointerException at sun.launcher.LauncherHelper.getMainClassFromJar(LauncherHelper.java:399)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:463)
I think I need to add the Main-Class option in the jar file. But I am not allow to change the party.jar file because it belongs to a third party. What do I need to do to run my program ? Do I need to create my own jar file ? If yes what do I need to include in there ?
This is the exact commands and output
myjar]$ javac -cp party.jar mymain.java
myjar]$ java -cp party.jar mymain
Error: Could not find or load main class mymain