aspose file tools*
The moose likes Beginning Java and the fly likes Java Program/XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Program/XML" Watch "Java Program/XML" New topic
Author

Java Program/XML

Ralph Thompson
Greenhorn

Joined: Dec 15, 2009
Posts: 1
Hello all,

I'm trying to create a java program that completes a DOS command which include an XML file. I am able to get it to execute the dos command fine, but I'm having some trouble with the XML file. The DOS command uses the netsh included in vista/win7. For the command to execute correctly, you have to specify the path of the XML file. I don't want the program to have to be distributed with the XML file. So..

I need some direction on how to either:

1. Have the code create the XML file every time it runs

Or

2. Have it extract the XML file from the jar every time it runs.

Concerning #1: I already have the XML file, so I don't need Java to create the code and then the file. Only generate the file from code I can already provide.

Concerning #2: I know there is a dos command to extract a file from a jar, but I was wondering if there is an java code to do this instead.

Also, I'm using Netbeans.

Thanks.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14156
    
  19

Welcome to JavaRanch.

So, you have that XML file inside a JAR, and you need to write it to the file system as a separate file? Java has an API for working with JAR files, have a look at the documentation of the package java.util.jar.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
 
subject: Java Program/XML