A summary of how to jar (turn to JR Forum)

zhaozj2021-02-16  93

Take the Test.java under the org directory as an example:

1. Open the command line so that the current directory is ORG, then compile TEST.JAVA files: javac -d. Test.java

The result will generate a TEST folder under ORG.

3. Enclose a text file in the org directory, the content is as follows:

Manifest-Version: 1.0

Created-by: 1.4.2 (Sun Microsystems Inc.)

Main-class: test.test

Save as a manifest.mf file

4. In the command line, use the command: jar -cvfm helloworld.jar manifest.mf test

The result will generate a new.jar file under the ORG folder.

It should be noted:

(1) Main-class corresponds to the public class name (including the package name)

(2) JAR's parameters can be viewed directly with JAR, and details will not be described here.

Test.java source program:

Package test;

Import javax.swing. *;

Public Class Test

{

Public static void main (string [] args)

{

JFrame JF = New Jframe ("Welcome");

Jf.setsize (600,500);

Jf.setvisible (TRUE);

Jf.setDefaultCloseOperation (jframe.exit_on_close);

}

}

转载请注明原文地址:https://www.9cbs.com/read-11626.html

New Post(0)