Reputation: 191
I'm learning about SWING on intellij. I made a quick app on the GUI designer that contains a button. I compiled it just fine but whenever I run it it throws this error
Exception in thread "main" java.lang.NoClassDefFoundError: com/intellij/uiDesigner/core/GridLayoutManager
Here's the code (I run this file from another main file)
import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Created by Leon_Clemente on 6/3/15.
*/
public class myFirstTest extends JFrame {
private JTabbedPane tabbedPane1;
private JPanel panel1;
private JButton browseButton;
private JButton uploadButton;
private JCheckBox checkBox1;
private JCheckBox checkBox2;
public myFirstTest() {
/*
browseButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
}
});
*/
setVisible(true);
}
private void createUIComponents() {
}
}
So I read on the forums and the only thing I could relate this problem with is that my running classpath is not the same than my compiling classpath(?) I still don't exactly get the idea though.
Upvotes: 0
Views: 1033
Reputation: 453
I think you forgot to make main method
Create a new class in same package where myFirstTest is present and try this code:
public class Main{
public static void main(String[] args) {
myFirstTest myfirst = new myFirstTest();
myfirst.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myfirst.setSize(400,400);
myfirst.setVisible(true);
}
Upvotes: 1
Reputation: 2155
forms_rt.jar contains GridLayoutManager class and this jar is located in (IntelliJ IDEA Root)\lib. Search for this jar in compile environment.
Add this jar to the class path.
How to set the classpath - setting the path of a jar file
Upvotes: 1