Execute external program from java in the same virtual machine

hello,
I need some help. here is what i need: i'm developing a test tool and i need to execute the application to be tested from my test tool in the same virtual machine so that i can be able to connect to that application and catch events like clicking and so on.
problem is that i do not know how to launch the application i want to test in the same virtual machine as the test tool.
any help would be good,
thanks

problem is that i do not know how to launch the
application i want to test in the same virtual
machine as the test tool.Just invoke the main class of that application.
You probably don't want to hear this, but writing a test tool is not easy if you are going to try to catch events etc. It's probably a bit too hard for you if you don't know how to invoke an app within the same VM.
Kaj

Similar Messages

  • Pocket PC -Problem executing external program from java

    Hi,
    I'm developing an application on Dell Axim x51 PDA. I am using mysaifu jvm. The application needs to execute an external program (.exe) for which I'm using the Runtime class.
    I get java.io.IOException: The system cannot find the file specified.
    I have verified that the file exists. ( i used File class to check if the file exists)
    here's the part of code :
    Runtime rt = Runtime.getRuntime ();      
    File sktScan = new File("\\My Documents\\RFID\\ScktScan.exe");
    if(sktScan.exists())
    System.out.println("FILE EXISTS");
    String command = sktScan.getAbsolutePath();
    process = rt.exec (command);
    System.out.println("Socket Scan Path is : "+command);

    You have acces to "java.lang.Runtime currentRuntime.exec()" method ? in my case NetBeans IDE dont give me for my compilation with :
              microedition.configuration     CLDC-1.1     
              microedition.profiles     MIDP-2.0

  • Installation OBI EE11g and Essbase 11.1.2 on the same virtual machine

    Hello Experts,
    I´ve installed OBIEE 11g on my VM and now I am starting to install Essbase 11.1.2 in standalone mode on the same virtual machine.
    I want to use essbase as datasource for OBIEE.
    I´m familiar with the installation of Essbase 11.1.2 in standalone mode.
    However before I start I wanted to know about your experiences.
    Did you install OBI EE11g and Essbase 11.1.2 on the same virtual mashine?
    Do you know a blog exactly about this topic?
    Thanks
    Regards

    Have a read of :- http://download.oracle.com/docs/cd/E17236_01/epm.1112/epm_install/ch04s09s09s03.html
    It will explain how to have multiple instances of essbase.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to execute external program in java?

    My question is how to execute an external program in java.
    I need to call a unix command in java.
    Thanks.

    it depends on what you are trying to do. Following are the two methods
    1. Runtime.exec() : this method allows you just to call an external program as a seperate process
    2. JNI (Native Interface) :- As of right now only C and C++ are supported by this method. This method allows you to directly call the C/C++ methods from JAVA

  • Executing external programs from PL/SQL?

    Hi All,
    Is it possible to execute external
    programs (i.e. shell scripts, or
    perl scripts) from a stored procedure
    or trigger?
    I know that typically it is the other
    way around, but hey try telling that
    to my boss.
    Thanks

    you cant execute any operating system commands from plsql
    procedures. but you can achieve result by using either java
    stored procedure or pro*C program .
    Suresh Vemulapalli

  • Calling external programs from Java?

    Hi All,
    Is there a way of calling external applications from Java without using Runtime.exec(). That method seems quite messy when you are dealing with streaming data from an input file to an output file. Basically what I'm asking is there a way to run a command the same way you would type it in a command shell?
    Thanks

    LeWalrus wrote:
    Ok, I've an external application that I want to be called inside a Java GUI. It has several input arguements, which the format looks something like:
    programname inputfile > outputfile
    Simple enough.
    >
    Works fine from a shell command line. From what I understand, this won't work using Runtime.exec() because that method will just start the application. Works fine from Runtime.exec(). Since you are'>' to write stdout to a file you need to us a shell to execute the command.
    String[] command = {"sh", "-c","programname inputfile > outputfile"};
    Process process = runtime.exec(command);
    You need to read, digest and implement the recommendations given in http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .
    File input and output from the application has to be taken care of programatically (java.io stuff). Fine if you've only one input and output. But if you have several input files and hundreds of output files, where does this leave you. It would be much easier if you could pass a string command to the shell directly as if you typed it in the command line yoursel!

  • Controlling external programs from Java

    Hi,
    I try to invoke an external command-line program in Windows 2000 fron Java. I do this by
    Process proc = Runtime.getRuntime().exec(cmd);
    cmd is a String representing a command. For instance I try to control the gnupg program by
    "cmd /c C:\\gnupg\\gpg --list-keys"
    This works fine. But when I want to make a more advanced control, when gnupg waits for more than one input, and that input can't be put on the same line I get problems.
    When running gpg --edit-key SomeKey on the command line I have to enter
    trust - return - 5 - return - yes - return - quit
    How do I do this?

    this is how to do it! gotta listen to the output to prevent deadlock. you can pass in parameters o the initial call as well (a string array, where string[0] = command, string[...] = input argument) or write it to the output stream of the process.
    hope this helps
    public void run_command(String starting_command, String[] further_commands)
    Process proc = Runtime.getRuntime().exec(starting_command);
    Listener.make(proc.getInputStream());//these listen to the streams
    Listener.make(proc.getErrorStream());//which prevents deadlock
    PrintWriter writer = new PrintWriter(new OutputStreamWriter(proc.getOutputStream()));
    for(int i = 0;i < further_commands.length;i++)
    writer.println(further_commands);//you could put the extra stuff as the first string in this array
    import java.io.*;
    public class Listener extends Runnable
    BufferedReader reader;
    public static void make(InputStream in)
    Listener l = new Listener(in);
    Thread thread = new Thread(l);
    thread.start();
    public Listener(InputStream in)
    reader = new BufferedReader(new InputStreamReader(in));
    public void run()
    String string;
    while(true)
    string = reader.readLine();
    try
    Thread.sleep(1000);
    catch(Exception e)

  • Starting a external program from java

    hi iam trying to start MySQL server from java, the command in dos is as follows C:\mysql\bin\mysql -u username -p ,then the user hits return and the user is prompted to enter a password. i have got as far as entering the the C:\mysql\bin\mysql -u username -p but dont know how get the prompt back to the java program i would be greatfull if anyone could tell me where iam not doing,heres my code so far
    try{
    Runtime r=null;
    r=r.getRuntime();
    Process p=r.exec("C:/mysql/bin/mysql -u mark_r -p");
    p.waitFor();}
    catch(Exception ex){System.out.print("Error");}}

    You should try using the getOutputStream() and getInputStream() methods for the Process object. Each returns either an inputStream or OutputStream object.
    You should be careful if the mySQL password is added to the command since anyone doing a 'ps' on the machine could see the password.

  • Invoke external programs from Java

    I am running a Java program which will be used to invoke other command line programs in Windows.
    However, it seems Java has problem in checking the termination state of command line programs in Windows. In the example below, the pp.waitFor() will keep waiting even if the command completed execution. I try the same code below in Unix and it works without problem. Is there anyone has come across the same problem before ?
    I am using JDK1.4.1.
    try {
    Process pp = null;
    BufferedInputStream bi = null;
    pp=Runtime.getRuntime().exec("dir");
    bi = new BufferedInputStream(pp.getInputStream());
    pp.waitFor();
    int size=bi.available();
    while (size>0) {
    byte[] buf = new byte[size];
    bi.read(buf);
    System.out.println(new String(buf));
    size=bi.available();
    } catch (Exception e) {
    System.out.println("Exceptions !!!");
    System.out.println(e.getMessage());

    I found this article rather helpful:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Executing external program (non-java)

    Hello,
    I just started programming Java. I installed SunForum3.2 on SunRay some days ago and I was faced with the problem that all that the people who are registered with the GateKeeper-Software are not shown anywhere. So I developed a small app, that read out a file containing the output of the command "registrar -q" ( displays all registered users including their SunForum-name ). Now some people not working on the SunRay-platform would like to connect as well to the SunForum-users. For this reason I'd like to execute "registrar -q" periodically and directly use the output from and within a Java-app but I couldn't find a way to execute the program "registrar -q" so far.
    Thanks for your help.
    Thomas

    Process p = Runtime.getRuntime().exec( "registrar -q" );
    Then read the Process's input stream, which should give you the stdout of your command. There are plenty of full code examples of how to do this floating about, and you should have no problem with it.

  • Problems running external programs from java

    Hello.
    I wrote a pair of perl scripts and a GUI in java to run them. The first perl script just read the files in one directory makes some changes to the names of the files and then group all this files in a set of new directories. The other perl scripts takes all this new files and calls BLAST sequence alignment program and perform some alignments among these sequences. I tested this scripts and they work fine.
    The problem comes when I try to run them for the JAVA GUI. I use RunTime and when I need to run the first perl script it all works well, but when The call to the second perl script is made the program fisishes without doing anything at all. I found out that the problem is that when running the script from the Java GUI it's not able to find BLAST program. So I guess that Java is not really starting a terminal session and it doesn't read my bash_profile to find out the path to my programs.
    So, my question is if anyone knows a method to tell Java to load all this paths in the bash_proflie file so all of my scripts work???.
    I have no idea is this can be done and how so any advice would be really wellcome.
    By the way, my java version is 1.4.2 and my OS is Mac OS X 10.3
    Thanks a lot , Julio

    Invoke /bin/sh -c and give it your program's full path with.
    (To understand what I've written, maybe reading
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html
    http://mindprod.com/jgloss/exec.html
    and
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    (especially the exec(String[] cmdarray) method)
    might help)
    -T-

  • How can I execute an external program from within a button's event handler?

    I am using Tomcat ApacheTomcat 6.0.16 with Netbeans 6.1 (with the latest JDK/J2EE)
    I need to execute external programs from an event handler for a button on a JSF page (the program is compiled, and extremely fast compared both to plain java and especially stored procedures written in SQL).
    I tried what I'd do in a standalone program (as shown in the appended code), but it didn't work. Instead I received text saying the program couldn't be found. This error message comes even if I try the Windows command "dir". I thought with 'dir' I'd at least get the contents of the current working directory. :-(
    I can probably get by with cgi on Apache's httpd server (or, I understand tomcat supports cgi, but I have yet to get that to work either), but whatever I do I need to be able to do it from within the button's event handler. And if I resort to cgi, I must be able to maintain session jumping from one server to the other and back.
    So, then, how can I do this?
    Thanks
    Ted
    NB: The programs that I need to run do NOT take input from the user. Rather, my code in the web application processes user selections from selection controls, and a couple field controls, sanitizes the inoputs and places clean, safe data in a MySQL database, and then the external program I need to run gets safe data from the database, does some heavy duty number crunching, and puts the output data into the database. They are well insulated from mischeif.
    NB: In the following array_function_test.pl was placed in the same folder as the web application's jsp pages, (and I'd tried WEB-INF - with the same result), and I DID see the file in the application's war file.
            try {
                java.lang.ProcessBuilder pn = new java.lang.ProcessBuilder("array_function_test.pl");
                //pn.directory(new java.io.File("K:\\work"));
                java.lang.Process pr = pn.start();
                java.io.BufferedInputStream bis = (java.io.BufferedInputStream)pr.getInputStream();
                String tmp = new String("");
                byte b[] = new byte[1000];
                int i = 0;
                while (i != -1) {
                    bis.read(b);
                    tmp += new String(b);
                getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + tmp);
            } catch (java.io.IOException ex) {
                getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + ex.getMessage());
            }

    Hi Fonsi!
    One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
    /Thomas

  • Execute linux command from java

    I wanna execute linux command from java, bu the output has error:
    Return code = 1
    top: failed tty get
    The code as:
    import java.io.*;
    public class Execute {
         public static void main(String[] args) {
              try {
                   final Process process = Runtime.getRuntime().exec("top");
                   new Thread() {
                        public void run() {
                             try {
                                  InputStream is = process.getInputStream();
                                  byte[] buffer = new byte[1024];
                                  for (int count = 0; (count = is.read(buffer)) >= 0;) {
                                       System.out.write(buffer, 0, count);
                             } catch (Exception e) {
                                  e.printStackTrace();
                   }.start();
                   new Thread() {
                        public void run() {
                             try {
                                  InputStream is = process.getErrorStream();
                                  byte[] buffer = new byte[1024];
                                  for (int count = 0; (count = is.read(buffer)) >= 0;) {
                                       System.err.write(buffer, 0, count);
                             } catch (Exception e) {
                                  e.printStackTrace();
                   }.start();
                   int returnCode = process.waitFor();
                   System.out.println("Return code = " + returnCode);
              } catch (Exception e) {
                   e.printStackTrace();
    }Help please.

    Your code is probably good to run a program, that does not use terminal capabilities.
    Program "top" is a little bit more complicated - you have to run it with a real terminal.
    Try to run "xterm -e top". You can find an example how to run an external program
    from java code in cnd/gdb module on http://cnd.netbeans.org
    For example, take a look at openExternalProgramIOWindow() method on this page:
    http://cnd.netbeans.org/source/browse/cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/proxy/Attic/GdbProxyCL.java?rev=1.1.2.6.2.5&only_with_tag=release551_fixes&view=markup
    It runs a command with external terminal.
    Thanks,
    Nik

  • Is it possible to execute SAPGUI scripts from java program?

    Hi everyone..
         I need to develop an java applications that executes the SAPGUI script or any technique that execute set of transaction as client.
         Is it possible to execute SAPGUI scripts from java program? if so, how it can be achieved? is there any other technique to achieve above mention scenario?.
         it will be more helpful, if docs related to that are shared..
         Thanks in advance

    Oh, bummer. Would be much more convenient if I could just use iTunes for everything. Can't stand WMP. I wonder if WinAmp might be a good compromise?
    Thanks for this answer . . .
    Sharon

  • How Can I execute an external program from my vi?

    Hi guys,
    I want to execute a external program to use it when i called with a bottom. I want push a bottom and execute the program, like acess direct icon or so.
    Any help?.

    Hi Fonsi!
    One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
    /Thomas

Maybe you are looking for

  • How to stop a process from running and display a message

    I have a button that inserts data into a table based on bind variable selected on the page. I would like to add code to that button that will check to see if certain data already exists in the table, for that bind variable, and if that data already e

  • Using Discoverer with Oracle Apps

    Hi, I have Oracle Apps vision instance on my laptop. I installed Discoverer Administrator and Desktop. But when I connect through Desktop, it only recognizes database users. When I check Application User check box still it did not recognize the Oracl

  • SAP HCM P&F : FPM Form List UIBB Table Width...

    Dear All, I am stuck with strange issue. In SAP HCM Process & Forms with FPM Form, when we use UIBB List layout configuration, how can we set the width of the table? During run time,table is displayed from left to right (column A-H) and all other for

  • SAP GRC AC: Organizational rules at Batch risks analysis and Dashboards

    Dear All. I would like to know GRC AC is able to consider the organizational rules defined (for example: risk only affected to Company, BUKRS 0001) at the Batch risks analysis and at the Dashboard. I already know that for the ad-hoc reporting you can

  • CREATE ERROR RPE-02005: Internal error: Attribute SYS:KEY

    Has anyone experienced this error when deploying a WF and an idea what can cause this: ORA-01422: exact fetch returns more than requested number of rows ORA-06512: at "OWF_MGR.WF_LOAD", line 2138 ORA-06512: at line 1 EDW_DMSA Create Error RPE-02005: