Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Open .exe within Java component

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Open .exe within Java component

    Hello all,

    I'm new here and this is my first question and post.
    Right my question is, Is it possible to open up a game using java and manipulate it (as a cheat). So i want to open up "chess" Using java (this is fine) But then i want to be able to "read" what is on the screen and act due to different actions, or moves etc.

    Is this possible? And what is the best way to do this?

    What i know so far

    I can open the file by doing
    Process process = Runtime.getRuntime().exec("");

    But i don't know how i can get information from it.

    Thank you


  2. #2
    Junior Member
    Join Date
    Jul 2012
    Location
    Chandigarh, India
    Posts
    6
    My Mood
    Cool
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Open .exe within Java component

    import java.util.*;
    import java.io.*;

    public class CallFile{
    public static void main(String[] args) {
    try {
    Runtime rt = Runtime.getRuntime();
    rt.exec("cmd.exe /C start C:\\ab.bat");
    }
    catch(Exception ex){
    ex.printStackTrace();
    }
    }
    }

    Hello, there is "ab.bat" file would be placed in c:\\ab.bat..
    in ab.bat file, you can define whatever .exe file you want to open...

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Open .exe within Java component

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/61537-open-exe-within-java-component.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


Similar Threads

  1. Java Tip Jul 29, 2010 - Swing Console Component
    By helloworld922 in forum Java Swing Tutorials
    Replies: 6
    Last Post: April 16th, 2014, 12:08 AM
  2. java 2EE6 web component developer
    By babsjulio in forum Member Introductions
    Replies: 1
    Last Post: February 24th, 2012, 06:18 AM
  3. Java Tip Jul 29, 2010 - Swing Console Component
    By helloworld922 in forum Java Code Snippets and Tutorials
    Replies: 2
    Last Post: August 24th, 2010, 06:48 AM
  4. How to Use the JList component - Java Swing
    By neo_2010 in forum Java Swing Tutorials
    Replies: 1
    Last Post: July 11th, 2009, 04:02 AM
  5. How to Use the JList component - Java Swing
    By neo_2010 in forum Java Code Snippets and Tutorials
    Replies: 1
    Last Post: July 11th, 2009, 04:02 AM