This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hello, I need to parse an XML file that is in a JAR file. All i have is a path to the jar file, is there a way to access the xml file without unjaring the file? Let me know, Rob
Karthik Guru
Ranch Hand
Joined: Mar 06, 2001
Posts: 1209
posted
0
obviously The jar file needs to be in the classpath. Then it can be accessed through one helper methods like this one.. Class c = this.getClass(); URL fileURL = c.getClassLoader().getResource("filename"); check the documentation. HTH
Rob Bass
Ranch Hand
Joined: Aug 28, 2001
Posts: 67
posted
0
You are using this.class. I cannot use that. I am providing a service to read\parse xml files. All they will pass me is the location of the jar file. With just the location of the jar file can I access the xml file contained within
Mathew Kuruvilla
Ranch Hand
Joined: Nov 27, 2001
Posts: 135
posted
0
Try using the methods in Class java.util.zip.ZipFile. Also executing 'jar tf class12.jar' will send all the contents of the class12 to the standard output. Hope this helps. Mathew