• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Program/XML

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic