wood burning stoves*
The moose likes Beginning Java and the fly likes Dependecies in JAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Dependecies in JAR file" Watch "Dependecies in JAR file" New topic
Author

Dependecies in JAR file

Konstantinos Vasileiou
Greenhorn

Joined: Jul 20, 2009
Posts: 16
I try to build my application as a JAR file. The problem is that as I read XML files, the program uses the relevant DTD files from the local folder when executed from within Eclipse, but searches for the DTD in home\user\ when executed as a JAR from anywhere else.
Can I somehow change that, to have the DTDs just in the same folder with the JAR, no matter from where I run the program?

Thank you in advance
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18498
    
  40

I guess one option would be to -- get the classpath, find the jar file, and extract the location of the file. Not simple, but doable.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dependecies in JAR file
 
Similar Threads
Accessing text files outside eclipse
need help
Cannot run .jar file
.jar file
Jar file accessing folder