CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Posts
    161

    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

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    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

  3. #3
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    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.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  4. #4
    Join Date
    Jan 2010
    Posts
    161

    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
  •  





Click Here to Expand Forum to Full Width

Featured