Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Which java

Posted on 2004-07-30
4
Medium Priority
?
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 252 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 248 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

722 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