Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how XML files passing to main class...

 
vinaykumar singh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all...

i m using eclipse.i want to pass xml files(more than 3)as a main method argument. how it is done.

please help me ....
thanks
vinay kumar singh
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can pass the paths to the three files as command line arguments, read them in your main method then load the XML files. e.g.:


(Please note the above code is deliberately simplistic - you'll have to write the Handler, and think about what you do with regards to Exception handling and validation)
[ January 30, 2006: Message edited by: Paul Sturrock ]
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To actually run Paul's example from the command line, you would type

I don't know how Eclipse handles command-line arguments. You should search through the project options to see if you can figure out how to set them. If you don't find anything, ask your question in the IDE forum.

Layne

p.s. You might also want to modify Paul's example to take any number of command-line arguments. This way the user can specify 1 or 500, if they wish. Of course, this depends on whether or not this type of usage is meaningful for your program.
[ January 30, 2006: Message edited by: Layne Lund ]
 
Raveendra Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the run window, there is Arguments tab. Here you can type whatever arguments you want to send to your program.
Hope this works out for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic