Java - (Main|Start) Class

Java Conceptuel Diagram

About

Language - (Main|Application Entry point) in Java is called a Main class.

The (Main|Start) class is a class that:

You may have several main class in a jar

How to execute a main class ?

Java

You can start the java application by:

java -classPath myJar.jar  com.package.myMainClass arg1 arg2

Runnable Jar and Manifest file

If in the jar, you have a manifest file that contains the Main-Class attribute, the jar becomes a runnable jar

Manifest-version: 1.0
Main-Class: HelloWorld

and can be executed like that:

java -jar myStartableJar.jar

Maven

Maven will take care of the classpath

mvn package exec:java -Dexec.mainClass=package.Class

Eclipse

Eclipse Main Class





Discover More
Java Conceptuel Diagram
Java - (Jar|Java ARchive) File

JAR stands for Java ARchive and is file format born in 1996 as a simple extension of the popular ZIP archive format with class and other required resource files: manifest signature files images,...
Java Conceptuel Diagram
Java - Application

An application in shipped in an archive format with a main class that contains a main method that starts the application. instancejava/lang/Runtimeclass RuntimeOperating System environment ...
Simple Class
Java - Class (Definition)

A java/lang/Classclass provides the blueprint for objects; you create an object from a class. All classes are derived from the Object class. A class declaration names the class and encloses the class...
Eclipse Export Runnable Jar 1
Java - Jar (Startable|Runnable|Executable)

A (Startable|Runnable|Executable) jar-file is an jar archive of compiled classes that contains a manifest-file that point to the (start|main) class You start it with the following command: ...
Java Conceptuel Diagram
Java - Manifest File

A manifest file is needed in a jar file in order to transform it as an executable or startable jar file. Where: the main class property is the main class which starts the application Manifest_file...
Java Conceptuel Diagram
Java - Module

A Java module is a packaging format that create a modular JAR file. It's a feature of JDK 9 from the Java Platform Module System (JPMS) that divide the monolithic rt.jar and tools.jar files into 75 distinct...
Java Conceptuel Diagram
Java Concurrency - Process (Main thread)

process in Java A process in Java is: started by a main class. implemented as a main thread that can create other thread. It has: a self-contained execution environment. a complete, private...
Vertx Launcher Extension Custom Idea Run
Vertx - Launcher extension (Custom launcher)

The launcher has several io/vertx/core/Launcherlifecycle methods that you can override in order to add custom code that provide a way to configure the options: for the creation of a vertx or for the...



Share this page:
Follow us:
Task Runner