[hcflinux] java in linux Redhat 8.0

Stuart Longland stuartl at longlandclan.hopto.org
Wed Apr 9 14:27:53 EDT 2003


Hi,
  Comments inline.

Quoting stc USA <stcusa at yahoo.com>:

> Hi, 
> I installed j2sdk-1_4_1-linux-ia64.bin in my RedHat
> 8.0 but still I could not run my java programs, it
> says for example :
> 
> root> javac prgname
> root> bash: there is no such a command

Actually, I don't think this is the correct mailing list to be posting your
message.  I'll answer your question as best I can, but just to let you know -
this isn't the place AFAIK.

> what I did is I followed these instructions:
> --------------------------------------------------
> Installation of Self-Extracting Binary
> Use these instructions if you want to use the
> self-extracting binary file to install the Java 2 SDK.
> If you want to install RPM packages instead, see
> Installation of RPM File. 

I noticed the file you downloaded had ia64 in the filename.  This means it's for
the Intel 64-bit processor architecture.  If you've got a Intel IA32 processor
(aka.  anything from the 386 up to the Pentium 4 - this includes AMD and
Via/Cyrix/IBM chips as well) this version will not work - at best you'll get the
following message:

# java
bash: java: Cannot execute binary file.

# _

Also, you're running Red Hat 8.0.  Did you get the RPM version?  If not, try the
following instructions.

1. Go to the page http://java.sun.com/j2se/1.4.1/download.html and select
Download from the SDK column where it says "Linux RPM in self-extracting file"

Download J2SE(TM) v 1.4.1_02                    JRE       SDK
----------------------------------------------------------------
Windows (U.S. English only)                   DOWNLOAD    N/A
Windows (all languages, including English)    DOWNLOAD  DOWNLOAD
Linux RPM in self-extracting file             DOWNLOAD  DOWNLOAD <--
                                                        ^^^^^^^^ 
...
...

2. Select Download where it says "Fill out the optional information below or
proceed with download.", then accept the licence agreement that appears.

3. When you've got the file, it'll be a .bin file.  Make this executable then
run it:

# chmod 755 <FILE.bin>
# ./<FILE.bin>

It will display a licence agreement, when you agree to this, it will extract an
RPM package.

4. Install the RPM.

# rpm -ivh <FILE.rpm>

And that should be it.  You may have to manipulate the PATH and CLASSPATH
variables if it can't find the 'java' binary or if you're having problems
building stuff.  If it does give you grief here, try finding out where it has
put the 'java' binary and append the directory to your PATH.  To do this:

1. First, have a look in the file listing for the j2sdk package for the pattern
bin/java.  This can be done with grep.

# rpm -ql j2sdk | grep bin/java

You'll see about 8 matches.  
...
...
/usr/java/j2sdk1.4.1_02/bin/java
...
...
2. Therefore, all the binaries for the J2SDK reside in
/usr/java/j2sdk1.4.1_02/bin.  We append this to PATH.

# export PATH="$PATH:/usr/java/j2sdk1.4.1_02/bin"

3. Now to set CLASSPATH.  Create the directory /usr/java/classes, for your java
classes then set CLASSPATH to include this directory:

# mkdir /usr/java/classes
# export CLASSPATH="$CLASSPATH:/usr/java/classes:."

Now try the 'java' command.  It should hopefully work ;-)
If it does, you might want to edit /etc/profile and add the following lines to
the very end of it so you don't have to keep entering them each time you want Java:

export PATH="$PATH:/usr/java/j2sdk1.4.1_02/bin"
export CLASSPATH="$CLASSPATH:/usr/java/classes:."

Hope this helps.

+-------------------------------------------------------------+
| Stuart Longland           stuartl at longlandclan.hopto.org |
| Brisbane Mesh Node: 719             http://stuartl.cjb.net/ |
| I haven't lost my mind - it's backed up on a tape somewhere |
| Griffith Student No:           Course: Bachelor/IT (Nathan) |
+-------------------------------------------------------------+

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/



More information about the hcflinux mailing list