April 9th, 2009, 09:47 PM
I wrote a simple program with a gui that basically took user input and made a MLA citation from it. I recently found out I can have it initialize in one click by making it a .jar file and decided it would be a good idea. However, when I try, it says that it cannot find the main method, even though I have it in one of my files. Can someone please help? Here are the files.
I've been using the commands (I'm not sure which is right, another place I need help)
jar cmf mainClass.txt MLA.jar webs.java books.java mlas.java
jar cmf mainClass.txt MLA.jar webs.class books.class mlas.class
webs.java and books.java are just two files that create new JFrames with more content.
The program works outside of the .jar file.
Here is mlas.java
public class mlas extends JFrame implements ActionListener
private JLabel words;
book = new JButton("Book");
words = new JLabel("Inacuracies in citation may exist. Manually double checking is reccomended. * denotes required field");
public void actionPerformed(ActionEvent e)
Books z= new Books();
else if (e.getActionCommand().equals("Online Source"))
Webs y= new Webs();
else if (e.getActionCommand().equals("Exit"))
public static void main(String args)
mlas x = new mlas();
and heres mainClass.txt
April 10th, 2009, 05:29 AM
Re: jar command
I suggest you read and understand the Jar tool docs and tutorial for what you want to do.
Originally Posted by blitzkreig2
Incidentally, the Java Naming Conventions specify that a class name begins with an upper-case letter.
Don't ask what it means, but rather how it is used...
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!