• Post Reply Bookmark Topic Watch Topic
  • New Topic

relative Path  RSS feed

 
Neha Kathuriaa
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to give path of a file .Actually my digest.xml file is at src level.and when i run the code it gives me null pointer exception .because of this path.How should I give the path.

 
Matteo Di Furia
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should have digest.xml in your classpath, not in source folder. If you use Eclipse, it should automatically copy it from src to build path, and at execution time it will be available in classpath.
Make sure to have digest.xml in your classpath, then reference it with just "digest.xml" withouth paths. A better solution would be have it in a folder specific to hold this kind of files, for example "/resources/xml/digest.xml" and make sure you have the folder "/resources" in your classpath, then you reference the file with "/resources/xml/digest.xml".
 
rakesh sugirtharaj
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Understand that for a java program to run, you dont need java files. Class files suffice. Keeping this in mind can solve problems like this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!