Okay,
I'll just post my code and see what you guys can make of it.

I'm getting the error that the 'main' class could not be found,
but as you can see I have it in the code.

Thanks for the help!

package macey;
/**
 * @author Mike
 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class convDev {

    public static void conv() {
        // Content Pane
        JPanel content = new JPanel();
        content.setLayout(new GridBagLayout());
        GridBagConstraints c = new GridBagConstraints();

        // Menubar
        JMenuBar menuBar = new JMenuBar();

        JMenu fileMenu = new JMenu("File");
        JMenuItem fileQuit = new JMenuItem("Quit");
        fileMenu.add(fileQuit);
        menuBar.add(fileMenu);

        JMenu helpMenu = new JMenu("Help");
        JMenuItem helpAbout = new JMenuItem("About");
        helpMenu.add(helpAbout);
        helpMenu.add(new JSeparator());
        JMenuItem helpTutorial = new JMenuItem("Tutorial");
        helpMenu.add(helpTutorial);
        menuBar.add(helpMenu);

        // Window
        JFrame convWin = new JFrame("Converter");
        convWin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        convWin.setContentPane(content);
        convWin.setJMenuBar(menuBar);
        convWin.pack();
        convWin.setVisible(true);
    }

    public static void main(String[] args) {
        // Showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                conv();
            }
        });
    }
}

Recommended Answers

All 4 Replies

I just copied your code in my eclipse and it works without any change.

did you by any chance get this error (package naming problem)

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
	at convDev.main(convDev.java:42)

Compiles and runs OK for me in Eclipse - I just omitted the package statement and changed the class name to match the name of the .java file I was using.
Maybe a file/directory vs class/package naming thing?

Okay,
I've been using NetBeans. I'll check the file paths etc. and
let you guys know what happened (for others who come up with this problem).

- WolfShield

I agree with JamesCherrill about the 'package'. It is annoying for me when I code something in a package and cannot test the class on its own main. I have to test it out from an outside class which imports the package class in.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.