命令行中的Lint4J给出了NullPointerException

时间:2016-11-29 10:03:04

标签: java macos command-line nullpointerexception lint

我正在尝试从mac上的命令行启动Lint4J(0.9.1)。我想在一个小型测试课上运行它。但不幸的是我总是得到一个空指针异常。 我有JDK 1.8.0

我的测试班:

package ch.ntb.sir.testmain;
public class TestMain {}

我从官方网站下载了lint4j软件包。它与测试类不在同一个文件夹中。

这是我执行的命令:

/Users/.../lib/lint4j-0.9.1/bin/lint4j -sourcepath /Users/.../ClassToCheck/src ch.ntb.sir.testmain

我从我的测试类的项目文件夹中的终端执行它。

我得到的是输出:

Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
at lint4j.aZ.a(Unknown Source)
at lint4j.aZ.a(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.a(Unknown Source)
at lint4j.aw.c(Unknown Source)
at lint4j.aw.e(Unknown Source)
at lint4j.ai.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dq.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.eO.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.by.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dP.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dI.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.ap.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at com.jutils.lint4j.Lint4j.initialize(Unknown Source)
at com.jutils.lint4j.Lint4j.execute(Unknown Source)
at com.jutils.lint4j.cmdline.Main.main(Unknown Source)
Caused by: java.lang.NullPointerException
at lint4j.q.a(Unknown Source)
... 25 more

我发现在这些网站上没有任何帮助我:

http://www.jutils.com/uguide.html

http://www.jutils.com/auditingcode.html

并且在lint4j.pdf中也没什么用处

欢迎所有提示!谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

我已经了解到,Lint4J已经死了#34;项目。上次更新于2007年

Static Analysis tool recommendation for Java?

https://github.com/checkstyle/checkstyle/wiki/Java-static-code-analysis-tools

因此将它用于新项目是一个坏主意。

我会尝试:FindBugs,Checkstyle,PMD ......他们的最后一次更新发生在2015-2016之间