Page 1 of 2 12 LastLast
Results 1 to 20 of 32
  1. #1
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    150
    Rep Power
    7

    Default [SOLVED] How to Run an .exe using java

    Hi Folks

    i am using omnipage OCR engine(which is used for OpticalCharacterRecogniazation)
    I want to Run its .exe using java but the conditions are

    1)It should run from command prompt only
    2)The GUI should not popup when i use my code.

    the input should be given through my command promptonly.
    like
    java OCRPROCESS 1.tif,2.tif...soon..




    any help?

  2. #2
    sanjeevtarar's Avatar
    sanjeevtarar is offline Senior Member
    Join Date
    Apr 2008
    Location
    Jaipur(India)
    Posts
    318
    Rep Power
    7

    Default

    Hello,

    Simply use

    Process process = Runtime.getRuntime().exec("notepad.exe");



    Sanjeev

  3. #3
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    150
    Rep Power
    7

    Default

    i know that how to run normal .exe using Runtime class.

    Here is my actual requirement...

    the input files will be places in one folder(normally .tif images)..i will give those to OCREngine(Omnipage)..it will processes and gives me the output in .txt or .csv fomat

    Instead of maula processing (taking .tif image and giving it to OCR) my java code has to do this..but the main condition is nowhere i want to found the GUI of Omnipage.

  4. #4
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    Can the OCR Engine actually take parameters in the first place?
    Did this post help you? Please me! :cool:

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by sanjeevtarar View Post
    Hello,

    Simply use

    Process process = Runtime.getRuntime().exec("notepad.exe");



    Sanjeev
    Sanjeev, this is only for Windows and Linux, not for Mac OS ;)

  6. #6
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    Well, Process has a disadvantage when it comes to passing some parameters on .exe programs and also capturing .exe's output while invoking it....

    Try this alternative,

    javax.tools.

    regards,
    sukatoa

  7. #7
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    If the OCR Engine isn't actually designed to take parameters then I dont think you will be able to do this Jazz.
    Did this post help you? Please me! :cool:

  8. #8
    sanjeevtarar's Avatar
    sanjeevtarar is offline Senior Member
    Join Date
    Apr 2008
    Location
    Jaipur(India)
    Posts
    318
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Sanjeev, this is only for Windows and Linux, not for Mac OS ;)
    Thanks Eranga for correcting me.

    sanjeev

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by jazz2k8 View Post
    but the main condition is nowhere i want to found the GUI of Omnipage.
    I'm not clear what you say here pal. Which GUI you talking about?

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by sanjeevtarar View Post


    Thanks Eranga for correcting me.

    sanjeev
    No prob pal. ;) I've test that few years back on Mac and failed :D

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by DonCash View Post
    If the OCR Engine isn't actually designed to take parameters then I dont think you will be able to do this Jazz.
    Hey Don,

    All of you talking about character recognition engine, right? If not please correct me. :)

  12. #12
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    Yeah as Jazz said in the first post, he is talking about the Optical Character Recogniazation engine.

    I don't know anything about this but we should wait for him to reply before we go any further.

    Like I say, if this program cant actually take parameters then he won't be able to do what he wants.

    It sounds to me as if everything is set in the OCR GUI. Not the command line..
    Did this post help you? Please me! :cool:

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by DonCash View Post
    It sounds to me as if everything is set in the OCR GUI. Not the command line..
    May be, he's talking about a GUI their. We have to wait for his response.

  14. #14
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    150
    Rep Power
    7

    Thumbs up

    Sorry for the dalay...

    My Requirement is:

    All the .tif are stored in a sharepoint when the client clicks it then our OCR engine invokes and start ocring.for this i need to write a java component.What i am thinking is if we go with .exe in our program it will be easy task for us.:confused:..???
    In genaral words..write a java component to watch one folder(file pollar type) ..pick up one tif image send it to ocr ..process it ..give the result(.txt 0r .csv) to back to same folder bresides in sharepoint...
    Last edited by jazz2k8; 04-18-2008 at 12:33 PM.

  15. #15
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    It would be easy to locate the tif files in a directory and launch the .exe. BUT, if the OCR engine does not take parameters when launching the exe, then you will not be able to do this!
    Did this post help you? Please me! :cool:

  16. #16
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    150
    Rep Power
    7

    Default

    it will take files..because...in that folder watching job (workfolw) is there so we can go with that.

  17. #17
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    So when .tif files are placed into the workflow folder, the OCR automatically starts?
    Did this post help you? Please me! :cool:

  18. #18
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    150
    Rep Power
    7

    Default

    The tif s are stored in a sharepoint folder.we need to start ocr.exe through our program and also need to give the tif folder path.then the engine should picks the tifs one after another note that it should run background(Reason the client doesnot knows what is the ocr engine we are using) and gives the text files as output.

  19. #19
    JavaLovenJoe is offline Member
    Join Date
    Apr 2008
    Location
    USA
    Posts
    12
    Rep Power
    0

    Default

    I think you type System("cmd.exe");

  20. #20
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    150
    Rep Power
    7

    Default

    Can anyone tel me this what does this mean?/?

    cmd.exe???

    How to implement with my requirement..my .exe is omnipage.exe

    Thanks
    jazz

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •