Hi Marcia,

Here's what I think you will need to do to get your 
Java working again.  I am assuming that when you login
to Linux, you do so as a regular user, NOT AS root.

In order for Java to run, you need to set up a minimum
of two environment variables so that it can find the 
files it needs to run.  These two environment variables
are named PATH and CLASSPATH.  You can set them up in
one of two ways: 1) temporarily, good for the life of 
the shell you are running in; or 2) as permanent 
environment variables, available to every shell you 
open.  I use method 2...

You can use the following command to view your current
environment variable settings (the "[obiwan@localhost]$"
represents my shell prompt; yours should look similar...):

   [obiwan@localhost]$ export
 
To set things up so that each new shell is using the 
same global environment variable settings, perform 
the following steps.  I will mark any comment lines 
here using a '#' in the first column.

# ASSUMPTIONS I AM MAKING:
# ------------------------
# I am assuming you know the directory where you installed
# the JDK.  I installed mine into:  /usr/local/j2sdk1.3
# This is normally referred to as JAVA_HOME, and we will 
# indeed set up just such an environment variable, as well
# as PATH and CLASSPATH.
#
# I am assuming that you know that the system will expand
# out the name of an environment variable whenever it sees
# a '$' at the beginning of an environment variable name.  
# This is why you say: 'cd $HOME'  to change the current 
# directory to your home directory.
#
# I am assuming you will REMOVE any previous edits you made
# to the /etc/profile, so they don't conflict with the things
# I suggest that you do.
#

Step 1.  You need to edit the file that sets the environment
variables in your shell of choice.  I use the default "bash"
shell, so the file I edited is named: $HOME/.bashrc
Type in the following command to open this file in the editor:

   [obiwan@localhost]$ gedit $HOME/.bashrc

Inside the editor you will most likely see something similar to:

   # .bashrc

   # Source global definitions
   if [ -r /etc/bashrc ]; then
      . /etc/bashrc
   fi
   #

Step 2.  Go to the last line of the file, and type in the following
two lines to set up a new environment variable that represents where you
installed Java:

   # Set up the Java Development Environment Variables
   export JAVA_HOME=/usr/local/j2sdk1.3
   
#
# The "export" command will make this variable visible in all shells
#

Step 3.  Next, type in the following two lines to modify your existing
PATH variable to work with Java:

   #
   export PATH=$JAVA_HOME/bin:$PATH

Step 4.  Create a CLASSPATH variable, so that Java will know where to
search for class files.  Type in the following two lines:

   #
   export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
   
Step 5.  Save the file, and exit the editor.  The file should look 
*similar* to the one shown below:

# .bashrc

# Source global definitions
if [ -r /etc/bashrc ]; then
        . /etc/bashrc
fi
#
###################################################
# Set up the Java Development Environment Variables
###################################################
#
export JAVA_HOME=/usr/local/j2sdk1.3
#
export PATH=$JAVA_HOME/bin:$PATH
#
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
#
# end setup for Java Development Environment Variables
######################################################


Step 6.  To "export" the new variables into the environment (without 
rebooting), type in the following command at a shell prompt:

   [obiwan@localhost]$ source .bashrc
   
Now you should be ready to Rock 'n Roll.  Try running anything Java!
Later on, you can add new directories or jar files to the CLASSPATH 
variable following this same technique...

The next time you log in as that same user, you will instantly have
those same environment variables available to your shell(s)!

Good luck - if you have any questions, you know where to find me.

Mike


--- Anguo <[EMAIL PROTECTED]> wrote:
> 
> Marcia,
> 
> Try one more thing and if it doesn't work, we'll have to ask more
> advanced 
> people for help. 
> In the console, type 'which java'.
> -----
> $ which java
> /usr/local/j2re1.3.0/bin/java
> -----
> 
> > Thanks for the instructions. I went into the file as root and did what
> you
> > described
> 
> Exactly?
> Can you confirm that you did change the path to fit yours?
> According to the which java command above, my path is:
> PATH=/usr/local/j2re1.3.0/bin:$PATH
> Did you set up yours according to your path (which would be different
> since 
> you have another version of java). 
> 
> 
> > except I did not know exactly where my entry should go. I put it
> > under the other Path entry. 
> 
> Yes, this question got me puzzled too. I believe anywhere is fine, on a 
> separate line.
> I put my command more towards the top <g>.
> 
> > It is there now, but nothing has changed yet. I
> > am perplexed that this does not work now after working before. Thanks
> for
> > the help.
> 
> I am a newbie like you. I found the information I needed by reading docs
> in 
> the blackdown site, especially the following faq:
>
http://www.blackdown.org/java-linux/docs/support/faq-release/FAQ-java-linux.html
> 
> i downloaded the j2re1.3.0 version for the following reason (as I said,
> I 
> played it safe, not knowing what I was dealing with, and it works for me
> on 
> konqueror):
> ---------
> May 04 2001
> JavaWorld has selected our Blackdown 1.3 JVM for Linux as a finalist in
> the 
> Best Java Virtual Machine category of its  Editors' Choice Awards. 
> --------
> I then downloaded : j2re-1.3.0-FCS-linux-i386.tar.bz2 from one of their 
> mirror sites. http://www.blackdown.org/java-linux/mirrors.html
> 
> 
> 
> 
> If that doesn't help either, we'll have to ask other people. 
> Please do ask again, providing as much information you can (even
> irrelevant, 
> it doesn't hurt <grin>)
> what is the cpu?
> which file did you download/install?
> from where?
> what is the version of your kernel? 
> Type the following in the console:
>       java -version
> 
> 
> blessings and best of luck,
> 
> Anguo
> 
> 
> 
> 在 2001 七月 12 星期四 05:38,Marcia Waller 寫道:
> > > How did you configure it?
> > > I first tried to use the GUI Konqueror configuration tool, where you
> can
> > > put in the path to your java file, but it didn't work for me.
> > >
> > > I then did it manually, using the console and it worked.
> > >
> > > 1- open a console
> > > 2- su  to root
> > > 3- cd to /etc/
> > >       in it you have a file named 'profile'. that's where you have
> to add
> > > the path to java.
> > > 4- here a very basic knowledge of vi is very handy.
> > > vi profile
> > > type 'a' to insert the following line (modify it according to your
> path
> > > and version)
> > > PATH=/usr/local/j2re1.3.0/bin:$PATH
> > > type esc to go back to command mode.
> > > type ':x' to save and exit.
> > > 5- you can type 'cat profile' to check that it's ok.
> > > restart xwindows.
> > > the above worked for me.
> >
> > Dear Anguo,
> >
> > Thanks for the instructions. I went into the file as root and did what
> you
> > described
> > except I did not know exactly where my entry should go. I put it
> > under the other Path entry. It is there now, but nothing has changed
> yet. I
> > am perplexed that this does not work now after working before. Thanks
> for
> > the help.
> >
> > Sincerely,
> > Marcia
> 


=====
May the Force be with you.

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to