linux下java安装和运行报错

Linux下安装java

java官网下载最新版本jdk:jdk-8u91-linux-x64.tar.gz
按照官网说明安装:JDK Installation for Linux Platforms
最后配置环境变量:编辑.bashrc文件。

Linux服务器上java运行报错

1
2
3
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

或者

1
2
Error occurred during initialization of VM 
Could not reserve enough space for code cache

根据报错提示主要是运行内存不足造成,解决办法如下:

1
set JAVA_OPTS=-Xms512m -Xmx512m -XX:MaxPermSize=256m

more:http://stackoverflow.com/questions/4401396/could-not-reserve-enough-space-for-object-heap

tiramisutes wechat
欢迎关注