On Linux errors for javac and java commands
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sheetalkumar_Patil
Posted On:   Thursday, December 12, 2002 04:28 AM

1)I installed j2sdk1-4-1-01 on my LINUX O.S. PC in usr-local dir 2)I wrote sample application and try to compile and run it 3)I got following errors a) javac: command not gound some how , by providing total path of javac file i complied the code ( How to set default path , common for all programs?) b) Then I tried to execute the application by java coomand when i was in the folder where the class defined i got the error java : command not foound c)When i came out of folder and tried to execute i got the error "NoClassDefFoundError" Please guide to solve this problems thanks and regards Sheetalkumar    More>>

1)I installed j2sdk1-4-1-01 on my LINUX O.S. PC
in usr-local dir
2)I wrote sample application and try to compile and run it
3)I got following errors
a) javac: command not gound

some how , by providing total path of javac file i complied the code
( How to set default path , common for all programs?)
b) Then I tried to execute the application by java coomand
when i was in the folder where the class defined i got the error
java : command not foound
c)When i came out of folder and tried to execute i got the error
"NoClassDefFoundError"

Please guide to solve this problems
thanks and regards
Sheetalkumar

   <<Less

Re: On Linux errors for javac and java commands

Posted By:   Jeff_Hubbach  
Posted On:   Thursday, December 12, 2002 08:51 AM

You need to add the javac and java commands to your execution path. You can do this as follows:



PATH=$PATH:/usr/local/[java-directory]/bin

export PATH



You will also want to set a JAVA_HOME environment variable as follows:


JAVA_HOME=/usr/local/[java-directory]

export JAVA_HOME



If you want this in your path permanently (instead of having to run this for each shell you open), then you need to put it in your ~/.profile or ~/.bash_profile file, then logout and log back in.
About | Sitemap | Contact