On Thu, 12 Sep 2002, jOhN JoHn wrote:

> --- Debopam Ghoshal <[EMAIL PROTECTED]> wrote:
> > Hi All,
> > Can anyone please help me on how to run the JDK
> > (1.4.0) on linux. I have downloaded and installed the
> > jdk (a .bin file) by writing sh <filename> and the
> > prompt. However i do not know how to proceed next.
> > That is, how to bring the JDK files in the path and
> > also the lib files in the classpath. It would be of
> > immense help of someone pls gives me a detailed
> > description of how to compile and execute simple
> > "hello world" file in linux. I am using Red Hat Linux
> > 7.1.
> > 
> Hello,
> 
> Im no linux guru and its been awhile since I installed the JDK but it went
> something like this:
> I had to change the .bin file to an executable with 
> chmod +x filename
> then execute the file with 
> ./filename
> this extracted an .rpm which is intalled with
> rpm -i filename.rpm
> 
> I forget where the files were installed but if I needed to find them I
> would look for them with
> find -name java.exe -print
> then add that path to my PATH variable in ~/.bash_profile
> this would put 'javac' for compiling and 'java' for running on your path.
> 
> This may or may not be good advice but hopefully it helps.
> 
> ~John
> 

It sounds like the original poster downloaded the 'tar.gz' version, not 
the rpm version.

In that case, the sequence of events that lead up to a working 
installation of the jdk are these:

chmod +x j2sdk-1_4_0_01-linux-i586.bin
sh j2sdk-1_4_0_01-linux-i586.bin 
su
mv j2sdk1.4.0_01 /usr/local/  
cd /usr/local/
ln -s j2sdk1.4.0_01 java
echo "#!/bin/sh
> export JDK_HOME=/usr/local/java
> export JAVA_HOME=/usr/local/java
> PATH=$PATH:$JDK_HOME/bin" > /etc/profile.d/java.sh
exit

Then next time you login, you'll be able to run 'java' and 'javac' from 
the commandline anywhere on the system.


You can also add classpath stuff to /etc/profile.d/java.sh
But you normally don't need to do that unless you are using special 
packages. (The Sun Java ones will be found automatically)


Here's a simple helloword program:

$ set |grep PATH
PATH=/bin:/usr/bin:/usr/local/java/bin
$ set |grep CLASSPATH
$ l
total 12
drwxrwxr-x    2 meetsma  meetsma      4096 Sep 12 16:53 .
drwx-----x   39 meetsma  meetsma      4096 Sep 12 16:48 ..
-rw-rw-r--    1 meetsma  meetsma       108 Sep 12 16:53 Hello.java
$ cat Hello.java   
public class Hello{
  public static void main(String argv[]){
    System.out.println("Hello World");
  }
}

$ javac Hello.java 
$ l
total 16
drwxrwxr-x    2 meetsma  meetsma      4096 Sep 12 16:57 .
drwx-----x   39 meetsma  meetsma      4096 Sep 12 16:48 ..
-rw-rw-r--    1 meetsma  meetsma       415 Sep 12 16:57 Hello.class
-rw-rw-r--    1 meetsma  meetsma       108 Sep 12 16:53 Hello.java
$ java Hello 
Hello World
$ 


Hope this helps,

--
Arend



_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list

Reply via email to