• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Setting path on Linux.. compiling .java files

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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//
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic