aspose file tools*
The moose likes Linux / UNIX and the fly likes PATH and CLASSPATH settings in Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "PATH and CLASSPATH settings in Linux" Watch "PATH and CLASSPATH settings in Linux" New topic
Author

PATH and CLASSPATH settings in Linux

Gangireddy Danam
Ranch Hand

Joined: Aug 08, 2012
Posts: 32

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
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

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

Joined: Aug 08, 2012
Posts: 32

I had not installed JDK in OS . I simply placed JRE folder in /usr directory...
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

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.


Steve
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

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

Joined: Aug 08, 2012
Posts: 32


@Steve Luke
ThankYou Sir..It's working fine..
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
Gangireddy Danam,
Your post was moved to a new topic.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PATH and CLASSPATH settings in Linux