Note that there are some explanatory texts on larger screens.

plurals
  1. POCould not find main class...jar or manifest
    primarykey
    data
    text
    <p>I am very new to programming but I am trying to learn. I have picked up quite a bit but some concepts just seem to go over my head. It seems like when you are learning like me and you search for a problem, you get many many different answers. Sometimes the way the answers are worded can but confusing to a beginner. Anyway, here is my problem.</p> <p>I have created a very simple program that will do a basic calculation of CMU blocks in a wall. I used the JOptionPane instead of console. I wrote the code in notepad, then saved it as a .java file (blocktestgui.java). I then compiled it with the command "javac blocktestgui.java" to get the "bg.class" file. I can run the program from cmd with "java bg" and it works great. My real problem comes with the jar file. I created a manifest.txt file with Main-Class: bg then an empty line following. Then I use "jar cvmf manifest.txt CMU.jar bg.class" and I get a jar file. Then whenever I run it (in cmd or double clicking) I get "Could not find main class" error.</p> <p>Here is what I have:</p> <p>My java file:</p> <pre><code>import javax.swing.JOptionPane; class bg { public static void main(String[] args) { String firstNumber, secondNumber; double number1, number2, sum; firstNumber = JOptionPane.showInputDialog( "Enter wall length in decimal feet:", JOptionPane.INFORMATION_MESSAGE); secondNumber = JOptionPane.showInputDialog( "Enter wall height in decimal feet:", JOptionPane.INFORMATION_MESSAGE); number1 = Double.parseDouble(firstNumber); number2 = Double.parseDouble(secondNumber); sum = (number1 * number2) / 0.88; JOptionPane.showMessageDialog(null, "Total Blocks are " + sum, "Results", JOptionPane.PLAIN_MESSAGE); System.exit(0); } } </code></pre> <p>My jar contains my bg.class file and this is what my manifest file looks like:</p> <pre><code>Manifest-Version: 1.0 Created-By: 1.7.0_02 (Oracle Corporation) Main-Class: bg </code></pre> <p>I'm at a loss because my java file works but the jar doesn't. Any help would be great.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload