Solved

Which java

Posted on 2004-07-30
4
207 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

770 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