Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stupid classpath question

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have done fbn_srv.jar and fbn_cli.jar. They work ok if I run them from the same directory:
java -jar fbn_srv.jar db.db 1099
I have tried to get this work from any directory. I have tried this:
java -classpath c:\ -jar fbn_srv.jar db.db 1099
but I get ZipException (= cannot find the jar file).
Should I edit the operating system's classpath or is it more reasonable to use only -classpath option? I think the latter would be nicer but how to do it?
Any help appreciated. Thank you.
Jukka
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

java -classpath c:\ -jar fbn_srv.jar db.db 1099

The "-classpath" option is ignored when you use a "-jar" option.
Eugene.
[ November 11, 2002: Message edited by: Eugene Kononov ]
 
Trish Wu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it is not a bad idea to specify classpath and main class in the Manifest file.
Sun tutorial Jar
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your answers.
I had specified the Main classes in Manifest.mf. Now I tried defining class paths in the jar file that contains server and client jar file. It worked in my computer with Win2000 but not in test computer with only JRE in Win NT.
Is that enough if I give just two command lines that the user should use?
>java -classpath /mypath/fbn_srv.jar suncertify.rmi.RMIServer /mypath/db.db 1099
>java -classpath /mypath/fbn_cli.jar suncertify.flybynight.Main ip 1099
OR another way
>java -jar /mypath/fbn_srv.jar /mypath/db.db 1099
>java -jar /mypath/fbn_cli.jar ip 1099
These should work from any directory.
Jukka
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic