Java newbie...Help required
Hi i'm trying to grasp Java via reading tutorials..
I'm trying to setup a small quiz but getting nowhere..
My code is below
================================================== =======
package footballquiz;
import java.applet.*;
import java.awt.*;
import javax.swing.*;
public class Main {
private static void createAndShowGUI() {
//Create window
JFrame frame = new JFrame("main");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
JLabel emptyLabel = new JLabel("main");
emptyLabel.setPreferredSize(new Dimension(175, 100));
frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
//Display Window
//Display the window.
frame.pack();
frame.setVisible(true);
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
================================================
when running i get the following error..
"Footballquiz.Main class wasn't found in FootballQuiz project"
Can anyone shed light on this please.... and point me in the right direction...
Thanks in advance
Re: Java newbie...Help required
Can you copy and paste here the full contents of the console.
You post shows different case for the package and the error message. java is case sensitive. Make sure the the names match.
If this is an IDE question, I have no idea how to fix it.
Re: Java newbie...Help required
What is the name of your class you are in? Because if you named it something other than Main, you will have an issue. In Java, the class you are in has to be the name of the .java file.
When you say:
It will look to see if you are in the Main class. If you are not, it will throw an exception.
My guess is the name of your file is Footballquiz and the compiler is attempting to create Main as an inner class (which would be named Footballquiz$Main.class or something)
Re: Java newbie...Help required