Call RFC from java (j2ee) /  call to j2ee from R/3

hello
i´ve browsed the forum for some time to find how to:
1.) call ejb from r/3 system via rfc
2.) call rfc enabled function modules on r/3 from within an j2ee enviroment
but i didn´t quite get it, because i was a bit confused about all the mentionend techniques
what i found out about
1.) use ejb (session bean) and jndi; configure RFC-Engine Service (we use sap webas)
2.) use jco / jca
    (or all rfc enables rfm´s are available as web service, but didn´t find anything about this)
so my question:
are these the preferred techniques to connect j2ee (webAS) <-> r/3; if not are there any others, maybe easier methods?
and last but not least: are there any good online tutorials for this topic?
thanks in advance
franz

Just as a short partial reply.
The generic Java --> RFC method is JCO (it will work on older versions as well), you can think of it as a JDBC driver where R/3 is the database, it behaves very similar in many ways.
EJB development on SAP WAS is really not any different from EJB development on any other J2EE server. The deploy tool is superb. very easy to use and the JNDI registry, etc. are standard stuff...
ABAP to EJB calls, haven't looked at this in over a year now, but back then we did a Proof Of Concept based on information at http://help.sap.com and it did work indeed. The only thing was back then that you needed to do a few tweaks to get it to work properly.
As mentioned above, look at the JCO examples and then you can ask more specific questions once you get stuck.
Good Luck!
Cheers,
Kalle

Similar Messages

  • Call RFC  using java procedure

    Hi
    How can I to use java procedure and call RFC for to access tables of SAP ?
    Thank You

    RFC? That term in the IT environment usually means "+Request For Comments+" and refers to Internet protocol and usage standards.
    Do you perhaps means RPC (Remote Process/Procedure Calls)? Or something else?
    Also, SAP is a company. Not a product. SAP has a product called R3. This runs inside a database.
    Connecting from Java to a database typically requires nothing more than a JDBC driver. So why can't you use a JDBC driver and need to call the database (and access tables) using another method?

  • Problem while calling RFC in java

    hi,
    I writed a java program  calling a batch input RFC.  The RFC return an internal table which storing the system messages of the batch input process. My problem is:
    When i debug the java program,the RFC excecuted and return the correct internal table to me.
    But when i executed it not in debug mode, there is no batch input messages return to me.
    My code is:
    package com.hongta.com.z_delivery_bdc;
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.JCO;
    import com.sap.mw.jco.JCO.ParameterList;
    @author Administrator
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class ConnectRFC extends Object {
         JCO.Client mConnection;
         JCO.Repository mRepository;
         String filePath;
         String BDCLOG;
         JCO.Function function;
         public void Connect1() {
              filePath =
                   "C:
    Documents and Settings
    Administrator.3939200975DB4C5
    desktop
    cigaXY2008-12-15.xml";
              function = null;
              try {
                   // Change the logon information to your own system/user
                        mConnection = JCO.createClient("610", // SAP client
              "xxxxxx", // userid
              "xxxxxx", // password
              null, // language
              "10.96.0.53", // application server host name
         "01"); // system number
          // mConnection.setAbapDebug(true);
                   mConnection.connect();
                   mRepository = new JCO.Repository("ARBsoft", mConnection);
              } catch (Exception ex) {
                   ex.printStackTrace();
                   System.out.println("jco connect failed");
                                            mConnection.disconnect();
                   System.exit(1);
              //JCO.Table codes = null;
              try {
                   function = this.createFunction("Z_BAPI_CONTRACT_BDC");
                   if (function == null) {
                        System.out.println(
                             "Z_BAPI_contract_bdc" + " not found in SAP.");
                        if ( mConnection != null && mConnection.isAlive()) {
                             mConnection.disconnect();
                        System.exit(1);
                   //function.getImportParameterList().setValue(filePath, "FILEPATH");               
                   //function.getImportParameterList().setValue(BDCLOG, "BDCLOG");
                   mConnection.execute(function);
                                   catch (Exception ex) {
                                       //System.out.println(ex.toString());
                                    ex.printStackTrace();
                                     System.out.println("execute failed");
                                            mConnection.disconnect();
                                     System.exit(1);
              JCO.Table codes = null;
              codes =
                 function.getTableParameterList().getTable("MESSAGE");
              try {
                        codes.firstRow();
                        for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                        System.out.println(codes.getString("CON")"  "codes.getString("MESG"));
              catch(Exception ex1){
                   ex1.printStackTrace();
                   System.out.println("codes");
              if ( mConnection != null && mConnection.isAlive()) {
                   mConnection.disconnect();
                   System.out.println("chenggong");
              public JCO.Function createFunction(String name) throws Exception {
                   try {
                        IFunctionTemplate ft =
                             mRepository.getFunctionTemplate(name.toUpperCase());
                        if (ft == null){
                             return null;
                        return ft.getFunction();
                   } catch (Exception ex) {
                        throw new Exception("Problem retrieving JCO.Function object.");
              public static void main(String[] args) {
                   ConnectRFC app = new ConnectRFC();
                   app.Connect1();
    Regards,
    taowenbo.

    hi,
    i had resolved my problem in other way.I don't upload my data using ws_upload now,but upload with table.
    here is my code.Maybe helpful to somebody:
           JCO.Table C_XYORDERTable;
         JCO.Table C_XYORDPR_FINALTable;
         public void getXyordprFinalElement(Element e) {
              try {
                   for (Iterator i = e.getChildren().iterator(); i.hasNext();) {
                        Element child = (Element) i.next();
                        if (child.getName().equals("ORDER_ID"))
                             C_XYORDPR_FINALTable.setValue(child.getText(), "ORDER_ID");
                        else if (child.getName().equals("ID"))
                             C_XYORDPR_FINALTable.setValue(child.getText(), "ID");
                        else if (child.getName().equals("PRODUCT_ID"))
                             C_XYORDPR_FINALTable.setValue(
                                  child.getText(),
                                  "PRODUCT_ID");
                        else if (child.getName().equals("MATNR"))
                             C_XYORDPR_FINALTable.setValue(child.getText(), "MATNR");
                        else if (child.getName().equals("QUANTITY"))
                             C_XYORDPR_FINALTable.setValue(child.getText(), "QUANTITY");
                   C_XYORDPR_FINALTable.nextRow();
              } catch (Exception ex) {
                   ex.printStackTrace();

  • Calling RFCs in Java WebDynpro

    Hello Experts,
    I'm new to WebDynpro. I'm a novice at best and have just learned the basics. I'll probably be asking a lot of questions about this soon. Here is one problem I recently encountered:
    I managed to call RFCs from R/3 using a user input and then another one by using one field retrieved from the first called RFC. Now i have to call a BAPI recursively from the data I got from the 2nd RFC that I called.
    Here is the code so far:
    public void executeBapi_Network_Getdetail_Input( )
        //@@begin executeBapi_Network_Getdetail_Input()
        //$$begin Service Controller(246259973)
        IWDMessageManager manager = wdComponentAPI.getMessageManager();
        try
          BigDecimal plannedCost = new BigDecimal(0);
           for (int i=0; i<wdContext.nodeZps_Fm_Get_Network_Num_Input().nodeNetworks().nodeEx_Networks().size(); i++) {
              wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Network(false);
              wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Network_Activity(true);
              wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Relation(true);
              wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Activity_Element(true);
              wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Activity_Milestone(true);
              wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Component(true);
              wdContext.currentBapi_Network_Getdetail_InputElement().setNumber(
                wdContext.nodeZps_Fm_Get_Network_Num_Input().nodeNetworks().nodeEx_Networks().getEx_NetworksElementAt(i).getAufnr());
              wdContext.currentBapi_Network_Getdetail_InputElement().modelObject().execute();
              wdContext.nodeNetworkDetails().invalidate();
              plannedCost.add(wdContext.nodeBapi_Network_Getdetail_Input().nodeNetworkDetails().nodeE_Network().getE_NetworkElementAt(i).getPlanned_Cost());
    sorry if this is totally wrong. I'm totally a newbie here.
    Hoping for your kind and helpful responses.
    Cheers,
    Alfonso

    Hi Alfonso,
    Can you please try this code:
           IWDMessageManager manager = wdComponentAPI.getMessageManager();
             try
               BigDecimal plannedCost = new BigDecimal(0);
               // Initializing a IWDNode to make code more readable and clean
               IWDNode nodeEx_Networks = wdContext.nodeZps_Fm_Get_Network_Num_Input().nodeNetworks().nodeEx_Networks();
               // I have initialized the int variable because you should never calculate the size() in for loop.
               // It is major performance hit.
               int size = nodeEx_Networks.size();
               for (int i=0; i<size; i++) {
                   wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Network(false);
                   wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Network_Activity(true);
                   wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Relation(true);
                   wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Activity_Element(true);
                   wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Activity_Milestone(true);
                   wdContext.currentBapi_Network_Getdetail_InputElement().setI_Without_Component(true);
                   wdContext.currentBapi_Network_Getdetail_InputElement().setNumber(nodeEx_Networks.getEx_NetworksElementAt(i).getAufnr());
                   wdContext.currentBapi_Network_Getdetail_InputElement().modelObject().execute();
                   // WHY IS THIS INVALIDATE DONE.. WHICH IS THIS NODE???
                   wdContext.nodeNetworkDetails().invalidate();
                IWDNode nodeE_Network = wdContext.nodeBapi_Network_Getdetail_Input().nodeNetworkDetails().nodeE_Network();
                  int sizeNetwork_Getdetail = nodeE_Network.size();
                  for (int i = 0; i < sizeNetwork_Getdetail; i++) {
                       plannedCost.add(nodeE_Network.getE_NetworkElementAt(i).getPlanned_Cost());
                  // Now you can check the plannedCost by printing it using the manager you have initialized above.
    I hope this solves your issue. If you have any further issue please revert back.
    Thanks and Regards
    Pravesh

  • Calling multiple DLL from Java and calling same native method

    i have two dll files named DLL_1.dll and DLL_2.dll .
    Both of them contain a native method which has a signature
    JNIEXPORT void JNICALL Java_Database_Notify
    (JNIEnv *, jclass);
    This method is common to both the DLL
    Now i load both of the DLL's using,
    System.loadLibrary("DLL_1");
    System.loadLibrary("DLL_2");
    Both of the DLL are loaded form same Java Application
    But the problem is that , whenever i try to call the Notify Method , it calls the Notify method of DLL_1 only.
    How do i call the Notify Methos of second DLL(i.e DLL_2).
    Is there any reference that i can get to all the DLL files when i load then , so that i can use that reference to invoke the Notify method of that particular DLL.

    i have two dll files named DLL_1.dll and DLL_2.dll .
    Both of them contain a native method which has a
    signature
    JNIEXPORT void JNICALL Java_Database_Notify
    (JNIEnv *, jclass);
    This method is common to both the DLL
    Now i load both of the DLL's using,
    System.loadLibrary("DLL_1");
    System.loadLibrary("DLL_2");
    Both of the DLL are loaded form same Java
    Application
    But the problem is that , whenever i try to call the
    Notify Method , it calls the Notify method of DLL_1
    only.
    How do i call the Notify Methos of second DLL(i.e
    DLL_2).
    Is there any reference that i can get to all the DLL
    files when i load then , so that i can use that
    reference to invoke the Notify method of that
    particular DLL.You need to explain exactly what you are trying to achieve.
    As per the description above it is impossible in java.
    And I didn't say JNI, I said java.
    Your above statement suggests that you think that you can have exactly the same java signature do two different things.
    Note again that I said java not JNI.
    A JNI method is just a tag that represents a java signature. Your description suggests that you are attempting to do it twice.
    There are three possibilities.
    1. Your explanation is incomplete.
    2. You are trying to do something that is impossible in java.
    3. You are trying to solve a problem and your description of your solution is not sufficient to determine what that is (and of course the solution is wrong.)

  • Dequeue not happenning From Java after upgrading to 10G from 8i

    Hi,
    After the application is upgraded to Oracle 10.1.0 the java/jms clients are not dequeuing the messages. Strange thing is they are running fine and doing nothing.
    Also ernqueue happenned successfully from one of the java proc and they are not bieng dequeued and proceeded for the next queues.
    Anybody, any help.

    Check if...
    1. You are using Browse or Remove mode??
    2. After dequeue, Are the messages getting removed from the queue. If not....
    3. Have you by any chance set the retaintion time, that too, a long one.
    4. Can it be that the messages are getting dequeued successfully but you are not storing them [or printing them just to check] after you receive them.
    Check.....coz I do not think there should be a problem if it is not giving any error message.
    Sanju.

  • Batch file from java class fails to copy from mapped drive

    I've some problem for a bacth file which XCOPY several files from folder to folder. If the source folder is a mapped network drive and I run the batch it works.
    But it fails with this error "Invalid drive specification" if I run it from within the java class. Everything is correct from the BATCH point of view as it works when I run it directly.
    I use Process p = Runtime.getRuntime().exec(command);where command is: "cmd /c C:\\just_for_test.bat".
    The batch file is:
    XCOPY /E G:\tmp\CD0005_Multi\*.* C:\Temp
    RD /S /Q G:\tmp\CD0005_Multi
    EXIT
    where G: is the mapped drive.
    Any ideas?
    Thanks.

    I used a batch-file to copy the specified files that looked like this in the end:
    net use s: \\192.168.200.7\e$ <passw> /USER:administrator
    s:
    COPY "S:\Temp\xxx.txt" "C:\Temp\xxx.txt"
    c:
    net use s: /deleteWhat happens is that i make a new mapped-connection to the harddrive
    and ending it after the copying-process is finished... Simple thingie.
    But, if you still want to copy the files through your program, do this:
    net use s: \\192.168.200.7\e$ <passw> /USER:administrator
    s:
    java myProgram
    c:
    net use s: /delete

  • How to call a Oracle Proc,which contains Object Type as in Param, from java

    Hi
    Would like to know how to call a Oracle Procedure which contains the Object Type Parameter from java.
    Here is my code will look like...
    1. CREATE OR REPLACE TYPE emp AS OBJECT
    Empno NUMBER,
    Ename VARCHAR2(50)
    [COLOR=royalblue]In step1 I have created object type.[COLOR]
    2.CREATE OR REPLACE PACKAGE ref_pkg IS
    TYPE tab_emp IS TABLE OF emp;
    END ref_pkg;
    [COLOR=royalblue]In step2,I have created a table type which is of type emp;[COLOR]
    3. CREATE OR REPLACE PROCEDURE p_emp(p_emptab IN ref_pkg.tab_emp) as
    BEGIN
    FOR I IN 1..p_emptab.COUNT
    LOOP
    Some code written here
    END LOOP;
    END;
    [COLOR=royalblue]In step3 I have passed tabletype which is of type emp as argument.[COLOR]
    Now I need to invoke this procedure from JAVA.
    Calling a procedure doesn�t matter.
    But how I can map objecttype ? how will java recognize oracle object ?
    How can I implement this ?
    Any Help/Clues is Appreciated.
    Thanks
    Krishna

    Hi Bob
    You can call a stored proc from a database control with the jc:sql annotation itself.
    Assume a stored proc taking one In parameter
    * @jc:sql statement="call sp_updateData({id})"
    void call_sp_updateCust(int id);
    You can even call stored proc with OUT parameters using
    * @jc:sql statement="{call sp_MyProc(?, ?)}"
    void call_sp_MyProc(SQLParameter[] params)
    You can also call stored functions via db control.
    More info and diff ways to call at
    http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
    Thanks
    Vimala

  • Call report from java with deployment of java web start

    I need call report from java,the call function is:execURL ( String pURL )
    pURL is a url link to call report from report services .
    such as :http://10.20.1.43:8888/reports/rwservlet?destype=cache&desformat=PDF&report=test.rdf&user=scott/tiger@cims
    public static void execURL ( String pURL )
    String tempstr = new String();
    int posIdx = 0;
    if ( (System.getProperty("os.name").equals("Windows NT"))||
    (System.getProperty("os.name").equals("Windows 2000")) )
    posIdx = pURL.indexOf("&");
    while ( posIdx > 0 )
    tempstr = pURL.substring(0,posIdx)+"^"+pURL.substring(posIdx);
    pURL = tempstr;
    posIdx = pURL.indexOf("&",posIdx+2);
    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());
    It's run with no problem with deployment of simple jar.
    But when i call report with deployment of java web start,it can not.
    I think it's java secuity problem,so i add
    Permission java.io.FilePermission "c://winnt//system32//cmd.exe", "execute";
    in java.policy file in client(windows 20000).However ,it can not too.
    Who can help me,Thanks in Advance!

    David,
    In your code, 'cmd' is invoked as Runtime.getRuntime().exec("cmd /c start "+pURL);
    but in your policy file you specify
    Permission java.io.FilePermission "c://winnt//system32//cmd.exe", "execute";
    Before creating a new process, the security manager checks for FilePermission(cmd,"execute")
    if cmd is an absolute path, otherwise it calls checkPermission with
    FilePermission("<<ALL FILES>>","execute"). Try specifying
    FilePermission("<<ALL FILES>>","execute") in your policy file.
    But, I believe using exec, may not be the right solution as it may not work on
    other platforms. Also you will have to expect the client m/c to relax security
    permission.
    Did you consider using java.net.HttpUrlConnection class instead to access the report
    service URL?
    HTH,
    Sathish.

  • Open Word From Java

    Hi all,
    Can we open word from java.
    It is possible from VB to do it, bit is it possible from Java.
    Thanks in advance for your help.
    Best regards.
    Saadi MONLA

    Probably have to do it using Runtime.exec() and call the word exe in the seperate process.
    Note that word will be opened in a seperate OS thread and you will not be able to refer to it from your Java Application.

  • How to set iframe src from java dynammically

    Hi,
    Iam calling a servlet from jsp and servlet calls the databse query and returns the value,
    in my jsp i have ifrme, i want to change the source of iframe from java depends on the result from database , and the result must display on the iframe can any one tell me how to do this

    aurelian_cl wrote:
    I need to know how to set environment variables from java
    I want to set from java for example the environment variable "TestVar" with the value "TestValue"!1) That functionality does not belong in an application. You're trying to set environment variables, which are global across all applications, at either the user level as a whole, or across the entire machine (system level). Or, if you're only trying to set a variable active for the current process, you don't need to do that.
    2) Environment variables are not a platform-independent entity, and are thus against the nature of Java.
    My gut feel is that you are designing something in a backwards way, so my point is mainly to point that out, not to try to help you solve that particular problem.

  • Invoke soa 11g process from java

    I want to invoke soa 11g process from java.
    I got reference from following link, but the metioned jar files are not present in the soa suite. could you please let me know if I am using the correct version of soa suite.
    Installed soa suite : ofm_soa_generic_11.1.1.2.0
    files required :
    1. fabric-common.jar located at
    $SOA_HOME\Oracle_SOA1\modules\oracle.fabriccommon_11.1.1
    2. soa-infra-mgmt.jar located at
    $SOA_HOME\Oracle_SOA1\modules\oracle.soa.mgmt_11.1.1
    3. wsclient_extended.jar located at
    $SOA_HOME\Oracle_SOA1\webservices
    4. weblogic.jar or wlfullclient.jar
    Regards,
    Sanjay

    Hi,
    Do you have any idea on invoking soa 11g bpel process thats running on remote system.
    I referred following url but its giving an connection errorerror.
    http://biemond.blogspot.com/2009/11/invoking-soa-suite-11g-service-from.html
    I am getting following exception when calling from standalone java class from Jdeveloper.
    javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://remoteserver:8001/soa-infra: Destination unreachable; nested exception is:
         java.net.ConnectException: Connection timed out: connect; No available router to destination]
    Here is the simiple prog that I tried :
    private void invokeBpelProc() {
    Hashtable jndiProps = new Hashtable();
    jndiProps.put(Context.PROVIDER_URL, "t3://remote_server:8001/soa-infra");
    //jndiProps.put(Context.PROVIDER_URL, "t3://localhost:7001");
    jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");
    jndiProps.put(Context.SECURITY_CREDENTIALS, "weblogic1");
    jndiProps.put("dedicated.connection", "true");
    Locator locator = null;
    try { 
    // connect to the soa server
    locator = LocatorFactory.createLocator(jndiProps);
    System.out.println("Created locator");
    }catch(Exception ex){
    ex.printStackTrace();
    Regards,
    Sanjay

  • Parse errors while creating a Web service from Java class!

    Can anybody tell me please, is it possible to create a Web Service from java class where the input from user is required ?
    I have the following program, which is successfully compiled, but when I'm trying to make a web service in JDeveloper, the following error occurs:
    "Validation failed.
    The implementation class primePackage.isPrime ofport type MyWebService contains parse errors."
    import java.io.*;
    import java.util.*;
    class isPrime
    public static void main (String args[])
    Scanner reader = new Scanner(System.in);
    int n;
    System.out.println ("Enter a number you want to know is it prime or not");
    n=reader.nextInt();
    if (isPrime(n))
    System.out.println ("True");
    else
    System.out.println ("False");
    static boolean isPrime (int n)
    int i=2;
    while (i<=n-1)
    if (n%i==0)
    return false;
    i++;
    return true;
    }

    Hi,
    Can anybody tell me please, is it possible to create
    a Web Service from java class where the input from
    user is required ?Yes, the parameters of your method will be mapped in WSDL.
    But i've some considerations about your code.
    I suggest you change the name of isPrime do Prime, its a good code convention to put the name of class starting with Upper case. and isn't good the name of class equals to name of method.
    I suggest you to change the "static boolean isPrime (int n)" to "public boolean isPrime(int n)" to publish a method as a WebService method it's must be public and not static. After this change try to generate your Web Service.
    Regards.

  • Not able to access CD file system from java (or how to)

    I am trying to access CDROM from java
    program that is running from my HD. I am
    accessing as d:\data\ (d: = my cd rom drive)
    I am using windows 2000 and jdk1.4. I am getting
    java.io.IOException - Access denies.. any pointers please..
    - Ravi

    Hi friends,
    i want to develop an online exam application.
    but i am not having any idea how to access CDROM databse from java programe????
    Any help ???
    Thanks in advance
    Navik Pathak

  • How to kill a system process from java code.

    Hi,
    i need to kill or remove windows system process like cmd.exe from java code.
    like removing it from end process in task mgr.
    i tried below code but its not removed.
    is there a better way we can do this.
    killing a system process from java code will create any issues?
       public static void main(String[] args) throws Exception {
       String[] cmd = { "cmd.exe" };
       Process p = Runtime.getRuntime().exec(cmd);
       p.destroy();
    any suggestions or ideas are really appreciated.
    thanks.

    Hi  jtahlborn, mohan
    yes the process is created from my java code. 
    in my code iam creating a process like below and if it is running for a long i need to kill it from java.
    For that " Runtime.getRuntime().exec("taskkill /F /PID " +  7408); " is working fine.
    7408 is my process id in taskmgr created from java and iam manually passing the PID it to kill it.
    But i need to get the PID from java code.
    Thanks for your suggestions.
    Sample Code:
    public static void main(String args[])
            try {
              Process process = Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start"});        
              Field f = process.getClass().getDeclaredField( "handle");
              f.setAccessible( true);         
              long procHandle = f.getLong( process);
              System.out.println( "prochandle: " + procHandle );
              //Runtime.getRuntime().exec("taskkill /F /PID " +  procHandle);
            } catch( Exception e) {
              e.printStackTrace();

Maybe you are looking for