Entry point classes

suggest change

A Java entry-point class has a main method with the following signature and modifiers:

public static void main(String[] args)
Sidenote: because of how arrays work, it can also be (String args[])

When the java command starts the virtual machine, it loads the specified entry-point classes and tries to find main. If successful, the arguments from command line are converted to Java String objects and assembled into an array. If main is invoked like this, the array will not be null and won’t contain any null entries.

A valid entry-point class method must do the following:

It is conventional to declare the class as public but this not strictly necessary. From Java 5 onward, the main method’s argument type may be a String varargs instead of a string array. main can optionally throw exceptions, and its parameter can be named anything, but conventionally it is args.

JavaFX entry-points

From Java 8 onwards the java command can also directly launch a JavaFX application. JavaFX is documented in the JavaFX tag, but a JavaFX entry-point must do the following:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Java command: java and javaw:
* Entry point classes

Table Of Contents
8 Arrays
10 Maps
11 Strings
25 JAXB
29 Enums
32 Audio
41 Scanner
63 Logging
75 Lists
78 Sets
89 JAX-WS
96 XJC
98 Process
106 Modules
114 Applets
122 JNDI
125 Java command: java and javaw
139 JavaBean
141 Literals
144 Packages
150 JMX
153 JShell
159 Sockets
167 Enum Map
175 Hashtable
177 SortedMap