Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PATH and CLASSPATH settings in Linux

 
Gangireddy Danam
Ranch Hand
Posts: 32
Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i had made CLASSPATH and PATH settings in RedHat Enterprise 5 version in the followed way in .bashrc file

export JAVA_HOME=/usr/jre1.7.0_10/


export PATH=$PATH:/usr/jre1.7.0_10/bin:
export CLASSPATH=$CLASSPATH:/usr/jre1.7.0_10/lib:


after setting i saved .bashrc and i did run the .bashrc in followed way.
[root@localhost ~]# sh .bashrc
[root@localhost ~]# java -version


After entering java -version i am getting followed error .Please tell me how to solve this error , why this error is coming when java -version command typed with reasons.

Error: dl failure on line 864
Error: failed /usr/jre1.7.0_10/lib/i386/client/libjvm.so, because /usr/jre1.7.0_10/lib/i386/client/libjvm.so: cannot restore segment prot after reloc: Permission denied.


ThankYou..



 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do no need to add /usr/jre1.7.0_10/lib to the class path since the jars in the JDK/JRE distribution are automatically added to the class path when you invoke 'java' .
 
Gangireddy Danam
Ranch Hand
Posts: 32
Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had not installed JDK in OS . I simply placed JRE folder in /usr directory...
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick search found that this error is usually associated with SELinux (I think Security Enhanced Linux, a sort of firewall installed on some versions of Linux, including Red Hat 5, if I understand it correctly).

The quick-test solution is to disable selinux using setenforce 0 then seeing if it Java works. Then turn it back on using setenforce 1. If that works for you then you should find the SELinux configuration (some versions of Linux have a GUI configurator, and others do not). What you want to do is allow Text Relocation, so in the GUI look for something like "Allow the use of shared libraries with Text Relocation". Or, I think, you could use a command line to allow Text Relocation just for the jvm:

However, I am not an expert on this matter, I just did some quick research. Using the above command lines could cause security problems or might lead to the same problem on other scripts. So please research further yourself.
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gangireddy Danam wrote:I had not installed JDK in OS . I simply placed JRE folder in /usr directory...


You still do not need to add /usr/jre1.7.0_10/lib to the class path ! As long as the PATH points to the JRE bin directory it will pick up the correct jars.
 
Gangireddy Danam
Ranch Hand
Posts: 32
Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

@Steve Luke
ThankYou Sir..It's working fine..
 
Campbell Ritchie
Sheriff
Pie
Posts: 49447
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gangireddy Danam,
Your post was moved to a new topic.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic