Source file: Mymenutest.java
Compilation Result:
C:\users\zhangbz\desktop\demo>Javac Mymenutest.javac:\users\zhangbz\desktop\demo>dirthe volume in drive C is not labeled. The serial number of the volume is E637-Directory of C45fc:\users\zhangbz\desktop\demo the/ A/ A +: $<DIR> . the/ A/ A +: $<DIR> .. the/ A/ A +: $ 1,527mymenutest$1. Class the/ A/ A +: $ 1,779mymenutest$2. Class the/ A/ A +: $ 561mymenutest$3. Class the/ A/ A +: $ 534mymenutest$4. Class the/ A/ A +: $ 2,570Mymenutest.class the/ A/ A the: - 2,884Mymenutest.java6A file9,855bytes2List of -,374,337,536Free bytes C:\Users\zhangbz\Desktop\demo>
How do I generate n classes after compiling?
Get a bag and wrap it up.
Add the package name to the first line of the source file, as follows:
Package mymenu;
Recompile with the following command:
C:\users\zhangbz\desktop\demo>javac-d. Mymenutest.java
After recompiling, the generated class files are saved under the MyMenu folder in the current directory
Then specify the class with the main function to execute when you double-click the jar package:
Add a file (the file name is optional) in the directory where the MyMenu folder is located, specifying Main-class:
Main-class:mymenu. Mymenutest
Requirements: ":" Must have a space, the end of the line must have a carriage return, indicating the end of a line of input.
Finally, the following command is repackaged:
1. txt mymenu
Now that you are done, you can double-click the jar package to execute the Java program.
Jar Package Double-click Execute program