Eclipse package plugin

xiaoxiao2021-03-06  63

Source: http://fjep.sourceforge.net/fjeptutorial.html

http://fjep.sourceforge.net/#inst

Fat Jar Eclipse Plug-in Tutorial

Step 1: Create a New Java Project "DEMOLIB"

Create a New Java Project named "Demolib" .add the class "demolib.demolib.java" Containing The Following Code:

Package Demolib;

Public class decolib {

Public static void sayhello () {

System.out.Println ("Hello");

}

}

The Project Should Look Something Like this:

Step 2: Create a Jar File Using Fat Jar Plug-in

In the "package-explorer" (NOTTE "resource-view") Right Click on the project "Demolib" .Select "Fat Jar> Quick Build Fat Jar"

A Configuration Dialog Appears. Just Press "Finish".

The file "Demolib_fat.jar" HAS Been Created in The Project Root Directory.

Step 3: Create A New Java-Project "Demorun"

Create a New Java Project named "Demorun" .in the project "demolib / demolib_fat.jar" to the java build path ":

Step 4: CREATE Main Class

Add the class "demorun.demorunmain.java" Containing the Following Code:

Package Demorun;

Import Demolib.Demolib;

Public class demorunmain {

Public static void main (String [] args) {

Demolib.sayhello ();

}

}

The Project Should Look Something Like this:

Step 5: Start The Build Fat Jar Dialog

Start the export wizard from the file-menu ("file" -> "export"). SELECT " FAT JAR EXPORTER" and click "Next>".

Select The Project "Demorun" and click "Next>".

A Configuration-Dialog Appears Showing The Current Settings.

Step 6: SELECT The Main Class

The Main Class - the one containing the static methode main - must be defined in the jar.Click on the "Browse ..." Button on the right side behind the Main-Class Edit field.Select "DemoRunMain" and click the "OK "Button.The FullyqualifiedName" Demorun.Demorunmain "is now set for" main-class ".

STEP7: FINISH

Save the current settings by clicking on the "finish" button.

The File "demorun_fat.jar" has been created in the project root directory.In addition the file ".fatjar" storing the configuration settings has been created in the project root directoryThe created jar file contains all classes from all referenced jar files (demolib_fat. JAR) and the project classes.this file can be el acted Anywhere, No ClassPath Has To Be Set, Because All Necessary Librariesare Extracted Inside The "Fat Jar":

> java -jar deomrun_fat.jar

Hello

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

New Post(0)