Jar Package Double-click Execute program

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.