JAVA under UNIX
843798Jul 30 2001 — edited Jul 31 2001Hi
I have some problem executing class file under UNIX.
I have a directory under UNIX,
/home/user1
wherein I have placed a class file say "JavaProg.class"
I execute "java JavaProg" from the above directory
and it generates the desired output.
Now, I have another directory,
/home/user2
wherein I again I have placed the same class file "JavaProg.class"
I execute "java JavaProg" from this second directory
this time and it again generates the desired output.
Problem starts now,
I delete the class file from /home/user2
1. And then I execute the following command trying to
directly execute class file which is available from user1's directory (since user2 class file is deleted)
"java /home/user1/JavaProg" from "/home/user2"
directory. (since I am executing user1's class file
from user2 directory)
On this it says "Can't find the class file".
So I try various other options like.
2. First I set the CLASSPATH as
set $CLASSPATH=.:/home/user1:/opt/java/lib:$CLASSPATH
export CLASSPATH
And I try the following command
"java JavaProg" (This time I dont' write the complete
absolute path since its already defined in the CLASSPATH) I get an error. So I still try the following,
3.
"java /home/user1/JavaProg"
ERROR
4. "java -classpath .:home/user1 JavaProg
ERROr
5. "java -classpath .:home/user1 home/user1/JavaProg
ERROr
6. "java -cp .:home/user1 JavaProg
ERROr
7. "java -cp .:home/user1 home/user1/JavaProg
ERROr
What might be the source of the error. Can anyone
help. Thanks in advance for the help.
Thank,s
JAtin