• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading Manifest File

 
Joel Boeder
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to read a version number from a Manifest file stored in a JAR file named common.jar. This code clip works:
URL url = new URL("jar:file:/D:/mypath/common.jar!/");
JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
Manifest manifest = jarConnection.getManifest();
String version = manifest.getMainAttributes().getValue("Version-Num);
The problem is that I can only use absolute file paths (d:\mypath\common.jar) to get to the JAR file which will not work when the JAR file is moved around (its running under a servlet on websphere). How do I get the code to use a relative path keeping in mind that the calling class is also located in common.jar?
Alternatively what is the working directory and is even available when running under a servlet (I apologize for asking this in the IO section but it was a toss up on whether this was an IO question or a servlet question)?
Thanks in advance for an answer!
Joel
 
Joe Ess
Bartender
Posts: 9313
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this conversation would help?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic