Calling a Java Application from MicroFocus COBOL.... (in UNIX environment)

Hello,
Could you please let me know, how to call a Java application from a MicroFocus COBOL application. If anyone has any code samples, that would be of great help.
Thanks in advance,
Tijo.

Annoyingly crossposted.
http://forum.java.sun.com/thread.jspa?threadID=730657

Similar Messages

  • Call a Java Application from MicroFocus COBOL (in UNIX environment)

    Hello,
    Could you please let me know, how to call a Java application from a MicroFocus COBOL application. If anyone has any code samples, that would be of great help.
    Thanks in advance,
    Tijo.

    You generally can't cause a program to be executed on a different >server. Basic security, you know. Besides this idea of having the Java >application run on a different server wasn't mentioned in your original >post. That leads me to believe we don't have the whole story.So I think you need to step back and find out what are the requirements. For example: Does your program need to start this Java application running, or is it already running and your program needs to connect to it somehow?
    My program has to start a Java class file, meaning that the Micro Focus COBOL module will call the Java class file. Will it be running on the same machine as your program, or on some other machine?
    For both cases, I would like to know the answer.a) Running on the same machine as my program is running.
    b) Running on the different machine.
    And then there are the questions about whether your program needs to have a conversation with the Java application, or whether it just needs to start it and that's all.
    COBOL program has to call a Java class by passing some parameters and Java class in turn process it and return some value back.. Kind of Request and Response model.Plenty of questions to be asked. Go and find out what they are.
    Sorry ... if I am not clear on my questions. Anyhow, thank you very much for providing the information.

  • Calling a java application from j2ee web application

    Hi,
    I have a j2ee application in which i am making a call to a jar file which is a java application.
    Runtime a4 = Runtime.getRuntime();
    Runtime a = Runtime.getRuntime();
    String cmd[] = new String[14];
    cmd[0] = "cmd";
    cmd[1] = "/c";
    cmd[2] = "start";
    cmd[3] = "javaw";
    cmd[4] = "-jar";
    cmd[5] = CATALINA_HOME+"\\webapps\\AveksaTesting\\AveksaTestingJava\\dist\\AveksaTestingJava.jar";
    cmd[6] = SERVER_TESTS;
    cmd[7] = COLLECTOR_TESTS;
    cmd[8] = SYSTEM_TESTS;
    cmd[9] = CREATE_ORACLE;
    cmd[10] = DB_NAME;
    cmd[11] = DB_DUMP;
    cmd[12] = email;
    cmd[13] = isMIGRATE;
    try{
    java.lang.Process p = a.exec(cmd);
    Now in the called java application, i am first shutting down the tomcat server by calling shutdown.bat script and then starting it using startup.bat. But the problem i am facing is when i restart the server from java application, it says address already in use(i.e. port 8445 on which tomcat is runninng).
    Id i just call the java application and do the same operation it works fine. I guess when i am calling java from j2ee application, j2ee still has some threads holding java and not shutting down tomcat properly.
    Can anyone suggest me what can be done in this case. I have to call a java application from j2ee and restart the tomcat server many times.
    Thanks in advance
    -Vikram

    Annoyingly crossposted.
    http://forum.java.sun.com/thread.jspa?threadID=730657

  • Calling Webdynpro Java Application from Webdynpro ABAP Application.

    Hi,
    We have developed one Application using Webdynpro Java and I m in need to call the Webdynpro Java application from Webdynpro ABAP.
    Require Suggestions to acheive this.
    Thanks In advance.
    Reg,
    Ajay.

    Dear Ajay,
    Assuming that both your applications WDA & WDJ are in the portal & you don't have to pass any parameters to the WDJ application.
    Write the following code on the action  where you would call the WDJ application.
      DATA:
            lr_compcontroller TYPE REF TO ig_componentcontroller,
            l_component TYPE REF TO if_wd_component ,
            lr_port_manager TYPE REF TO if_wd_portal_integration ,
            wa_navigation TYPE navigation.
      lr_compcontroller =   wd_this->get_componentcontroller_ctr( ).
      l_component = lr_compcontroller->wd_get_api( ).
      lr_port_manager = l_component->get_portal_manager( ) .
    * The value inserted into the navigation-target field can be found in the Portal
    * content administration tab of your portal. It is the ID or PCD Location field
      wa_navigation-target = pcd. " Please provide the PCD Location of the WDJ Application here.
      wa_navigation-mode   = '0'.  "0 = INTERNAL(same page) and 1 = EXTERNAL(new page).
      CALL METHOD lr_port_manager->navigate_absolute
        EXPORTING
          navigation_target = wa_navigation-target
          navigation_mode   = wa_navigation-mode.
    You can get the PCD from the Page properties of the WDJ application page in the Portal.
    Hope it helps!
    Warm regards,
    Upendra Agrawal

  • Help with calling a java application from inside another one

    Hello!
    I am having this problem which is getting on my nerves and dont know how to solve..
    I want to call from my java application, another java application. So i use the exec command. Then i want to read the output of this execution from my own application, (the "parent" process).
    But it doesn work properly. Something seems to happen and i dont get the whole output.
    The java program i want to call is created for running an application created with Matlab java builder.
    This program works when called from cmd, but seems not to work when called from inside a java application.
    The code of my java application is:
    Runtime rt = Runtime.getRuntime();
    Process child;
    // The java class getmagic is a special kind of java file that uses classes that work in matlab. It uses a component (.jar) file that is created from matlab java builder. thats why it wants the -classpath and the rest options.
    //I hope you wont get messed up in here.
    String[] callAndArgs = {"java","-classpath",".;C:\\Program Files\\MATLAB\\R2006b\\toolbox\\javabuilder\\jar\\javabuilder.jar;..\\MagicDemoComp\\magicsquare\\distrib\\magicsquare.jar -Djava.library.path=C:\\Program Files\\MATLAB\\R2006b\\bin\\win32;","getmagic","4"};
    try{
    child = rt.exec(callAndArgs);
    InputStream is = child.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null)
    System.out.println(line);
    is.close();
    System.out.println(child.waitFor());
    System.out.println("Finished");
    }catch(IOException e) {
    System.err.println("IOException starting process!");
    }catch(InterruptedException e) {
    System.err.println("InterruptedException starting process!");
    The java program (getmagic) thats uses matlab gives the following output (after some time) when called in cmd with argument 4
    Magic square of order 4
    16 2 3 13
    5 11 10 8
    9 7 6 12
    4 14 15 1
    My program shown above only prints:
    Magic square of order 4
    1
    Finished.
    Do i do something wrong? How can i get the rest of the output???
    Thank you very much in advance,
    Stacey
    PS: I am sorry for the length of my post.

    Hello CaptainMorgan08, thanx for the instant reply.
    I tried, but no, i cant.
    Because i cannot include this java aplication that uses matlab into my application, cause 1) it needs special arguments in the compiler and during execution so it can be run and 2) it uses classes that java doesnt have. only the java-like matlab code.
    For example it uses:
    import com.mathworks.toolbox.javabuilder.*;
    import magicsquare.*; //the component which is made from matlab java builder.
    So i cannot compile it with my application!
    If you know of a way, please let me know!
    I know i might be missing something.. something that is obvious to you.. but i ve been working days=nights hardly no sleep..so you can excuse me if i say something foolish..
    Message was edited by:
    Stacey_Gr

  • Calling a java application from within another class

    I have written a working java application that accepts command line parameters through public static void main(String[] args) {} method.
    I'm using webMethods and I need to call myapplication from within a java class created in webMethods.
    I know I have to extend my application class within the webMethods class but I do not understand how to pass the parameters.
    What would the syntax look like?
    Thanks in advance!

    why do you want to call the second class by its main method ??
    Why not have another static method with a meaningfull name and well defined parameters ?
    main is used by the jvm as an entry point in your app. it is not really meant for two java applications to communicate with each other but main and the code is not really readable.
    Have a look at his sample
    double myBalance = Account.getBalance(myAccountId);
    here Account is a class with a static method getBalance which return the balance of the account id you passed.
    and now see this one, here Account has a main method which is implemented to call getBalance.
    String[] args = new String[1];
    args[0] = myAccountId;
    Account.main(args);
    the problem with the code above is
    main doesn't return anything so calling it does do much good. two the code is highly unreadable because no one know what does the main do... unlike the sample before this one where the function name getBalance clearly told what is the function doing without any additional comments.
    hope this helps.... let me know if you need any additional help.
    regards,
    Abhishek.

  • Calling a java application from another

    Hello,
    i have noticed a strange behaviour of my java app when i open it from another java app. When i run the core application with a bat file using jre1.6 everything works fine. Now what i want to do is create an application that checks the existance of jre 1.6, downloads it if it does not exist and run real application with the new jre. The second small app runs with a small jre 1.4.2. In reality it seem to work fine, it downloads the jre1.6 folder and exits normally. However when the real application is launched it behaves strangely without throwing any exceptions. And this behaviour seems to be random. for example, a jpanel may not show any components, or the whole jframe may close suddenly. Does anyone have any idea what is going on? Is there a chance that some classes of the first jre remain in memory and conflict when the second application is launched?

    Just a wild guess: maybe you're invoking the java 1.6 binaries, but JAVA_HOME or something is pointing to java 1.4 libraries (or vice-versa), and you've found some weird interaction issue.

  • Calling Java Application from another

    How can i call a Java Application from another java App.
    eg., If my Java application is called MyApp and i would like call another java application from within it.
    One way could be by using "System". I would like to know if there is any other method and is portable.
    Thanks in advance.

    hi,
    it works and not!
    if you start an other class with a command like this the 2nd prog/class terminates too if you terminate the caller-class!
    dear
    oliver scorp

  • Connecting to desktop Java application from R/3

    I want to connect to a java application program in my desktop and return a parameter to R/3. I have installed Java connector and I want to call the java application from R/3 using Java connector.
    I was able to get few samples to setup the RFC destination for a remote server program, but I was not able to find anything for an application in the client system. How to setup the RFC destination for a Java connector to call the application in the desktop? Can anyone please answer this question.

    Hi Allam,
    1. Why do you need to connect from backend system to your desktop client? Did I understood it correctly that it's exacly what you want to do?
    2. I guess examples you saw are for JCO or JCA which is a part of SAP J2EE server. Simply speaking the server is waiting for a client request and your desktop application probably not. If you still are sure that server->desktop connection is what you need then you have to emulate the server on your self and then depending on what you need JCO/JCA you have to create a kind of container that will implement listening service.
    I'd like to hear your answer for question one to give you more detailed answer.

  • How can I call a java object from Web dynpro ABAP application?

    I made Web dynpro ABAP application and posted it to SAP EP.
    For certain business purpose, we need to call external 3rd party java object using 3rd party's java api in Web dynpro application.
    Is there anybody who experienced this kind of java interface issue?
    I know Web dynpro Java environment can fully support this kind of requirement. but regarding Web dynpro ABAP, I couldn't find any clue for this.
    Any comment or suggestion would be greatly appreciated.
    Thanks,
    Raymond, ABAP Consultant

    if you have jco configured, then you can make calls to java api from ABAP .
    check out this weblog.
    /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
    Raja

  • How to call a VB application from Java

    Hi,
    does anybody know how to call a VB application from java.
    Would appreciate if you can provide me with an example.
    thanks

    try exec()ing the cad program with the name of the file as a command line parameter...
    Runtime.getRuntime().exec("CADProg.exe Test.prt");
    i have no clue if this will work but it seems like it's worth a try.

  • How to call a WD JAVA application from a WD ABAP application

    Hi experts,
    Here I have two applications with me. One has been created through WebDynpro ABAP while the other one has been created through WebDynpro JAVA. Now i have to call upon the JAVA aplication from my ABAp application. In other words in need to integrate both the applications so as to have an easy navigation in between them.
    In the whole process I need to take care that the data is not lost from both ABAP or JAVA side.
    Please help me someone knows the solution.
    Regards,
    Kaustubh Maithani

    Hi,
    Usally to run WebDynpro for Java Application, we get the Application URL.
    If you want to call this WebDynpro Java Application from Webdynpro Abap, then create UI element like Link to Action or LinktoURL and give the url as WebDynpro for Java URL.
    Regards,
    Lakshmi Prasad.

  • Can we call a simple java application from ESB

    Please let me know how this can be done by using a ESB. The application jar exists on the host server. How we can pass parameters etc and receive results from this application.
    Any help will be greatly appreciated.
    Prakash

    Not sure if I completely understand your question, but you can certainly try following ways:
    - call your java application via WSIF. ESB with JAVA wsif is available in 10.1.3.3.1 only (it is not supported in 10.1.3.3 very well).
    - you will have to include this jar file in server.xml or bpel/system/classes so that it is available to the SOA jvm.
    - You mentioned it is simple java application, but if your java API has complex (object) input and output, you will need some work
    HTH,
    Chintan

  • Can we call simple a java application from any one of this AS adapters

    Can we call a simple java application from any one of this AS adapters?
    Prakash
    Message was edited by:
    user629857

    You can achieve this using LiveCycle PDF Generator JAVA API. You can find required code here:
    Adobe LiveCycle * Quick Start (SOAP mode): Converting a Microsoft Word document to a PDF document using the Java API
    In parameters:
    //Set createPDF2 parameter values
    String adobePDFSettings = "Standard";
    String securitySettings = "No Security";
    String fileTypeSettings = "Standard OCR";
    "Standard OCR" file type setting will run OCR on input pdf. In the code, instead of doc file provide a pdf file. Resultant pdf will be searchable PDF i.e OCRed PDF.
    Feel feel to ask any further questions.

  • Calling Java application from servlet

    Hi !
    I'm trying to run a Java application from within a servlet with Tomcat 4. I'm using the Runtime.getRuntime ().exec () method. So the application is run in a different JVM as a subprocess of the servlet. I use ObjectInputStream and ObjectOutputStream and a serializable object to enable communication between the servlet and the application.
    I tested the application and the serializable object with another Java application that works as the caller and it works fine. However, replacing the caller application with the servlet I get a StreamCorruptedException. The structure of the caller application and the servlet is the same.
    My questions are:
    - Is there something I should configure in Tomcat to create a subprocess ?
    - What is the cause of the StreamCorruptedException ? How do I get it with the servlet and not with the application ?
    - Should I use an environment with the call to Runtime.getRuntime ().exec () ? How do I use it ?
    - Is the called application forced to run in my servlet's context ?
    - Is there a better way to do this ?
    Thanks to all

    Here's my code:
    1. The serializable object:
    // Object Obj
    import java.io.*;
    public class Obj implements Serializable
    public int n;
    public Obj ()
    n = 0;
    public Obj (int n)
    this.n = n;
    public String toString ()
    return getClass ().getName () + " -> (n = " + n + ")";
    2. The application Sub (subprogram)
    // Application Sub
    import java.io.*;
    public class Sub
    private static File f;
    private static FileWriter fw;
    public static void main (String [] args)
    throws IOException, InterruptedException, ClassNotFoundException
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj;
    ois = new ObjectInputStream (System.in);
    obj = (Obj) ois.readObject ();
    f = new File ("Sub.txt");
    fw = new FileWriter (f);
    fw.write (obj.toString ());
    fw.close ();
    oos = new ObjectOutputStream (System.out);
    oos.writeObject (obj);
    ois.close ();
    oos.close ();
    3. The application AMain (caller application)
    // Application AMain
    import java.io.*;
    class AMain
    private static File f;
    private static FileWriter fw;
    public static void main (String [] args)
    throws IOException, ClassNotFoundException
    Runtime r;
    Process p;
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj, obj2;
    r = Runtime.getRuntime ();
    p = r.exec ("java Sub");
    oos = new ObjectOutputStream (p.getOutputStream ());
    obj = new Obj (5);
    oos.writeObject (obj);
    oos.flush ();
    B.comunica (obj);
    System.out.println ("AMain sends to Sub: " + obj.toString ());
    try
    p.waitFor ();
    catch (InterruptedException e)
    System.out.println ("Subprogram was interrupted");
    System.out.println (e.toString ());
    ois = new ObjectInputStream (p.getInputStream ());
    System.out.print ("Sub sends to AMain: ");
    obj2 = (Obj) ois.readObject ();
    System.out.println (" " + obj2.toString ());
    oos.close ();
    ois.close ();
    p.destroy ();
    4. The servlet SMain (the calling servlet)
    // Servlet SMain
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class SMain extends HttpServlet
    public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    Runtime r;
    Process p;
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj, obj2;
    int state, i;
    res.setContentType ("text/html");
    ServletOutputStream out = res.getOutputStream ();
    out.println ("<html>");
    out.println ("<head><title>Sub</title></head>");
    out.println ("<body>");
    out.println ("Invoking subprogram...");
    out.println ("<br>");
    try
    r = Runtime.getRuntime();
    p = r.exec ("java -cp .;c:\\Programs\\Apache~1.0\\webapps\\SMain\\WEB-INF\\classes Sub");
    out.println ("...invoked<br>");
    oos = new ObjectOutputStream (p.getOutputStream ());
    obj = new Obj (5);
    oos.writeObject (obj);
    oos.flush ();
    out.println ("<br>SMain sends to Sub: " + obj.toString () + "<br>");
    try
    p.waitFor ();
    catch (InterruptedException e)
    out.println ("<br>Subprogram was interrupted<br>");
    out.println ("<br>" + e.toString () + "<br>");
    state = p.exitValue ();
    out.println ("<br>Subprogram state: " + state + "<br>");
    ois = new ObjectInputStream (p.getInputStream ());
    out.print ("<br>Sub sends to SMain: ");
    obj2 = (Obj) ois.readObject ();
    p.destroy ();
    catch (SecurityException e)
    out.println ("<br>SecurityException<br>");
    out.println ("<br>" + e.toString () + "<br>");
    catch (IOException e)
    out.println ("<br>IOException<br>");
    out.println ("<br>" + e.toString () + "<br>");
    catch (Exception e)
    out.println ("<br>Exception<br>");
    out.println ("<br>" + e.toString () + "<br>");
    out.println ("</body>");
    out.println ("</html>");
    So, as you can see, both application AMain and servlet SMain invoke application Sub and pass it the serializable object Obj. Oddly enough, application AMain works fine whereas servlet SMain throws a StreamCorruptedException exception.
    johnpoole said:
    �It's hard to guess what would cause the exception without seeing code, but the interaction between the processes would differ from that between two applications, because the servlet process is started with a different class loader. I'm not sure which one the jvm started by the call would use.�
    How can I enforce that a System classloader be used in the call to Runtime.getRuntime ().exec () ? (I mean by System classloader a classloader equals to the one applications are launched from console).
    johnpoole said
    �Is there a reason why you aren't starting the second process manually and then connecting to it on a port?�
    The idea is providing a Web interface for an application running in the server. The servlet is used to restrict access to this application but once access is granted (passing the servlet) the application should not be constrained.

Maybe you are looking for

  • Can't restore from Time Machine backup error message

    My hard drive on my Macbook failed a few days ago. Just makes a clanking noise and won't boot up etc... I installed a new drive, formatted it, and selected restore from Time Machine backup from the installer screen. It started restoring from my backu

  • Adobe Acrobat Pro XI no more running after latest update

    I've subscribed to Adobe Creative Cloud package. Anyway, during the latest update, Adobe Acrobat Pro XI stopped working: I cannot launch it any more (I get this message, translated by Italian: "You cannot run "Adobe Acrobat Pro" because it may be dam

  • How do I recover my System Preferences?

    My System Preferences is missing off of my MacBook along with Time Machine and other essential applications.  I run Snow Leopard Mac OS X 10.5.8 but I do not own the installation DVDs.  I have repaired the disk permissions to no avail.  I cannot even

  • Why can't w have the YouTube application in iOS6?  Can I downgrade to go back to iOS5?

    I upgraded to iOS6 yesterday only to find my favorite app gone!  Youtube was dropped in facvor of what?  Nothing!  Can I downgrade to iOS 5 again, so I can get it back? Editorial comment: Apple need to learn to play with others better.... I went away

  • SAPGUI 7.20 PL4: Input history is not working

    Hello, we're on the way to roll out SAPGUI 7.20 PL4. Now I discoverd a serious bug: Local input history isn't working anymore. I switched on tracing on SAPGUI to see whats wrong, an the cause is simple: SAPGUI uses comma (,) instead of dot (.) in the