I using Swing GUI Form in my program. In IntelliJ IDEA all work fine, but after packaging via Maven I get the error:
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" method only run constructor of class, constructor configured GUI Form via $$$setupUI$$$() method (File - Settings - Generate GUI into: Java source code).
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**
...
}
I read all topics about this error, I added all dependencies into pom.xml (poi, poi-ooxml, swingx, forms_rt, ideauidesigner-maven-plugin, junit, forms, javac2), all needed plugins (maven-jar-plugin, ideauidesigner-maven-plugin) but still have problem with GridLayoutManager after packagin.
Thanks for all, you are best.
But I forgot paste into pom.xml maven-compiler-plugin and configure it
<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>