• Post Reply Bookmark Topic Watch Topic
  • New Topic

javac: command not found  RSS feed

 
frank davis
Ranch Hand
Posts: 1479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a Linux newbie and have paid for a web host that uses Linux. I've used Linux before and got web sites working with PHP by only knowing a few basic Linux commands. But now I can't even get "javac" to work. I go to the bin directory and type ls and can see "javac", yet when I type it while within that directory it still says command not found. How can it not find the command when its in the same current directory?? No matter what directory I go to WEB-INF/classes, etc it still can't understand either java or javac
[ September 15, 2004: Message edited by: herb slocomb ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Herb,

Your PATH environment variable has to include the directory where "java" and "javac" are. Say "echo $PATH" to see what it is. You can edit your ~/.bashrc or ~/.bash_profile file (whichever one already exists) to add anything that's missing, then logout/login.

Things in the current directory are only found if "." is in the PATH (like CLASSPATH!) but having "." in the path is considered a security risk these days.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Linux / UNIX forum...
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:
Your PATH environment variable has to include the directory where "java" and "javac" are. Say "echo $PATH" to see what it is. You can edit your ~/.bashrc or ~/.bash_profile file (whichever one already exists) to add anything that's missing, then logout/login.


I got valuable knowledge from this thread... I've been using JDK 1.2 as a default and I didn't know the way to change my default JDK to JDK 1.3, which is in /usr/j2se/bin.... I added that path in my .profile and logout/login...

Bravo!!! java -version now shows JDK 1.3 info... Thanks for the tips, Dr.Ernest...
 
frank davis
Ranch Hand
Posts: 1479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ko Ko Naing:


Bravo!!! java -version now shows JDK 1.3 info... Thanks for the tips, Dr.Ernest...


Many thanks. There was an option to change the version of java on the control panel and when that was done it seemed to kick off a number of scripts that ran to update/change Path and ClassPath. Now the java command seems to work in any directory...
[ September 15, 2004: Message edited by: herb slocomb ]
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wonderful, but please choose a specific topic next time.
Nearly everybody needs help in the linux-section.

javac: command not found
would have been much better.

I'm not sure if it is possible to change it now.
Try it!
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by herb slocomb:


Many thanks. There was an option to change the version of java on the control panel and when that was done it seemed to kick off a number of scripts that ran to update/change Path and ClassPath. Now the java command seems to work in any directory...

[ September 15, 2004: Message edited by: herb slocomb ]


Well, I'm not actually using Linux... I'm using AIX Vesion Unix of IBM... So there is no such control panel available as UI...
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!