英文:
when doing test, it shows cannot access <classname> in gradle
问题
无法访问:
当我执行 gradle test 时,会输出这样的错误,然而我已经将 JDK 更改为 1.8,我不知道为什么它仍然告诉我这样的事情。.class 文件来自于 jar 文件。测试代码如下:
我认为问题可能来自 IDEA,因为测试可以在我朋友的计算机上运行。文件在正确的文件夹中,并且在编写代码时,IDEA 没有显示任何红线。
英文:
When I doing gradle test, it outputs such error, however I have changed the jdk to 1.8, I have no idea why it still told me such thing. the .class files are come from the jar file. the test code is below.
I think the problem comes form the IDEA as the test can run on my friend's computer. the fies are in the correct folders and the when writing codes IDEA does not show any red lines.
答案1
得分: 1
请检查您的JAVA_HOME
和Java版本。看起来JAR文件是使用较新版本的Java编译的,但是gradle
仍在使用旧版本。
英文:
Check your JAVA_HOME
and java versions. Looks like the jar was compiled with a newer version of java, but gradle
is still using an old version.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论