Discuss / Java / Error occurred during initialization of boot layer java.lang.module.的说明

Error occurred during initialization of boot layer java.lang.module.的说明

Topic source

412445773

#1 Created at ... [Delete] [Delete and Lock User]

首先, 是我的环境

# java --version
openjdk 19.0.1 2022-10-18
OpenJDK Runtime Environment Temurin-19.0.1+10 (build 19.0.1+10)
OpenJDK 64-Bit Server VM Temurin-19.0.1+10 (build 19.0.1+10, mixed mode, sharing)

其次, 经测试,

#java --module-path . --module hello.world 
Helloxml

最后, 结论,

原文有误.java命令是支持指定module选项,来直接执行module结构的,需要使用module-path传进来一个路径而非文件.

412445773

#2 Created at ... [Delete] [Delete and Lock User]

但是,

#java --module hello.world --module-path . 

是会报错的, 命令行的运行和命令行的选项顺序有关系? 不科学啊

廖雪峰

#3 Created at ... [Delete] [Delete and Lock User]

命令行参数的解析不是bash或者操作系统做的,是程序内部自己做的,它要求顺序那就要顺序

412445773

#4 Created at ... [Delete] [Delete and Lock User]

谢谢解答


  • 1

Reply