Using Source-File Mode to Launch Single-File Source-Code Programs The javaw launcher will, however, display a dialog box with error information if a launch fails. Use javaw when you don't want a command prompt window to appear. Windows: The javaw command is identical to java, except that with javaw there's no associated console window. The startup class must be indicated by the Main-Class manifest header in its manifest file.Īrguments after the class file name or the JAR file name are passed to the main() method. If -jar is specified, then its argument is the name of the JAR file containing class and resource files for the application. See Using the JDK_JAVA_OPTIONS Launcher Environment Variable.īy default, the first argument that isn't an option of the java command is the fully qualified name of the class to be called. Note: You can use the JDK_JAVA_OPTIONS launcher environment variable to prepend its content to the actual command line of the java launcher. See Using Source-File Mode to Launch Single-File Source-Code Programs for a description of using the source-file mode. In source-file mode, the java command can launch a class declared in a source file. The method declaration has the following form: The method must be declared public and static, it must not return any value, and it must accept a String array as a parameter. It does this by starting the Java Virtual Machine (JVM), loading the specified class, and calling that class's main() method. The java command starts a Java application. Optional: Arguments following mainclass, source-file, -jar jarfile, and -m or -module module / mainclass are passed as arguments to the main class. See Using Source-File Mode to Launch Single-File Source-Code Programs args. Specifies the source file that contains the main class when using source-file mode. source-file Only used to launch a single source-file program. In other words, mainclass can be used when it is not specified by the module, or to override the value when it is specified. If you're using JAR files, then see jar.Įxecutes the main class in a module specified by mainclass if it is given, or, if it is not given, the value in the module. When you use -jar, the specified JAR file is the source of all user classes, and other class path settings are ignored. The jarfile argument is the name of a JAR file with a manifest that contains a line in the form Main-Class: classname that defines the class with the public static void main(String args) method that serves as your application's starting point. jar jarfile Executes a program encapsulated in a JAR file. Command-line entries following classname are the arguments for the main method. Mainclass Specifies the name of the class to be launched. See Overview of Java Options for a description of available options. Java source-file options Optional: Specifies command-line options separated by spaces. Java - launch a Java application Synopsis
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |