Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having problems trying to run java as a normal user on linux. It runs fine as root user but not as a regular user.

Any help would be apreciated.

Thanks

root@pro1 [~]# which java
/usr/local/jdk/bin/java
root@pro1 [~]# java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
root@pro1 [~]# su istream
istream@xxxxxxxxx [/root]# which java
/usr/local/jdk/bin/java
istream@xxxxxxxxx [/root]# java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
istream@xxxxxxxxx [/root]#

Update:

Yes, limits was the problem.. The server is running cpanel and that is imposing some pretty strict limits on users.

Thanks for the info.

share|improve this question
    
have you tried, as the regular user, to do 'java -version' while in some other directory than /root? –  BenGC Jan 10 '11 at 23:43
    
Yes it is the same even from the users home dir or form anywhere else on the system. Have also tried ./java -version form the java bin dir. –  Roger Jan 11 '11 at 0:03
    
If you installed java from a repository, you'd better notify the maintainer. –  halp Jan 11 '11 at 3:08

1 Answer 1

Are there any resource limitations in place for the istream user (run ulimit -a and compare) which root doesn't have, possibly virtual memory (RLIMIT_AS / ulimit -v) ?

If so, check if it gets applied by /etc/security/limits.conf and if you can make an exception for the istream user.

share|improve this answer
    
Could not reserve enough space for object heap means you don't have enough memory. Besides the ulimit part, try to start java with -Xms12m -Xmx12m. Use this only for the -version test. This way the jvm will only allocate 12MB. –  Christian Jan 11 '11 at 7:47
    
+1, I have also seen this exact problem caused by limits –  theotherreceive Jan 11 '11 at 12:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.