• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting path on Linux.. compiling .java files  RSS feed

 
Raja Sagar Panamgipalli
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,
my java in RedHat 9.0 got installed in i.e..the bin is in

\usr\java\j2sdk1.4.2_02 ...

1) plz let me know how to set path like in Windows..we write a batch file so we can javac call from any partition i basically write a new batch file in edit mode say example a.bat which consists of the folowing:
set path=c:\jdk1.4.2_02\bin;%path%;
thenon whenever i enter dos mode i type c:\a [ENTER]

2)Now plz tell me does javac work or is there anyother way .bin is run.
Thanx a million//
 
Paul Tongyoo
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raja--
you should be able to use the EXPORT command to add your java home directory to your existing PATH environment variable. I'm not 100% sure if the syntax below is correct, but it should be close...

I put that in my .bashrc script in my home user directory and it was able to work. You could also define an alias in your shell script in place of java:

I'd say the EXPORT command is the way to go. Oh, btw-- if you're going to use RMI don't forget to delete (or rename) the rmic compiler that comes with the RH9 distribution!!! It won't compile your stubs correctly and I never knew it even existed -- which i found out after a week .
Hope the above works!
Regards,
Paul
[ November 07, 2003: Message edited by: Paul Tongyoo ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12156
256
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raja,
Paul left out a $ sign. Here are my commands for setting the environmental variables:

Setting JAVA_HOME can be useful for other tools/applications (e.g. ant, j2ee...). Then just refer to that variable in your PATH statement. As you can see, you need to prefix any environmental variable with a $ sign if you want to use the contents of it.
As Paul suggested, you could put this in your ~/.bashrc file. Another place could be in ~/.bash_profile.
I put the commands above in /etc/profile.d/java.sh - that way these variables are set up for everyone who logs onto my machine (you do need to be certain that this is desirable though - will everyone logging on want to have these variables configured?).
Again, I have moved this topic to the Linux forum. It does not really belong in the SCJD forum.
Regards, Andrew
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My script:
# contains machine specific environment variables
# should be source by /etc/profile
# set up java ralated environment
JAVA_HOME=/usr/local/share/j2sdk1.4.2_01
JAVA_LIB=/usr/local/share/java
# Extra libraries
DIRLIBS=$JAVA_LIB/*.jar
for i in ${DIRLIBS}
do
CLASSPATH="$i":$CLASSPATH
done
export JAVA_HOME JAVA_LIB CLASSPATH
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!