|
-
January 15th, 2012, 09:52 AM
#1
How to make call to a package location in a code
Hi there
I have a lucene package which indexes files using the following command
java org.apache.lucene.demo.IndexFiles
Now I can use this on the command line but I would like to make some java code that automatically interacts with this code .
That line accepts two parameters in the following way:
java org.apache.lucene.demo.IndexFiles -docs "path where your corpus resides" -index "path
where you want the created index files to be saved"
How can I make some code in java so that I call that line and pass it the following parameters :
-docs accepts the path where I have the file with my data, do I have necessarily have to pass it the path or can I also load the data I want to process in a variable and pass that variable as a file to the indexFiles class?
If not, how can I run that class using java code ?
Thank you
-
January 15th, 2012, 05:56 PM
#2
Re: How to make call to a package location in a code
Look at the Desktop and Runtime classes. You can call OS commands with methods in those classes.
Norm
-
January 16th, 2012, 04:20 PM
#3
Re: How to make call to a package location in a code
Also google for using ProcessBuilder, there are loads of examples on how to use it.
There are also a few gotchas on using Process objects (as created by ProcessBuilder and Runtime.exec()) so I'd recommend you also read this article.
-
January 16th, 2012, 07:03 PM
#4
Re: How to make call to a package location in a code
thank you guys,
I didnt know what to look for but those terms what you suggested have given me some good help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|