Solved

Which java

Posted on 2004-07-30
4
199 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 Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

708 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

17 Experts available now in Live!

Get 1:1 Help Now