Reputation: 91
I've looked at many of the other similar questions posted but it seems that a lot of it is about exporting and using a .Jar file.
I'm trying to only compile my code. I had it on github but when I cloned and tried to compile the same program on a new computer, I get the following error:
java.lang.NoClassDefFoundError: com/intellij/uiDesigner/core/Spacer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.intellij.uiDesigner.core.Spacer
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)
... 7 more
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"
Process finished with exit code 1
I am currently using jdk 1.8, if anyone can help me compile my program it'll be great, here's a snippet of the main class
public static void main(String[] args) throws IOException {
JFrame frame = new JFrame("CertifyGUI");
frame.setContentPane(new CertifyGUI().panelMain);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
Upvotes: 1
Views: 6232
Reputation: 401887
This code uses classes from IntelliJ IDEA GUI Designer, for this code to compile and run you need to include these classes in the classpath and build the code from IntelliJ IDEA or using javac2
Ant task.
The missing classes are available in IDEA_HOME\redist\forms_rt.jar
.
When building from IntelliJ IDEA, the required classes are copied to the output directory (classpath) automatically and the .class
files are instrumented with the GUI initialization code based on the .form
files.
There are ways to build it with Maven/Gradle/Ant in the command line, you can Google the relevant answers if that is what you need (javac2 maven
, javac2 gradle
, etc).
Upvotes: 2