Helps!:How to start multi process in a single java program?

I wanna to test the querying performance of a Database
connection poll,and here,not only multi threads,but also multi process I need to start in the same java program cause i have only one PC available.....
Does that possible?

In pure java this is not possible.
A java program with all its thread run in a single
jvm,
which is just one process.However, you can have multiple instances of the jvm, I've done it w/ I needed to test some row locking in my database app. If you are in windows and want 3 copies of you program just make a bat file that looks likejavaw.exe -classpath "classesGoHere" MainClass
javaw.exe -classpath "classesGoHere" MainClass
javaw.exe -classpath "classesGoHere" MainClassThat will create 3 instances of the jvm and thus three instances of your application. I'm sure the same can be done on multiple platforms.
Peter

Similar Messages

  • How to start a browser from within a java program?

    I want to make a help file for my java program and want to run the browser from the menu of my program.
    How can I start my browser from my program?
    A small code will be helpful.
    Thanks.
    Niteen

    This should work on Windows without having to know where the browser is located. See http://www.javaworld.com/javaworld/javatips/jw-javatip66.html for more details
      public static void viewHtml(URL url, boolean fixHtmlExtension){
          String cmd = "rundll32 url.dll,FileProtocolHandler " + url.toExternalForm();
          if (fixHtmlExtension){
            //There is a bug in rundll32. For http requests, it doesn't like .html or .htm extensions,
            //but replacing the 'm' with '%6D' works. 
            //This fix is not needed for file requests.
            if (cmd.endsWith(".htm")){
              cmd = cmd.substring(0,cmd.length()-1) + "%6D";
            else if (cmd.endsWith(".html")){
              cmd = cmd.substring(0,cmd.length()-2) + "%6Dl";
          Process process = Runtime.getRuntime().exec(cmd);
          try{
            process.waitFor();
          catch(InterruptedException e){

  • How to get the process id of a java program

    Hi,
    I know this has been discussed before. But I could not find an answer. So, I'm putting it again.
    How can I find out the PID of an application (I know the name of the application) on any OS?
    Regards.

    1) Use JNI ( http://www.esus.com/docs/GetQuestionPage.jsp?uid=1766 )
    Something like
    JNIEXPORT jint JNICALL Java_Pid_getPid(JNIEnv *env, jobject object) {
    return (int) GetCurrentProcessId();
    2) In JDK 1.5, you can use the java.lang.management API, at least on Windows, to find out the process ID.
    http://www.esus.com/docs/GetQuestionPage.jsp?uid=1796
    http://www.esus.com/docs/GetQuestionPage.jsp?uid=1766

  • How to start GP Process

    Hi.
    I created GP Process followed by tutorials but I don't know how to start this process.
    I read document and I knew start this GP process in GP Runtime.
    Is there other way to start GP Process ?
    (I don't want to use GP Runtime for starting GP Process)
    Regards, Arnold.

    Hi Arnold,
    you can find more information about GP APIs for starting a process in GP here:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/43/fcdf77fc6510b3e10000000a11466f/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/43/fcdf77fc6510b3e10000000a11466f/frameset.htm</a>
    For more details about APIs in general you can check the following link:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/43/dc00ba806b4176e10000000a11466f/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/43/dc00ba806b4176e10000000a11466f/frameset.htm</a>
    Regards, Petja

  • How to start/stop process flow from sql*plus?

    Hi,
    i know how to start a process flow via sqlplus_exec_template.sql, but i cannot find any information on how to stop (and rollback) a working flow from sql*plus. Any help would be appreciated.
    Greetings
    Christoph
    Message was edited by:
    ctrierweiler

    Hi,
    I've had a go.
    How should I interpret the results of list_requests:
    owner_owr@ORKDEV01> @list_requests
    ====================
    DEPLOYMENTS
    ====================
    Audit ID Status Name Date Owner
    2706 READY Deployment Fri Nov 11-NOV-05 10:49:59 OWNER_OWR
    11 10:46:37 CET 2
    005
    ====================
    DEPLOYMENT UNITS
    ====================
    Audit ID Status Name Date Owner
    2707 READY Unit0 11-NOV-05 10:49:59 OWNER_OWR
    ====================
    EXECUTIONS
    ====================
    Er zijn geen rijen geselecteerd.
    owner_owr@ORKDEV01>
    Whilst a process flow is executing the last query will list executions, all of which have status BUSY:
    owner_owr@ORKDEV01> @list_requests
    ====================
    DEPLOYMENTS
    ====================
    Audit ID Status Name Date Owner
    2706 READY Deployment Fri Nov 11-NOV-05 10:49:59 OWNER_OWR
    11 10:46:37 CET 2
    005
    ====================
    DEPLOYMENT UNITS
    ====================
    Audit ID Status Name Date Owner
    2707 READY Unit0 11-NOV-05 10:49:59 OWNER_OWR
    ====================
    EXECUTIONS
    ====================
    Audit ID Status Name Date Owner
    394512 BUSY PF_ONB01 04-MEI-06 09:11:12 OWNER_OWX
    395328 BUSY ONB:FULL_PREPARE 04-MEI-06 09:11:55 OWNER_OWR
    395324 BUSY PF_ONB01:ONB 04-MEI-06 09:11:55 OWNER_OWR
    owner_owr@ORKDEV01>
    As an aside, I will attempt to get rid of the READY deployment and deployment unit using deactive_deployment.sql
    Now, if I attempt to use deactivate_execution.sql on any of the executions with status BUSY I get:
    owner_owr@ORKDEV01> @deactivate_execution
    Voer waarde voor 1 in: 396136
    declare
    FOUT in regel 1:
    .ORA-20003: The object is not in a valid state for the requested operation
    ORA-06512: at "OWNER_OWR.WB_RTI_EXCEPTIONS", line 94
    ORA-06512: at "OWNER_OWR.WB_RTI_EXECUTION", line 774
    ORA-06512: at "OWNER_OWR.WB_RT_EXECUTION", line 90
    ORA-06512: at line 4
    owner_owr@ORKDEV01>
    So all the seems to remain is to use abort_exec_request.sql
    This does the job, but the script itself hangs.
    I think it has to do with the l_stream_id not being checked again after the initial IF. I think it should probably be part of the loop condition as it is again reset in the do_acks inside the loop.
    Cheers & thanks,
    Colin

  • How to start the process.

    I'm using CE 7.3 for BPM.
    I would like to start process from simple menu not using Process Repository.
    Does anyone know hot to start BPM process form menu ?
    Do I have to develop webDynro applicatin that calls web-services for staring the process ?
    Best regards,
    Koji Nagai

    Thank you for your reply.
    I understand how to start BPM process by using BPM API.
    But in my project, we need to minimize the developed objects.
    To use BPM API means to develope programs right ?
    If possible, I would to start BPM process without developing programs.
    Is there any way to start BPM process from menu without add-on programs.
    Best regards,
    Koji Nagai

  • How to start a process

    The process can be started from gobal creation activity in BPM 10g. I create an ADF or Java client application which can show the information of processes.
    How to start a process from java? For example, a user can click a button and then, one or more processes can be started.
    createProcessInstance in ADF is striked.
    Thanks a lot.

    Yes, I use PAPI in ADF and check the document in the web. But the code likes following is striked by jdeveloper 10g.
    session.createProcessInstance(processId, arguments)
    What I want to know is the code snippet which replaces "session.createProcessInstance(processId, arguments)"
    Then, the user can start new instance from an ADF application (with PAPI code).

  • How to display a oracle table from a java program?

    How to display a oracle table from a java program.
    Hello friends, I have written a Java program, using oracle 10g as backend.
    I want to display a oracle table as output. Im not getting how to display oracle table as a output table.. Pls help me
    Thank you

    jayanthds, you're not going to get a satisfactory
    answer to this here. it's too big a task to justbe
    quickly outlined in a forum - the reply "all youneed
    to do is to query you table and return it asJTable"
    is worthless, for example, since the solution to
    any problem can be distilled to such a
    soundbite, if need be. doesn't make the solutionany
    simpler
    essentially you're asking "how do I write adatabase
    application?". all you'll get is snippets of code
    that, when fitted together, will eventually helpyou
    do this, but you'll spend days and days comingback
    saying "right, I've done that, now what?" until
    either you or the forum gets frustrated with the
    whole affair and the process stops
    there are entire books written about this subject,
    and countless tutorials and guides on theinternet.
    you're better off going down that routehehehe.well, it's true! I used to have a manager that would outline the solution to a problem in a few lines of pseudocode, and then firmly believe that the actual solution would be just as brief and simple. shame his pseudocode included such lofty abstractions as "reformat all data"

  • How to call j2me emulator instance from a java program?

    hi,
    how to call j2me emulator instance from a java program?
    i tried public void startApp(){
    try{
    platformRequest("tel:+5550000");
    }catch(Exception e){
    e.printStackTrace();
    from a j2me midlet itself,
    but it gave illegal access exception.
    do i need any hardware phone connected to my pc?
    please help.

    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    import java.util.*;
    public class OpenExplorer{
    public static void main(String args[]){
         new OpenExplorer();
    public OpenExplorer(){
         try{
         String command = "explorer C:";
         // or String command = "cmd /c explorer C:";
         Runtime runtime = Runtime.getRuntime();
         Process process = runtime.exec(command);
         int exitVal = process.waitFor();
         System.out.println("Exit Value: " + exitVal);
         } catch(Exception e){
         e.printStackTrace();
    }

  • How to call two RFC in a single JAVA method.

    Dear all,
    I just want to know that how to call two RFC in a single java method which is defined in CRM implementation file. I'm using NWDS as the customization IDE & working on ISA 7.0.

    Hi Sunil,
    In the Backend Implementation class, in any method you can call multiple RFCs.
    It will be the same way as you do for the single RFC call.
    Following syntax is for your reference.
    Get the JCO connection
    JCoConnection  connection = getDefaultJCoConnection();
    JCO.Function func = connection.getJCoFunction("ZXXXXXXX");
    set the import parameters
    Execute it.
    connection.execute(func);
    get the data from export / table parameters
    Now call the second RFC
    func = connection.getJCoFunction("ZYYYYYYYYYY");
    set the import parameters
    Execute it.
    get the data from export / table parameters
    close the connection
    Hope this will help you.
    -Chandra.
    Edited by: Chandra Sekhar Seeli on Jan 13, 2011 2:04 PM

  • How to run a openssl command from a java program

    Hi All
    Please suggest on how to run a openssl command from a java program.
    I am using this
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("openssl pkcs8 -inform der -nocrypt test.der result.pem");
    This is suppose to take test.der as input and create result.pem.
    There are no errors but the file result.pem isnt created.
    Thanks in Advance

    First off is that openssl command correct? Should it be this instead:
    openssl pkcs8 -inform der -nocrypt -in test.der -out result.pem
    Try out your openssl command within a command prompt so that you know that it works ok. I think the command line you specified waits on stdin (well it does for me).
    After that.....
    runtime.exec creates a Process object. If you do this:
    Process openssl = runtime.exec("....")
    then you can examine the return code from openssl to see the exit code - for instance if the input file does not exist then exit = 1. You can test for this with Java
    Alternatively you could get the stderr from the process and look inside it - if it is 0 length then all is good, if it has some text in there then it has likely failed. You could then throw an exception and include the stderr output in the exception messgae. You may need to experiment with this, runnig it first when openssl is happy then running it again when openssl is upset.
    M

  • How to extract .sit files(in MAC)  using java program

    Hi,
    please help me , i want to simple program for
    " how to extract .sit files(in MAC) using java program"
    that sit files same as zip files in windows..[                                                                                                                                                                                                                                                                                                                                   

    Thanks for reply...
    but i search in the google about this topic...there is no results will appear..
    the problem is "i have to run program in the MacOS like extract all the
    .sit(StuffIt) extension files. These sit files same as zip files in the windows... we have one tool called StuffIt Expander but it is 3rd party tool. but here requirement is i have to write my own program to extract all the files same as zip file program...
    please do the needful..i am waiting for ur reply,,,

  • How to run an exe file in a java program

    Hi,
    Can somebody tell me how to run an exe file in a java program.
    Thank you!

    Yes, java.lang.Runtime.exec().
    Read this carefully before you do:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    Don't write a line of code before you're reviewed and understood the article completely. - MOD

  • How to request Administrator or root to execute java programs?

    How to request Administrator or root to execute java programs when the user is not enough permission?
    as same as following image:
    Windows : http://img151.imageshack.us/img151/6113/winrw5.gif
    Linux: http://img374.imageshack.us/img374/8990/linuxsj4.png
    Edited by: lauangus on 2008?10?13? ??9:15

    Dear Sys Admin,
    Would you please grant me and my group enough rights to do the tasks that have been assigned to us, we are using the following programs. They will need to asccess....
    Sincerely,
    lauangus
    Note: this will usually have to be accompanied by appropriate supervisor signatures and endorsements.

  • How to start BPM Process in Netweaver CE 7.1 from backend

    Hi,
    since 2 Month i am trying to use SAP Netweaver CE 7.1 EHP1. I found a lot about modelling of business process with process composer.
    In my company we are often using SAP Standard Programs/transaktions, thats why I want to start a SAP Netweaver BPM Process from SAP Backend. I think there are more than one way. May be someone can tel me one easy way.
    The following systems are available in my Landascape:
    - PI 7.1
    - ERP 2005
    - CE 7.1 EHP1 with ESR
    Does someone have an idea how to start the BPM Process or how to trigger start event from Backend?
    Greetings,
    Manuel

    Hi,
    Netweaver BPM process can be started in two ways:
    1. Using NWA by instantiating a process
    2. Using a Web service which trigers the Start event of the Business Process. You may find this useful:
    /people/arafat.farooqui/blog/2009/08/13/introduction-to-sap-netweaver-bpm-part-4
    Hope this helps!!
    Regards,
    Arafat

Maybe you are looking for

  • Wireless not working in linux, but works fine in windows vista

    Hello! I have installed Unbreakable Enterprise Linux 4 in a dual boot config. with Window Vista on a Compaq Presario laptop. After install completed I found that my on board Broadcom Wireless Adapter (Dell 1390 Mini PC card) was not recognized. I hav

  • Java applet not showing up in Internet Explorer 8

    Hi, I have an applet tag in a JSP, and it is not working in Internet Explorer 7 and 8. Yes, I have read that the applet tag was deprecated - the problem is that it is working for my colleague, also in IE8. Java is enabled on my machine/IE options. Co

  • Import FT Wizard - where's the imported site?

    I downloaded the Import Front Page Site Wizard for Dreamweaver MX 2004 and then walked through the wizard to import my FP site. When I restart DW8, I get a message that the FP site has been added, but I don't see it anywhere. What gives?

  • Video Card effecting output?

    Does the video car in a computer have anything to do with the quality of the video files Premiere Pro or Encore write to an internal Blu-Ray burner? I can certaily see how the card impacts monitors and such but can it do anything to the actual files

  • HELP!! Macbook won't sleep/hibernate

    This is a Macbook (Intel Core Duo) purchased in August of 06. I'm new to Macs and don't know how to troubleshoot them. I need to find a solution for this problem! Problem: At times my bluetooth is working fine, but MOST of the time it says Bluetooth: