Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Program/XML

 
Ralph Thompson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15288
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic