Jar缺少Sun课程 [英] Jar missing Sun classes

查看:114
本文介绍了Jar缺少Sun课程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在编写一些软件,但我意识到我无法运行jar,因为它缺少一些类,而它直接从IDE运行。该jar内置于最新的IntelliJ Idea社区版中。当我尝试使用java -jar运行它时,这是它给出的错误。

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

我从IDE使用的命令开始运行它和我删除了尽可能多的类,我留下了这个命令。

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

如果没有来自JRE的前两个依赖项,程序将无法启动。当我删除它们时,我得到上述错误。我不知道为什么当它们已经在JRE中时我需要手动链接它们。

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.

推荐答案

我删除了所有的我的代码中的InvalidStateException,现在运行完美。

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

这篇关于Jar缺少Sun课程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆