File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ECLIPSE - Program Arguments - Trying to pass file names to MAIN

 
bob connolly
Ranch Hand
Posts: 204
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, i'm trying to pass 3 file references into a pgm via the main function in Eclipse and i'm using the run/program arguments text box, but it's not really clear how to enter in those particular references!

I tried various combinations,
ex1: <theinstrumentfile.xml> <the marginfile.xml> <the unixfile.txt>

ex2: "theinstrumentfile.xml", "the marginfile.xml", "unixfile.txt"

ex3: new RangeComparator("theinstrumentfile.xml", "themarginfile.xml", "theunixfile.txt");

In ex3, i hardcoded the file names into the function call itself!

Also, I put the actual file names and data in the project directory under those above names and the error i'm getting is:

theinstrumentfile.xml (The system cannot find the file specified) Nested exception: theinstrumentfile.xml (The system cannot find the file specified)

The first 2 files will be used by the XML SAX class and when that data is loaded, it will be applied against the unixfile.txt data!

Thanks for any clues on this !

BC
 
Bill Dudney
Author
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bob,

If you think of the 'program arguments' box as a piece of the command line then you will be OK. For example

java -cp $MYCP foo.bar.MyProgram theinstrumentfile.xml themarginfile.xml unixfile.txt

might be a command line that you'd use to invoke your program in the Eclipse Run Profile manager you'd place

theinstrumentfile.xml themarginfile.xml unixfile.txt

in the 'Program arguments' text field in the 'Agruments' tab in the Run Profile editor modal dialog.

If these files are in the root directory of the project you should be able to just use


Hope this helps!
 
bob connolly
Ranch Hand
Posts: 204
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot Bill, got it working thanks to your help!

Just specified the file names by themselves and then selected the local directory box and it went through!

Also Bill, if you've had the opportunity to try them out, do you prefer any particular IDE over the other, ie JDeveloper, NetBeans or Eclipse ect?

Thanks again Bill and have a wonderful day!
 
Bill Dudney
Author
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bob,

Well I have not used JBuilder since 2.0 way back when it first went 'all java' so I'm no expert on it. NetBeans looks really cool and it has J2EE stuff built in (JSP, XML etc) so it has lots going for it as well. When I was at InLine Software we integrated with both of these IDE's as well as Visual Cafe. If you've not looked Idea's IntelliJ is also very good, I've been using that for my 'day job' recently and I really like it as well.

Since I wrote a book about Eclipse I'm probably supposed to say you should use that but it all boils down to what you are most productive with so I'd suggest you try each for a week then go with the best feeling one.

Good Luck!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic