1.Maven Package an executable jar:
<Build> <Plugins> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-compiler-plugin</Artifactid> <version>3.7.0</version> <Configuration> <Source>1.8</Source> <Target>1.8</Target> </Configuration> </plugin> </Plugins> </Build>
2. Execute an executable jar command in the console: JAVA-CP <jar name> <main class name>
Example: JAVA-CP How-to-read-input-from-console-0.0.1-snapshot.jar com.nmj.console.ReadConsole3
3. Run the Times out exception: jarにメイン?マニフェスト attribute がありません. The manifest in the jar lacks the definition of the main class.
Specify the main entry class after-CP.
4. Execute an executable jar command in the console (when the main class is defined in Jar manifest): Java-jar <jar name>
Example: Java-jar How-to-read-input-from-console-0.0.1-snapshot.jar
Java-Executes an executable jar in the console