Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Java Program/XML  RSS feed

 
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.
 
Java Cowboy
Sheriff
Posts: 16084
88
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
Boost this thread!