Java - Application
Table of Contents
About
An application in shipped in an archive format with a main class that contains a main method that starts the application.
Every Java application has a single instance of class Runtime that allows the application to interface with the Operating System environment in which the application is running.
Articles Related
Deployment / Start
Operating system
How to start a java application in its own process with the jvm directly from the console
Script
You can start a java application by creating a shell script.
java -cp ../lib/myApplication.jar com.mypackage.myMainClass arg1 arg2
where:
- java is the java virtual machine
- cp is the classpath where you will have your application and all your dependency.
- myApplication.jar is a jar (archive) of all your application class and resources that is stored normally in a lib directory.
- com.mypackage.myMainClass is your main class
- arg1 arg2 are arguments passed to the main method of your main class
Runnable
With a executable jar, you just need to call the jar with java.
java -jar my_executable.jar
Application Server (J2EE, Tomcat,…)
A Java EE application is packaged into one or more standard units for deployment to any Java EE platform-compliant system.
Each unit contains:
- A functional component or components, such as an enterprise bean, web page, servlet, or applet
- An optional deployment descriptor that describes its content
Once a Java EE unit has been produced, it is ready to be deployed. Once deployed, the application is ready to run.
Launcher
A launcher is a java class that take into account all the steps needed to start your application. This is an advanced technique.