centos7 java -verison Error: Could not create the Java Virtual Machine.

2023-02-18 15:54:47 浏览数 (2)

错误情况

代码语言:javascript复制
[root@gitlab download]# java -verison
Unrecognized option: -verison
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

解决办法

environment

代码语言:javascript复制
vim /etc/environment

增加一行

代码语言:javascript复制
export _JAVA_OPTIONS="-Xms64m -Xmx64m -Xmn32m"

让 environment 生效

代码语言:javascript复制
source /etc/environment

生效后重新运行 java -version

代码语言:javascript复制
[root@gitlab download]# java -verison
Unrecognized option: -verison
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[root@gitlab download]# 
[root@gitlab download]# vim /etc/environment 
[root@gitlab download]# source /etc/environment 
[root@gitlab download]# java -version
Picked up _JAVA_OPTIONS: -Xms64m -Xmx64m -Xmn32m
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

0 人点赞