JavaScript 验证器在 Eclipse 中抛出 NullPointerException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5629950/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JavaScript validator throws NullPointerException in Eclipse
提问by Leahcim
I'm coding some PHP files on Eclipse IDE, and I keep getting an error that says "Building Workspace has encountered a problem" -- Workspace is the name of my project area.
我正在 Eclipse IDE 上编写一些 PHP 文件,但我不断收到一条错误消息,提示“构建工作区遇到问题”——工作区是我的项目区域的名称。
When I click on the "details" link I get this
当我点击“详细信息”链接时,我得到了这个
Errors occurred during the build.
Errors running builder 'JavaScript Validator' on project 'Ullman'.
java.lang.NullPointerException
As mentioned, I'm working in PHP so I don't know why it's trying to set up JavaScript Validator. I can't figure out how to stop it from doing these things. Anyone know?
如前所述,我正在使用 PHP,所以我不知道它为什么要尝试设置 JavaScript 验证器。我不知道如何阻止它做这些事情。有人知道吗?
I'm not experienced, so please provide a detailed answer if you can.
我没有经验,所以如果可以,请提供详细的答案。
回答by Cleanshooter
I just ran into this problem myself and the previous accepted answer was not helpful. The problem is not the validator, it is the build. To fix go to Project -> Properties -> Builders, then disable ‘JavaScript Validator'. Since you are working with PHP your build is getting confused when you try and validate a PHP file with a JavaScript validator.
我自己刚刚遇到了这个问题,之前接受的答案没有帮助。问题不在于验证器,而在于构建。要修复,请转到Project -> Properties -> Builders,然后禁用“JavaScript Validator”。由于您正在使用 PHP,当您尝试使用 JavaScript 验证器验证 PHP 文件时,您的构建会变得混乱。
The error message doesn't really do anything it just gets annoying really fast.
错误消息并没有真正做任何事情,它只会很快变得烦人。
http://blindcoder.wordpress.com/2011/03/04/javascript-validator-problem-in-eclipse/
http://blindcoder.wordpress.com/2011/03/04/javascript-validator-problem-in-eclipse/
回答by Carlos Cardenas
Project->Properties->Builders then disable 'Javascript Validator
Project->Properties->Builders 然后禁用'Javascript Validator
http://blindcoder.wordpress.com/2011/03/04/javascript-validator-problem-in-eclipse/
http://blindcoder.wordpress.com/2011/03/04/javascript-validator-problem-in-eclipse/
回答by Paul Beusterien
UPDATE: Cleanshooter's answer is the better one for PHP-specific projects. I'm leaving this answer since it is useful for people who run across the error on JavaScript files because of crashes in the JavaScript parser.
更新:对于特定于 PHP 的项目,Cleanshooter 的答案是更好的答案。我要留下这个答案,因为它对因 JavaScript 解析器崩溃而在 JavaScript 文件上遇到错误的人很有用。
You can disable part of the JavaScript validator with Eclipse -> Preferences -> JavaScript -> Validator -> Errors/Warnings and unchecking Enable JavaScript semantic validation
您可以使用 Eclipse -> Preferences -> JavaScript -> Validator -> Errors/Warnings 禁用部分 JavaScript 验证器并取消选中启用 JavaScript 语义验证
回答by user3358982
I am using the Spring Source Tool Suit IDE and i have fixed this issue by following the below steps :
我正在使用 Spring Source Tool Suit IDE,并且按照以下步骤解决了这个问题:
- select the Project and choose the properties option.
- Select JavaScript > Include Path option and then choose the Source tab.
- Click on Edit button and Click Add button.
Now enter the value for Inclusion Pattern as *.js then click on Ok button and Finish.
I have solved my problem in this way. Please let me know if any one have any other way to solve this problem.
- 选择项目并选择属性选项。
- 选择 JavaScript > 包含路径选项,然后选择源选项卡。
- 单击编辑按钮,然后单击添加按钮。
现在将包含模式的值输入为 *.js,然后单击确定按钮并完成。
我已经通过这种方式解决了我的问题。请让我知道是否有人有任何其他方法可以解决此问题。
回答by Frank Ocean
For those of you who are having trouble with 'dynamic web projects', you may find that none of the other answers work.
对于那些在“动态网络项目”方面遇到问题的人,您可能会发现其他答案都不起作用。
I tried all the options stated here and found that disabling the 'Faceted Project Validation Builder' solved the problem..
我尝试了此处所述的所有选项,发现禁用“Faceted Project Validation Builder”解决了问题。
right click project --> Builders --> uncheck the 'Faceted Project Validation Builder'
右键单击项目 --> Builders --> 取消选中“Faceted Project Validation Builder”
回答by Max
Just go to Project -> Build Automatically and disable this option.. you won't need it anyway with PHP.. because there is nothing to be build.. but this solves the NPE thrown at each save or f5 action
只需转到 Project -> Build Automatically 并禁用此选项.. 无论如何,PHP 都不需要它.. 因为没有什么可构建的.. 但这解决了每次保存或 f5 操作时抛出的 NPE
回答by Mohammad Arif
I ran into the same problem and the above suggestions would not resolved it completely unless until I came across to this post @ How do I remove javascript validation from my eclipse project?
我遇到了同样的问题,上面的建议不会完全解决它,除非我遇到这篇文章@如何从我的 eclipse 项目中删除 javascript 验证?
But even then after doing all (as given the other post url), had to manually removed the "Problems" tab statements like 'Errors' and 'warning' then only it goes away completely at least in Eclipse Juno.
但即使在完成所有操作之后(如给出的另一个帖子 url),也必须手动删除“问题”选项卡语句,例如“错误”和“警告”,然后至少在 Eclipse Juno 中它会完全消失。
Hope it helps someone.
希望它可以帮助某人。
回答by Sujith PS
This is a problem that has happened to me on some Web Dynamic projects. Every time the project is built, I get this error:
这是我在某些 Web 动态项目中遇到的问题。每次构建项目时,我都会收到此错误:
Errors occurred during the build.
Errors running builder ‘JavaScript Validator' on project ‘some-project'.
java.lang.NullPointerException
At a first sight it seems that a Javascript validator
is throwing a NullPointerException
, so probably you will try to disable Client-side Javascript
validation from Project->Properties->Validation
… but I tell you that the problem is not there, you must go to
乍一看似乎 aJavascript validator
正在抛出 a NullPointerException
,因此您可能会尝试禁用Client-side Javascript
验证Project->Properties->Validation
...但我告诉您问题不存在,您必须转到
Project->Properties->Builders
Project->Properties->Builders
then disable Javascript Validator
.
然后禁用Javascript Validator
。
Problem solved.
问题解决了。
回答by Duan
Project->Properties->Builders then disable 'Javascript Validator, this fixed my problem: Errors occurred during the build. Errors running builder 'JavaScript Validator' on project 'xxx'. 29
Project->Properties->Builders 然后禁用'Javascript Validator,这解决了我的问题:构建过程中发生错误。在项目“xxx”上运行构建器“JavaScript Validator”时出错。29
回答by bhaskarc
Disabling ‘Javascript Validator' is not the ideal solution. It is just hiding the problem.
禁用“Javascript Validator”并不是理想的解决方案。它只是隐藏了问题。
What worked for me is this:
对我有用的是:
Switch to a new or a different workspace from File >Switch Workspace and then import your existing project into this new workspace.
从文件 > 切换工作区切换到新的或不同的工作区,然后将现有项目导入到这个新工作区。
Problem solved.
问题解决了。