Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Classpath - help!

 
Gregory Garrison
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getting ready to submit the project but don't know how to handle the classpath issue for someone executing the app in an arbitrary directory. Can someone give me some suggestions? Really appreciate it!
 
Enrico Mannarino
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't you tell the user to set the classpath before typing the java... command?
Enrico Mannarino
 
Gregory Garrison
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanted to automate the process via a script or batch file. I was able to do this: java -classpath ../. since the script file is executed from the directory for - say - the engine or the client. Thanks anyway. Your reply is much appreciated.
 
Enrico Mannarino
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I planned to do that as well, but drop the idea because you can't ask the tester to edit any file.
 
HenkGijsbert
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about stuffin al your server classes in a server.jar and all your client classes in a client.jar and execution the .jar with java -jar.
You don't need to change a classpath then and the user can execute the .jar in any directory.
regards,
Henk
 
Gregory Garrison
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enrico - there is no need to edit the script file here. Just execute it. -classpath ../../:. designates the current directory and the parent directories, eg. somedirectory/suncertify/engine. So when starting - say - the engine the necessary paths are set for the classpath for somedirectory and the current directory. However, your packages must be something like this, suncertify.engine, suncertify.client, suncertify.db.
HenkGijsbert - as far as executable jars, I haven't done one of these yet and just want to finish this @#% application and get it over with. I will experiment with executables down the road.
Thanks for the reply's guy's.
 
Todd Harney
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for an executable jar file, you just create a manifest file with a Main-Class: entry and then add the manifest as one of your parms for making the server and client jar files...it really is worth the effort (imho).
see Making Executable JAR File
Hope that helps,
Todd Harney
 
Gregory Garrison
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link. I'll try it out but not for this application. I'm ready to upload and don't want to deal with it. I provided a script file with the appropriate relative classpath which does the job anywhere.
Thanks.
[ January 25, 2002: Message edited by: Gregory Garrison ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg, is your script file a batch file for windows or a shell script for Unix, and how do you know the assessor has that OS?
I had had a .bat file that I was going to upload, but realized this, and didn't want to take the chance. To create a .bat or script file to make the executable jar is easy.
this was my batch file to create the jars


Here is the manifest file I created for the server

you can figure out the client manifest file is only difference by what is the package.class for the clients Main class.
Hope that helps
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic