Invoke a java application

I have a java application that I can invoke at the command line as follows:
java -classpath ../../.. ptolemy.plot.plotml.EditablePlotMLApplication
I want to invoke this application from another application. I've tried the following without any success.
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("java -classpath ../../.. ptolemy.plot.plotml.EditablePlotMLApplication");
Any ideas would be greatly appreciated.
Thanks

and your current working directory when run at the
command line is, versus what it is when running the
other app? Different, perhaps? Duh?Yeppersas far as i can see the directories are the same.

Similar Messages

  • How to invoke a java application in the middle of the process

    In the middle of one process, I want to invoke a java application. After the java application, the process will continue and select a path based on the result of the java application. Which activity can be used to invoke a java application in the middle of the process?
    Thanks

    BPM Changes:
    1. Under 'External Resources' create a new resource of type 'Server Configuration'. Specify the host port and path of your servlet here. This will be invoked from your process. Lets name this configuration as 'myExternalConf'.
    2. Create an interactive activity say 'InvokeMyApplication' in your process. The main task of this application should be external task. (Implementation Type = External)
    3. Create the prepareMethod method say 'prepareExternal'. Set the arguments for this method as output arguments. These arguments will be available to you in your external servlet.
    4. Create the commit method say 'commitExternal'. Set the arguments as input arguments. The external servlet will return these arguments back to the process.
    5. Check the 'Use configuration' checkbox for your main task (external task). Select 'myExternalConf' here.
    Servlet changes:
    When the user executes your 'InvokeMyApplication' activity, he will be taken to the external servlet of your external application. You will be passed the currentActivity, currentParticipant, instanceID and one more argument (which I dont remember :( ) as url parameters.
    1. In this servlet, open a PAPI/PAPI WS session for the participant passed to the servlet as url parameter
    2. Use the currentActivity ( passed in url parameter), to call prepare method on this activity. This will return you with the arguments defined in 'prepareExternal' method.
    3. Using these argumets, or otherwise, you can do whatever you want in this servlet. When done prepare the arguments to pass back to BPM.
    4. call papiService.activityCommit and return the arguments.
    5. Flow goes back to your BPM application
    Some code that might help:
    Servlet calling prerpare:
    ProcessServiceSession papisession = null;
    try{
    papisession = initializePapi();
    fuego.papi.Arguments args = fuego.papi.Arguments.create();
    args = papisession.activityPrepare(activity, instanceId, args);
    Map<String, Object> argsMap = args.getArguments();
    return argsMap;
    protected ProcessServiceSession initializePapi(){
    Properties configuration = new Properties();
    try {
    InputStream inputStream = getClass().getClassLoader().getResourceAsStream("bpm.properties");
    if(inputStream == null)
    throw new IOException();
    configuration.load(inputStream);
    } catch (IOException ex) {
    log.log(Level.WARNING, "Could not load bpm.properties", ex);
    return null;
    Servlet calling commit:
    public void commitToALBPM(Map parameters){
    try{
    papisession = initializePapi();
    fuego.papi.Arguments args = fuego.papi.Arguments.create();
    Set s = parameters.keySet();
    Iterator propNames = s.iterator();
    while (propNames.hasNext()){
    String key = (String)propNames.next();
    String val = (String)parameters.get(key);
    args.putArgument(key, val);
    papisession.activityCommit(activity, instanceId, args);
    catch (OperationException e)
    HTH
    Satinder

  • Invoke one java application from another?

    Hello,
    Can anyone tell me how to Invoke one java application from another?
    Suppose I have a small java application say, Hello.java which has its own main() method and
    I also have another java application, say World.java which has its own main() method too.
    What I want to do is invoke or startup World.java from Hello.java.
    If possible kindly give code examples?

    main is just a normal method so Hello can invoke the main method of World just as it would invoke any other method.
    Kaj

  • How can i launch another java application using Runtime class?

    I created a java process which invokes another java application called Launch as shown below,
    Process p=Runtime.getRuntime().exec("java -classpath=C:\\Program Files\\bin\\nettools\\ui\\updates Launch");
    But it is not working...can any one help me on this?
    Edited by: deepakchandaran on Sep 20, 2007 7:10 AM

    You could search the forum and Google.
    it has been answered before.
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • ORA-28509 when calling PL/SQL mq message throught Java Application

    I have a PL/SQL procedure called "prc_send_mq_message" witch works perfectly when I invoke throught database users where it is compiled.
    But when this same procedure is invoked by Java Application witch connects with the same user, the error: "ORA-28509: was not possible stablish connectinon with Non_Database Oracle" happens.
    Can anyone help me ?
    See pl/sqlblock bellow:
    Create or replace procedure prc_send_mq_message Is
    pi_db_link_name Varchar2(100) := 'siibdg4mq';
    pi_queue_name Varchar2(100) := 'QL.REQ.SIIB.FBS.01';
    vObjDesc PGM.MQOD;
    vHandleObj PGM.MQOH;
    vMsgDesc PGM.MQMD;
    vPutOpt PGM.MQPMO;
    --options PGM.MQPMO;
    vPutBuffer Raw(32767);
    Begin
    -- Opening the queue:
    vObjDesc.DBLINKNAME := pi_db_link_name;
    vObjDesc.OBJECTNAME := pi_queue_name;
    pgm.mqopen( vObjDesc, PGM_SUP.MQOO_OUTPUT, vHandleObj ); --> ORA-28509: was not possible stablish connectinon with Non_Database Oracle
    End;
    /

    Hi,
    This is the Oracle MessageQ forum, not the WebLogic Server, Oracle Database, or Oracle JMS forum. You will likely have better success in getting your question answered by using one of the Database related forums.
    Regards,
    Todd Little
    Oracle Tuxedo Chief Architect

  • Invoking jvm from a java application

    hello people,
    i would like to run a java application 'B' from within another java application 'A'. i have a thread sub class that does this. it is given
    below: (please pay attention to the run method)
    import java.io.*;
    import javax.swing.*;
    public class InvokingThread extends Thread
    private File n=null;
    private JTextArea outputArea;
    private String message="",action="";
    private String pathToBin,errors,input,classpath;
    private EvaluatorClient clientRef;
    //initialize InvokingThread object
    public InvokingThread(File name,String act,String path,String cp)
    outputArea=new JTextArea(10,25);
    outputArea.setEditable(false);
    outputArea.setLineWrap(true);
    n=name;
    pathToBin=path;
    classpath=cp;
    action=act;
    System.out.println((action.equals("compile"))?"compiling":"executing");
    public void setClientRef(EvaluatorClient r)
    clientRef=r;
    //process action
    public void run()
    Process proce=null;
    try
    if(action.equals("compile"))
    proce = Runtime.getRuntime().exec(pathToBin+"/javac "+n);
    else if(action.equals("execute"))
    proce = Runtime.getRuntime().exec(pathToBin+"/java "+classpath+" "+n); //run application
    Thread.sleep(5000);
    byte[] errorData = new byte[proce.getErrorStream().available()];
    proce.getErrorStream().read(errorData);
    byte[] inputData = new byte[proce.getInputStream().available()];
    proce.getInputStream().read(inputData);
    errors = new String(errorData);
    input = new String(inputData);
    System.out.println((errors.length()>0)?"error string"+errors:"no errors");
    System.out.println((input.length()>0)?"input string"+input:"");
    if (errors.length() == 0 & action.equals("compile"))
    outputArea.setText("Compiled successfully");
    if(clientRef!=null)
    if(!clientRef.isTimeUp())
    clientRef.toggleMenuItemState(4,true);
    clientRef.toggleMenuItemState(5,true);
    clientRef.compilationOutcome("success");
    JOptionPane.showMessageDialog(null,new JScrollPane(outputArea));
    else if (errors.length() != 0 & action.equals("compile"))
    outputArea.setText("Compile Errors:\n" + errors+""+input);
    if(clientRef!=null)
    clientRef.compilationOutcome("failure");
    JOptionPane.showMessageDialog(null,new JScrollPane(outputArea));
    else if(action.equals("execute"))
    if(errors.length() != 0)
    outputArea.setText("Runtime errors:\n" + errors);
    JOptionPane.showMessageDialog(null,new JScrollPane(outputArea));
    else if(input.length()!=0 )
    outputArea.setText(input);
    JOptionPane.showMessageDialog(null,new JScrollPane(outputArea));
    catch(Exception e)
    e.printStackTrace();
    System.out.println("thread awake,invoking thread terminating");
    }//end run
    The above code worked when i used it with the rest of my program.
    as we can see the thread waits for 5 seconds before it reads the inputstream and error stream of the sub process returned by Runtime.getRuntime().exec(). But what happens after the thread terminates; i am unable to process subsequent runtime messages/exceptions from the application 'B'.
    so my question goes thus: is there a way that my thread can continually listen to the error stream and input stream of the sub process while application 'B' is still running so as to process any messages returned by java form the application 'B' ? or is there a better way of doing what i set out to achieve i.e running a java application from within another java application
    timi

    Runtime.getRuntime().exec("rundll32
    url.dll,FileProtocolHandler
    mailto:[email protected]&subject=Foo&body=Bar");yawmark, where do you get such information from? (in all seriousness :-) )
    How (the hell) can you find out what args to pass to a program?
    and is "FileProtocolHandler" a place-holder? if so what for?
    thanks, :)
    lutha

  • How to invoke java application from ABAP

    How to invoke java application from ABAP  ? Suppose I needto execute a EJB wihic is running on my SAP J2EE Enigne from an ABAP Program .
    Thanks,
    Manish

    Hi Manish,
    did you get some further documents concerning "abap program calls ejb"?
    If yes, could you please send me some informations.
    Thank you for your help.
    Kind regards, Patrick.

  • Invoke Workflow from Web Dynpro for Java Application

    I am working on a custom web dynpro for java application and when the user clicks the submit button the SAP standard workflow (WS50000041) should be invoked. Does anyone have experience they can share with me on how to achieve this functionality? It should also be able to attach an adobe form or read data from the form and submit the data as xml.
    Thanks,
    Ashley

    Hi Ashley,
    Use following code in RFC to invoke your workflow -
    DATA : w_subrc TYPE sy-subrc,
                w_wi_id LIKE swwwihead-wi_id.
    CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
            EXPORTING
              task                      = ' WORKFLOW - WSxxxxxx '
              language                  = sy-langu
              do_commit                 = 'X'
            IMPORTING
              return_code               = w_subrc
              workitem_id               = w_wi_id
            TABLES
              input_container           = it_container
              message_lines             = lv_swr_messag
          COMMIT WORK.
    With this code your workflow will get start. But u have to use workflow id in next application also in which your request is getting navigated. In that application you have to take this workflow ID and have to pass again in workflow using - PortalNavigation statements.
    After that this workflow will get start to publish in your TaskList (My Task) in Portal. Remeber that your all task should be maintained in workflow table by using SWFVISU  transaction.
    After that go to Portal and Re-Register your UWL so that your new Workflow ID will get usable in portal.
    With this way you would be able to use workflow with Web Dynpro Java using UWL and Workflow.
    Regards,
    Roshan Gupta

  • Problems to invoke java.exe from Java application, but ok for javac.exe??

    How to invoke DOS application from Java application??
    I try the following but it didn't work to invoke command prompt and java.exe, it
    is working to invoke javac.exe. Any ideas why??
    import java.io.*;
    public class CallJavaTest
    { public static void main(String[] args)
    { try
    Runtime.getRuntime().exec("C:\\WINNT\\System32\\cmd.exe"); //doesn't work!!
    Runtime.getRuntime().exec("javac "+ "Test.java"); //it works!!
    Runtime.getRuntime().exec("java "+ "Test"); //doesn't work!!
    catch(IOException e)
    System.out.println(e);

    hi
    String[] cmd = {"cmd","/c", "start",enteryourdoscommandhere};
    Runtime rt = Runtime.getRuntime();
    Process ps = rt.exec(cmd);
    ps.waitFor();
    int ev = ps.exitValue();
    it works for my winXP.
    hope it can helps and not too late ..

  • Help needed to invoke MSOffice and Java application

    Hi Everybody,
    I created a macro for MS Word and automated it to a new button in file menu. And I am able to invoke the word file in my java application (with the new button I added and able to run the macro).
    Now my problem is, if I am running my java application on other system I have to invoke the word file which has to function like the modified one (with the new button and able to run the macro).
    Is it possible to do? If so how can I modify local systems MS Word by running my application? How can I copy and retrieve macro? If any one has ideas please share with me very soon.
    Thanks
    Siva

    So, you made yourself a MSWord macro. And now you want that macro to be in somebody else's computer. Correct so far? This is hardly a Java programming question, is it? You would probably get a better answer if you found an appropriate place to ask it.

  • Invoking business rules 11g from Java application

    We have SOASuite 11g running on weblogic and have read through documentation/played with Oracle business rules
    We want to utilize business rules engine within our Java web applications deployed to glassfish server (Non SOA application). Is this even possible and does anyone use it in this way? Any pointer is much appreciated.
    What are the libraries like Oracle rules SDK that I need to include in the classpath of Java web app?
    This link assumes that web app is co-located in the same weblogic instance running SOASuite and doesn't help my case.
    http://docs.oracle.com/cd/E23943_01/user.1111/e10228/non_soa.htm#BGBBCICB
    By using it within Java application, we want to able to make local calls as opposed to calling a decision function as web service. Volume of actual rules and their usage is so high within our Java app. Also we want to take advantage of java beans defined in our business layer by using Java facts and without having to define XSD for XML facts.

    I had seen the blog, It explains how to test business rules by loading the dictionary from static rules file.
    my requirement is to invoke the business rule engine running on the SOA server, from the application module. can you please help me in this.
    Thanks inadvance.
    -Murali

  • How to invoke Default printer of my system by using java application

    I need to invoke default printer of my system by using java application ? could u plz help me out with sample code?

    VoodooMagic.getDefaultPrinter().print();
    http://www.javaworld.com/javaworld/jw-10-2000/jw-1020-print.html
    Look for more at Google.

  • Possible to Invoke MS Word with Java Application?

    Is it possible to invoke Microsoft Word to open a word doc with a Java application?
    If yes, what API or knowledge should I know to do this?
    Please give some advice.

    Using the various forms of the exec() method in the Runtime class, you can execute arbitrary programs, such as MS Word. exec() returns a Process instance, which you can do various things with such as get input/output streams, kill, etc. Note the parameters to the exec() method are platform specific, because of differing command shell names, path separators, etc. So you will definitely have to experiment and see what works on your platform:
    Process msWord = Runtime.getRuntime().exec( "cmd.exe /C winword.exe" );That is one of the general idioms for using exec(), like I say you will have to experiment to see what variant of exec() works for you. Try searching these forums, this question has been answered numerous times before.

  • How can i invoke an Oracle Report w/in a Java application?

    I have a custom java application that I would like to integrate with a report tool. I am reviewing Oracle Reports but I was not sure how I would integrate an Oracle Report.
    I have read that I can use Active-X but. Has anyone ever done this? Also - is there any support for a java bean?
    I am also wondering how I could pass in report parameters.
    It is my understanding that Oracle will generate either pdf or html output which could be viewed through the browser or adobe acrobat reader.
    Is this correct?
    Please advise.
    Thanks in advance.

    Bonnie,
    I create a URL that calls Oracle Reports Server running under IAS, using PDF or html as the output. The Java code calls up the commandline and starts the default browser with the specified URL, which then talks to Oracle Reports Server... and voila... the report shows up in your browser!
    have fun...
    void execURL ( String pURL )
    System.out.println(pURL);
    if (System.getProperty("os.name").equals("Windows NT") )
    try
    Runtime.getRuntime().exec("cmd /c start "+pURL);
    catch (Exception e1) {System.out.println(e1.getMessage()); }
    else
    try
    Runtime.getRuntime().exec("start "+pURL);
    catch (Exception e2) {System.out.println(e2.getMessage());}
    null

  • Invoking a Java swing application via its process id

    I have a Java swing application. What i am trying to do here is that when the user double-clicks the jar file to open it, if the Swing application is already open and is minimized, I need to maximize the open window and make it active.
    I tried using 'jps -l' command in my new instance, and with the help of Runtime.exec() am able to detect whether the application is already running or not, and if running, am able to get the process id and am displaying a message to user indicating the window is already open.
    But how do i maximize the window of an already running application? Is it possible?

    user13333704 wrote:
    I have a Java swing application. What i am trying to do here is that when the user double-clicks the jar file to open it, if the Swing application is already open and is minimized, I need to maximize the open window and make it active. That's not hard to do, but your proposed solution is hard to do. The usual way to have only one instance of a Java application running is this:
    Have the application open a SocketServer on a certain port number. Since only one process can listen on a port, the second instance of the application will fail when it tries to open the SocketServer. When that happens, the second instance should terminate instead of displaying its own GUI. Whether it terminates silently or whether it displays a dialog is up to you.
    If you want the second instance to communicate with the first instance, that's easy because the first instance is listening on the port. So the second instance could connect to that port and send a message to it. In your case the first instance would respond to that message by maximizing its GUI.

Maybe you are looking for

  • TIme Machine external Hard Drive

    I have a free agent 1 TB external hard drivwe that I use for timemachince backups. All was operating OK until a month ago. Now I keep getting messages that my external HD was not ejected properly and it unmounts, and time machine faile to perform a b

  • Unusual Cache Error

    Hi All, I was running the report in OBIEE. I received an unusual error. Please find the error below. Has anyone encountered it before. What could be the cause and resolution for this. Please help.. Cache file 'E:\OracleBIData\tmp\sawvc\1030\ppqkiork9

  • Question about opening sockets

    Hello I have some questions about using sockets. I made a program which works with sockets. I have a class which contains this static byte[] send(byte outbuf[], int len, byte recbyt[], long recip[])         InetAddress dst = InetAddress.getByName(sen

  • I would like to implement UIuserB

    ase Messages in the Execution Display.vi that ships with TestStand. The Main Message loop polls for meassage types(string names). If I post a user message from a .seq file, I do not see a message type string at the selector input. What am I missing?

  • Installscript engine error message

    HELP. I Have an ipod shuffle which came with itunes. I have an older version of itunes loaded. I want to upgrade to "7" version but during the install I get the following message: The install script engine on this machine is older than required to ru