Showing posts with label jar. Show all posts
Showing posts with label jar. Show all posts

Maven: executing JAR created with Maven

In this tutorial we will learn how to create an executable jar with Maven and run it from command line.


Let's add a maven-jar-plugin to your pom, make sure you specify your main class as such:

<mainClass>exec.MyApp</mainClass>





Run Maven:

uki@ JavaFxSceneSwitch $ mvn clean install[INFO] Scanning for projects...[INFO]                                                                         [INFO] ------------------------------------------------------------------------[INFO] Building JavaFxSceneSwitch 1.0-SNAPSHOT[INFO] ------------------------------------------------------------------------...[INFO] Installing .. to /Users/uki/.m2/repository/edu/clcillinois/cit137/JavaFxSceneSwitch/1.0-SNAPSHOT/JavaFxSceneSwitch-1.0-SNAPSHOT.jar[INFO] Installing ...[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 1.822 s[INFO] Finished at: 2015-04-21T14:57:43-05:00[INFO] Final Memory: 15M/91M[INFO] ------------------------------------------------------------------------



Run the app from the ROOT of your project:


uki@ UKI_LUCAS $ java -jar  /Users/uki/.m2/repository/edu/clcillinois/cit137/JavaFxSceneSwitch/1.0-SNAPSHOT/JavaFxSceneSwitch-1.0-SNAPSHOT.jar



The JavaFX app should start, if you start it from other folder, observe how the Image path behaves.



As an Amazon Associate I earn from qualifying purchases.

Maven: executing JAR created with Maven

In this tutorial we will learn how to create an executable jar with Maven and run it from command line.


Let's add a maven-jar-plugin to your pom, make sure you specify your main class as such:

<mainClass>exec.MyApp</mainClass>





Run Maven:

uki@ JavaFxSceneSwitch $ mvn clean install[INFO] Scanning for projects...[INFO]                                                                         [INFO] ------------------------------------------------------------------------[INFO] Building JavaFxSceneSwitch 1.0-SNAPSHOT[INFO] ------------------------------------------------------------------------...[INFO] Installing .. to /Users/uki/.m2/repository/edu/clcillinois/cit137/JavaFxSceneSwitch/1.0-SNAPSHOT/JavaFxSceneSwitch-1.0-SNAPSHOT.jar[INFO] Installing ...[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 1.822 s[INFO] Finished at: 2015-04-21T14:57:43-05:00[INFO] Final Memory: 15M/91M[INFO] ------------------------------------------------------------------------



Run the app from the ROOT of your project:


uki@ UKI_LUCAS $ java -jar  /Users/uki/.m2/repository/edu/clcillinois/cit137/JavaFxSceneSwitch/1.0-SNAPSHOT/JavaFxSceneSwitch-1.0-SNAPSHOT.jar



The JavaFX app should start, if you start it from other folder, observe how the Image path behaves.



As an Amazon Associate I earn from qualifying purchases.

Java: find jar

When you are looking for a given Java class, you can use this online database to locate jars:

Example, looking for log4j

http://www.findjar.com/index.x?query=log4j

Among others I get response:

[JAR] log4j-1.1.3.jar in log4j/log4j/1.1.3
[JAR] log4j-1.2.11.jar in log4j/log4j/1.2.11
[JAR] log4j-1.2.12.jar in log4j/log4j/1.2.12





As an Amazon Associate I earn from qualifying purchases.

Java: find jar

When you are looking for a given Java class, you can use this online database to locate jars:

Example, looking for log4j

http://www.findjar.com/index.x?query=log4j

Among others I get response:

[JAR] log4j-1.1.3.jar in log4j/log4j/1.1.3
[JAR] log4j-1.2.11.jar in log4j/log4j/1.2.11
[JAR] log4j-1.2.12.jar in log4j/log4j/1.2.12





As an Amazon Associate I earn from qualifying purchases.

apt quotation..