Java lang断言错误

时间:2012-09-30 04:15:24

标签: java swing java-web-start

使用Java Web Start运行Java应用程序时遇到此错误。虽然Application在eclipse中运行得非常好,但是在Java web start中也正确加载了应用程序。代码试图打开文件选择器但无法执行此操作。

Exception in thread "AWT-EventQueue-0" java.lang.AssertionError
    at sun.awt.shell.Win32ShellFolder2$4.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$4.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)
    at sun.awt.shell.ShellFolder.invoke(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2.getIShellFolder(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2.access$200(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$2.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$2.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)
    at sun.awt.shell.ShellFolder.invoke(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2.<init>(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2.createShellFolderFromRelativePIDL(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$11.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$11.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

2 个答案:

答案 0 :(得分:2)

好的,我刚刚找到了自己问题的答案。我已经在JNLP文件中禁用了断言,代码开始工作得很好。

我已经改变了

<j2se version="1.5+" java-vm-args="-esa -Xnoclassgc"/>

<j2se version="1.5+" java-vm-args="-dsa -Xnoclassgc"/>

希望这也有助于其他人。

答案 1 :(得分:2)

看一下该课程的source code。只有2个assert语句,它们都出现在匿名类中。因此它们与您的堆栈跟踪完美匹配

assert(isDirectory());
assert(parent != null);

不要禁用这些断言,只需检查为什么不满足这些条件并修复它。