mmimaa
mmimaa

Reputation: 91

Jar missing Sun classes

I've been writing some software, but I realised that I can't run the jar because it is missing some classes, while it is running fine straight from the IDE. The jar is built in the latest IntelliJ Idea Community Edition. This is the error it gives me when I try to run it using "java -jar".

Exception in thread "main" java.lang.NoClassDefFoundError: sun/plugin/dom/exception/InvalidStateException
        at ro.mihalea.abstractInput.mothership.Main.main(Main.java:26)
Caused by: java.lang.ClassNotFoundException: sun.plugin.dom.exception.InvalidStateException

I started from the command used by the IDE to run it and I removed as many classes as I could and I was left with this command.

java  -cp "Mothership.jar:C:\Program Files\Java\jdk1.7.0_51\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\plugin.jar;E:\Programming\Java\IntelliJ Idea\abstractINPUT\out\production\Mothership;E:\Programming\Java\IntelliJ Idea\abstractINPUT\Mothership\lib\*;E:\Programming\Java\IntelliJ Idea\abstractINPUT\out\production\Shared" ro.mihalea.abstractInput.mothership.Main

Without the first two dependencies coming from the JRE, the program would not start. When I remove them I get the error described above. I don't know why I need to link them manually when they are already in the JRE.

Upvotes: 2

Views: 1282

Answers (1)

mmimaa
mmimaa

Reputation: 91

I removed any occurrences of InvalidStateException in my code, and now it runs flawless.

Upvotes: 3

Related Questions