“不可编译的源代码” netbeans中的RuntimeException [英] "Uncompilable source code" RuntimeException in netbeans

查看:199
本文介绍了“不可编译的源代码” netbeans中的RuntimeException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想帮助另一个使用Netbeans的开发人员。当他运行或调试他的一些代码在Netbeans(6.9.1),他得到一个不可编译的源代码 RuntimeException 。我在Java相当有经验,但更习惯于IntelliJ,并没有使用Netbeans。

I'm trying to help another developer who is using Netbeans. When he runs or debugs some code of his in Netbeans (6.9.1) he gets an "Uncompilable source code" RuntimeException. I'm pretty experienced in Java but am more used to IntelliJ, and haven't used Netbeans at all.

我做了一些google搜索,似乎Netbeans会编译代码,即使有错误,然后抛出 RuntimeException 在错误。 (相当不好的行为IMO,但我想有些人会发现它有用。)我有他完全重建项目没有编译错误,但 RuntimeException 似乎仍然发生。我假设他在Netbeans深处有一些不好的缓存类数据。

I've done it a bit of googling and it seems Netbeans will compile code even with errors, and then throw the RuntimeException at the errors. (Fairly bad behaviour IMO, but I guess some will find it useful.) I've got him to completely rebuild the project with no compile errors, but the RuntimeException seems to still occur. I assume he's got some bad cached class data somewhere deep within Netbeans.

2个问题:


  1. 清除缓存的最好方法是什么,以便我们可以找到不可编译代码的位置?

  2. 是否有任何方法关闭此行为,因此代码不会运行/调试,除非一切都将编译,因此这些RuntimeException不会注入代码?

,但尚未找到这些问题的答案。

I've googled a fair bit, but haven't found the answer to either of these questions yet.

更新:更多信息:


  1. 关闭保存时编译选项使问题消失。再次打开CoS会将异常返回。不幸的是,这不是一个修复,因为CoS是一个非常有用的选项。

  2. http://netbeans.org/bugzilla/show_bug.cgi?id=182009 似乎是最近的错误报告,但它已被关闭为RESOLVED INCOMPLETE。不幸的是,这个bug很难重现 - 异常发生在Java库代码中,当它调用第三方库时,所以没有任何东西,异常抛出我们可以改变。代码将工作几个星期,然后突然开始抛出这个错误,没有明显的理由为什么。

  3. 我们已经尝试手动删除整个构建目录 - 仍然不是一个修复。 li>
  1. Turning off the "compile on save" option makes the problem go away. Turning CoS back on again brings the exception back. Unfortunately this isn't a fix, as CoS is a very useful option.
  2. http://netbeans.org/bugzilla/show_bug.cgi?id=182009 seems the closest bug report, but it has been closed as "RESOLVED INCOMPLETE". Unfortunately the bug is hard to reproduce - the exception is happening in Java library code, when it calls a third-party library, so there isn't anything at the point the exception is thrown we can change. And the code will work for weeks, and then suddenly start throwing this error with no obvious reason why.
  3. We've tried manually deleting the entire build directory - still not a fix.


推荐答案

我们终于得到了一个解决方案,但仍然不知道为什么会发生这种情况。当你有编译保存激活时,Netbeans生成第二组类文件用于调试等。这些存储在 $ USER / .netbeans / var / cache / index / s * / java / * / classes

We finally got a solution, but still don't quite know why the situation occurs. When you have Compile On Save activated, Netbeans generates a second set of class files for debugging etc. These are stored in $USER/.netbeans/var/cache/index/s*/java/*/classes

不知何故(不知如何)此目录可能会损坏或无法更新。

Somehow (not sure how) this directory can get corrupted or fail to update.

如果关闭netbeans,请删除 $ USER / .netbeans / var / cache / index 和所有子目录并重新启动netbeans,这将清除缓存。

If you close netbeans, delete $USER/.netbeans/var/cache/index and all subdirectories and restart netbeans this clears the cache. If you have no compile errors, your problem ought to go away at this point.

注意:$ USER是您的用户目录 - 在Windows 7上,这通常是 c:\Users\username ,我想在Unix上会是〜username

NB: $USER is your user directory - on Windows 7 this is usually c:\Users\username, I guess on Unix it will be ~username.

如果您遇到此问题,请投票,评论或添加信息至: http: //netbeans.org/bugzilla/show_bug.cgi?id=182009

If you get this problem please vote for, comment on, or add information to: http://netbeans.org/bugzilla/show_bug.cgi?id=182009

这篇关于“不可编译的源代码” netbeans中的RuntimeException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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