Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JAVA under UNIX

843798Jul 30 2001 — edited Jul 31 2001
Hi

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

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 28 2001
Added on Jul 30 2001
1 comment
58 views