gpt4 book ai didi

intellij-idea - 运行 IntelliJ 测试时出现 IntelliJ NoClassDefFoundError

转载 作者:行者123 更新时间:2023-12-04 21:13:46 27 4
gpt4 key购买 nike

我知道这个问题以前曾以各种形式提出过,但我已经检查了所有答案,我认为我们已经排除了所有答案。

错误:

java.lang.NoClassDefFoundError: com/lgc/infra/geometry/Coord1Val
at com.lgc.infra.geometry.Coords.coord(Coords.java:89)
at com.lgc.infra.geometry.Coords.<clinit>(Coords.java:24)
at com.geoteric.lfd.eos.ReallyBasicTest.make_a_simple_coord(ReallyBasicTest.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.ClassNotFoundException: com.lgc.infra.geometry.Coord1Val
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 37 more

代码:
package com.geoteric.lfd.eos;

import com.lgc.infra.geometry.Coord3;
import com.lgc.infra.geometry.Coords;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

/**
* Created by TClarke on 27/03/2015.
*/
public class ReallyBasicTest {
@Test
public void make_a_simple_coord()
{
Coord3 c3 = Coords.coord(1.0f, 2.0f, 3.0f);
assertThat(c3.getX(), equalTo(1.0));
}
}

类文件的路径:
D:\ffa_dev\link-for-decisionspace\ext\dssdk\com_lgc_dsp-core_sdk.jar!\com\lgc\infra\geometry\Coords.class

模块结构截图:



测试运行器配置截图:


内置到实际项目中时,相关代码功能正常。那么,关于我可能错过的任何建议?

最佳答案

我认为你的 .iml 没有更新。您是否尝试过重新创建项目/模块 .iml 文件。如果它的 Maven 项目,您可以通过命令重新创建它

mvn idea:idea

.iml 更新后刷新项目并重新运行测试

关于intellij-idea - 运行 IntelliJ 测试时出现 IntelliJ NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29305557/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com