----------------------------- Please read the FAQ! <http://java.apache.org/faq/> ----------------------------- Hello everyone, I have two questions. First off, has anyone had success writing a .jar file from within Java code that works correctly (i.e. you can include it in your classpath and execute a file inside it)? I wrote the following code: http://www.dougandmary.com/jar_code.html It builds what appears to be a perfectly good .jar file with relative paths, etc. But when I try to run it with something like java -cp path_to_jar_file com.time4.ClassName it doesn't work (Class not found in main). I've verified all the obvious, such as that com.time4.ClassName is the relative path that the file is in, etc, etc. I've actually extracted the class files back out of the .jar file and run them and everything was fine. The reason I needed this in the first place is that I'm creating a tool to automate our build process (in Java), and the jar utility is missing the ability to specify which directory you want things to be relative from. IOW if your current directory is D:\projects\someproject\lib and inside lib is com\time4\SomeClass.class if you run jar using something like jar cvf0 D:\deploy\myproject.jar . // note the period then everything works great and the paths in the .jar file are relative as you would expect. But if, for instance, D:\ is your current directory, and you type something like jar cvf0 D:\deploy\myproject.jar D:\projects\someproject\lib\. then all the paths inside the .jar file are based on D:\projects\someproject\lib I could just Runtime.exec() jar from within my Java app, but I can't seem to figure out a way to set the current directory (that jar would use) from within a Java app. Sure I could set the current directory before running the Java app, but that would make it less flexible. What I'm hoping is that someone else out there has had the same problem and has created a better jar tool with the ability to specify how to make paths relative without having to be in that directory. Or I'm hoping that someone has written .jar files that work from Java code and can tell me what I'm doing wrong. Or I'm hoping that I'm missing something stupid with jar and someone can point that out to me. I know this isn't exactly java-apache related, but this is such a responsive group that I figured it was my best shot. If you know of other mailing lists where I might have luck with this question, please enlighten me. Thanks, Doug ------------------------------------------------------------ Doug Ahmann Time4.com (651) 762-1226 x203 -- -------------------------------------------------------------- Please read the FAQ! <http://java.apache.org/faq/> To subscribe: [EMAIL PROTECTED] To unsubscribe: [EMAIL PROTECTED] Archives and Other: <http://java.apache.org/main/mail.html> Problems?: [EMAIL PROTECTED]