Results 1 to 18 of 18
  1. #1
    hari's Avatar
    hari is offline Member
    Join Date
    Apr 2010
    Posts
    1
    Rep Power
    0

    Default is it possible to Close a widnow application with Java

    Hi,

    Is it possible to close opened Window applications (like IE browser) using Java application.

    How we can track and close.

    Thank you,
    Hari.

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

    Default

    Closing applications means killing the process from the system. It's quite difficult task in Java, with multiplatforms.

  3. #3
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    How is that possible Eranga? I'm curious of it
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  5. #5
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Quote Originally Posted by Fubarable View Post
    JNI could work.
    What does that mean?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

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

    Default

    Actually it's not possible. Say you open a URL in the browser with Java. But you cannot do anything with the browser, it's decide what to do with data passes by you into the browser. Simply Java has no control over that process.

    Read more about destroy() method on Process class on Java DOC for how to handle unspecified situations.

  7. #7
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    I got a little confused, though I get the sense already.
    By using the Process and ProcessBuilder, is it possible to store open processes displayed on the Windows Task Manager and manipulate the each process?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

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

    Default

    Okay then do this. Write a simple cord to open your browser. And execute it. After that do a slight modification to the code, added destroy() method as the last line of the code, and run your code again. What happen?

  9. #9
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    To analyze your statement, without coding it, the browser will just open and immediately close.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  10. #10
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  11. #11
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Sorry Fubarable, but I don't seem to connect your link with the thread.
    But I get the sense that JVM could use the "Windows Language " to do this thread. But analyzing it could be a troublesome for a developer.
    Just looking at the codes I have seen on the link(s) you've provided.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  12. #12
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    JNI is a way to link Java with native code, but I recommend you do a Google search on JNI and Java and the first two hits will tell all and far better than I can do.

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

    Default

    Quote Originally Posted by chyrl View Post
    To analyze your statement, without coding it, the browser will just open and immediately close.
    That's all, that what I want to clear up. Whatever the content you pass to the browser is not a matter of. Browser will handle of it. Say you open specifically a browser with a URL, can you close that tab only?

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

    Default

    Quote Originally Posted by chyrl View Post
    Sorry Fubarable, but I don't seem to connect your link with the thread.
    But I get the sense that JVM could use the "Windows Language " to do this thread. But analyzing it could be a troublesome for a developer.
    Just looking at the codes I have seen on the link(s) you've provided.
    In other words, as Fubarable explain in his last post, you can connect Java with native codes, such as C/C++. Using such languages you can easily handle those applications, MSWrod, IE and so on. JNI provide the communication channel for that.
    Last edited by Eranga; 04-15-2010 at 03:58 AM. Reason: added more

  15. #15
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Quote Originally Posted by Eranga View Post
    In other words, as Fubarable explain in his last post, you can connect Java with native codes, such as C/C++. Using such languages you can easily handle those applications, MSWrod, IE and so on. JNI provide the communication channel for that.
    Ohh, now I see. But the next question is? What language will do solve this thread?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

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

    Default

    In my experience directly only with Java it's not quite possible. C++ with Java is the most suitable, since I'm using those two for a long time :p

  17. #17
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Ok. I will then post a thread pertaining on how this is made after I have concluded my current thread and project.

    I am curious on how these became possible.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

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

    Default

    Yeah sure. Think about that how far it's possible to use destroy() in Process class. And also how to use JNI, with any native languages. How to connect them. And also how to handle those scenarios using a native language.

Similar Threads

  1. Replies: 13
    Last Post: 04-09-2010, 12:15 PM
  2. Replies: 3
    Last Post: 12-04-2009, 01:10 PM
  3. close to zero
    By nokicky in forum New To Java
    Replies: 6
    Last Post: 10-26-2009, 05:30 PM
  4. Help with java project. Im so close!
    By DanK in forum New To Java
    Replies: 2
    Last Post: 02-28-2009, 02:03 AM
  5. Close a program in java
    By romina in forum New To Java
    Replies: 1
    Last Post: 07-25-2007, 08:22 PM

Posting Permissions

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