Click to See Complete Forum and Search --> : PATH questions...


fleemos
05-04-2003, 12:46 AM
Well I recently made the jump to linux from windows and am running RH 8. I have come up on a problem that I can't seem to find any info on and need some help. When compliling java programs in windows it will look for packages in the current directory and directories below the current one if . is included in the environment variable PATH. How do I get this same behavior in Linux? I am testing a package and it won't find any of the classes imported from the package. Thanks in advance.

jetblackz
05-04-2003, 01:56 AM
If you're talking about CLASSPATH, it's an old issue. You could

su
vi /etc/profile

Add something to the PATH, but if you have an old java & javac lying around in /bin, rm it. ln -s the new ones to them.

If you're talking about compiling java's, the class files must be in the same directory as the main class.

fleemos
05-04-2003, 02:26 PM
Sorry for the confusion but I was speaking of compiling. If the class files need to be in the same directory as the main class then it doesn't follow suns rules of having packages in a folder of the package name. How do I set the classpath so that the current directory is always included(like the . in windows)?

Suramya
05-04-2003, 02:50 PM
To add . to the path open ~/.bash_profile (~ means your home directory) in your favorite text editor and append :. to the end of the path and then export it. Your path should look something like the following:


PATH=$PATH:$HOME/bin:/sbin:/usr/local/sbin:/usr/sbin:.
export PATH



This adds the current directory to the system path. I am not sure but doesn't Java use a variable called classpath to find the classes?

If thats true change PATH in the above example to classpath. and then export it. That should fix the problem.

Remember you have to logout and log back in for the changes to take effect.

Hope that helps.

- Sur

jetblackz
05-04-2003, 07:54 PM
I think you should ask this at

http://forum.java.sun.com/

Try

javac -classpath "./path/to/packages" myProggie.java

fleemos
05-04-2003, 08:22 PM
Thanks for all the help. The . in the path fixed it. Thanks again.

lugoteehalt
05-06-2003, 05:51 AM
Am I right in thinking that your computer is now very insecure? Isn't it - putting . in the path - not allowed above a certain level of security?