gpt4 book ai didi

java - 添加所有依赖项,但 NoClassDefFoundError com/intellij/uiDesigner/core/GridLayoutManager

转载 作者:太空宇宙 更新时间:2023-11-04 11:17:15 24 4
gpt4 key购买 nike

我在程序中使用 Swing GUI Form。在 IntelliJ IDEA 中一切正常,但通过 Maven 打包后出现错误:

C:\Work\Idea\XLSConfigurdator\target>java -jar xlsconfigurdator-parent-1.0.jar. Exception in thread "main" java.lang.NoClassDefFoundError: com/intellij/uiDesign er/core/GridLayoutManager at XLSCreator.$$$setupUI$$$(XLSCreator.java) at XLSCreator.(XLSCreator.java:24) at XLSCreator.main(XLSCreator.java:73) Caused by: java.lang.ClassNotFoundException: com.intellij.uiDesigner.core.GridLa youtManager at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 3 more

C:\Work\Idea\XLSConfigurdator\target>java -jar xlsconfigurdator-parent-1.0.jar Exception in thread "main" java.lang.NoClassDefFoundError: com/intellij/uiDesign er/core/GridLayoutManager at XLSCreator.$$$setupUI$$$(XLSCreator.java) at XLSCreator.(XLSCreator.java:24) at XLSCreator.main(XLSCreator.java:73) Caused by: java.lang.ClassNotFoundException: com.intellij.uiDesigner.core.GridLa youtManager at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 3 more

“main”方法仅运行类的构造函数,构造函数通过 $$$setupUI$$$() 方法配置 GUI 表单(文件 - 设置 - 生成 GUI 到:Java 源代码)。

public static void main(String[] args) {
new XLSCreator();

sourceClass sc = new sourceClass();
array = sc.readFromExcel(fileName);
}

public XLSCreator() {
$$$setupUI$$$();
setContentPane(rootPanel);
setVisible(true);
setSize(500, 200);
setTitle("I'll save your mistakes");

aceptButton.addActionListener(this);
**etc**
...
}

我阅读了有关此错误的所有主题,我将所有依赖项添加到 pom.xml 中(poi、poi-ooxml、swingx、forms_rt、ideauidesigner-maven-plugin、junit、forms、javac2)、所有需要的插件(maven-jar-plugin、ideauidesigner-maven-plugin),但打包后 GridLayoutManager 仍然存在问题。

最佳答案

谢谢大家,你们是最好的。

但是我忘记粘贴到 pom.xml maven-compiler-plugin 并配置它

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>XLSCreator</mainClass>
</manifest>
</archive>
</configuration>
</plugin>

关于java - 添加所有依赖项,但 NoClassDefFoundError com/intellij/uiDesigner/core/GridLayoutManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45322033/

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