2020-10-09 00:35:50 +01:00
|
|
|
# java
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
> Java 程序启动器。
|
2023-06-04 02:48:54 +01:00
|
|
|
> 更多信息:<https://docs.oracle.com/en/java/javase/20/docs/specs/man/java.html>.
|
2020-10-09 00:35:50 +01:00
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 通过提供类名称运行一个含有 main 函数的 java .class 程序:
|
2020-10-09 00:35:50 +01:00
|
|
|
|
|
|
|
`java {{类名称}}`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 运行一个 .jar 程序:
|
2020-10-09 00:35:50 +01:00
|
|
|
|
|
|
|
`java -jar {{文件名.jar}}`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 运行一个 .jar 程序并且在端口 5005 等待调试器:
|
2020-10-09 00:35:50 +01:00
|
|
|
|
|
|
|
`java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005 -jar {{文件名.jar}}`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 显示 JDK, JRE 和 HotSpot 的版本:
|
2020-10-09 00:35:50 +01:00
|
|
|
|
|
|
|
`java -version`
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
- 显示详细的帮助:
|
2020-10-09 00:35:50 +01:00
|
|
|
|
|
|
|
`java -help`
|