Solved

Which java

Posted on 2004-07-30
4
202 Views
Last Modified: 2013-12-06
Hi All,
            I am stuck to problem in Red hat(Linux 9), I installed Red Hat (Linux 9) server,  now the problem is  when i run 'javac' command it gives me error message
 gcj: no input files
and when I run command 'which java', it gives me the following path

/usr/bin/java

wheras I had installed j2sdk1.4.2_03 at /usr/local/ and edited /etc/profile file as follows
export JAVA_HOME=/usr/local/j2sdk1.4.2_03
export PATH=$PATH:$JAVA_HOME/bin

and when i run command 'source /etc/profile' nothing happens, it still takes /usr/bin/java path. I want to use the java which i installed at /usr/local/j2sdk1.4.2_03 , how can i do this?can anyone help me out? I will be thankful to you.

wishes
saharey
0
Comment
Question by:saharey
4 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 63 total points
ID: 11676244
/usr/bin is in PATH before /usr/local/j2sdk1.4.2_03/bin, so the copy of java there will be the one found. Change your PATH set up to be:

export PATH=$JAVA_HOME/bin:$PATH

and then executing java will find the new copy.
0
 
LVL 3

Assisted Solution

by:255x4
255x4 earned 62 total points
ID: 11680015
Or, you can delete the java at /usr/bin and then make a symlink to the new one.

su root
{login as root}
cd /usr/bin
rm java
ln -s /usr/local/j2sdk1.4.2_03/bin/java /usr/bin/java

This will link the /usr/bin/java to the correct location for java.  The only reason you would really want to do this is because some programs may want to point to /usr/bin/java instead of just finding out where java is on the machine.

Also, you will need to symlink your java plugin for netscape or whichever browser you are using.  Just do the same:

ln -s /usr/local/j2sdk1.4.2_03/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so {path to mozilla or other browsers plugin directory}/libjavaplugin_oji.so

This will allow your browser to use the plugin.  Note, the ns610-gcc32 will work for most netscape and mozilla browsers, but if you have a problem with one, use the ns610 directory instead.

255x4
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now