Join running JVM

My program is win32 EXE written in C++.
It calls java method through JNI.
Now I must create and start new JVM each time the exe is started.
Is it possible to find and join JVM that is already running?

When your code starts up it creates a thread which tries to connect via a socket server to the local host using a fixed port (like 53999.) It waits for messages (commands) and executes those messages.
If it fails it means that it is already running, so it can then create a regular socket and connect to it. Then it sends requests to the orginal one.

Similar Messages

  • Code to perform a manual GC for running JVM

    Hi,
    Can anyone share the code to connect to a running JVM and perform a manual garbage collection when the heap size goes beyond say 1.2GB or so.
    thanks
    vbe

    vbejava wrote:
    Fine, agreed. but "may not be" can be some time "may be" rite!!! so whenever possible let it do that !!
    As of now, I have configured an OEM alert which will send an email whenever the Heap Size goes beyond 1.3GB. Then I use the button "Perform GC" in the jconsole which help in reducing the Heap Size and there by avoiding OutOfMemory error.
    All I want is to do this "Perform GC" used by jconsole, using a java code. The java code should connect to a running JVM, check the Heap Size every 5minutes or so, and perform GC
    Is there a code which can perform this?
    thanks,
    vbeDon't bother. The gc is guaranteed to have run before an OutOfMemory error is thrown.

  • Running JVM in Linux with execl

    Why if I run JVM under Linux and with execl the first argument is lost?
    For example if I want to run java -version I have to do:
    execl("/usr/lib/java5/bin/java","nothing","-version");
    If I do execl("/usr/lib/java5/bin/java","-version"); it doesn't works and appears the help message that appears when you are wrong with the parameters.
    This is an innocent thing when you know it, but that has caused me a lot of headaches and debug time and now I'm curios about it ;)
    PD: I use jdk-1_5_0_01 and Suse 9.1
    A lot of thanks in advance,

    /* a.c */
    #include <stdio.h>
    #include <stdlib.h>
    int main() {
    int r=execl("./b","nothing","-version",NULL);
    printf("%d\n",r);
    /* b.c */
    #include <stdio.h>
    int main(int argc,char *argv[]) {
    int i;
            for(i=0;i<argc;i++) printf("%d %s\n",i,argv);
    $ gcc a.c -o a
    $ gcc b.c- o b
    $ ./a
    0 nothing
    1 -version

  • How can I  re-use a running JVM ?

    HI All:
    I am interested in finding about how to re-utilize the capabilities of a running VM. The problem I am into involves writing a java-based command-line interface. Each command is of the following format :
    runapp <sub-command>
    The "runapp" command should check if there is a running JVM. If not it should start a new one. If there is one already then it should re-use its capability for executing the "sub-command". Each of the sub-commands are in the same namespace.
    How can the VM be tuned such that it does not shut down after the first invocation ?
    All suggestions are welcomed.
    Mankalkaji

    HI All:
    I am interested in finding about how to re-utilize the
    capabilities of a running VM. The problem I am into
    involves writing a java-based command-line interface.
    Each command is of the following format :You are writing a shell in java. Then by definition there will always be a running JVM because that is what the shell runs in.
    >
    runapp <sub-command>
    The "runapp" command should check if there is a
    running JVM. If not it should start a new one. If
    there is one already then it should re-use its
    capability for executing the "sub-command". Each of
    the sub-commands are in the same namespace. Doubt it. You could certainly write a server. And it accepts commands and runs them. However, it is going to need to know what the commands are and how to load them/run them. And they can't interact with any other commands. If you constrain it to that then you can do it (you would have to use a socket to check if it is already running.)
    But if you can't constrain it then it won't work.
    >
    How can the VM be tuned such that it does not shut
    down after the first invocation ?
    It can't. If the JVM is out of work (all non-daemon threads exit) then it stops. And if something calls System.exit() then it will end regardless.
    You can of course create a thread that does nothing but spin and that would prevent that problem.

  • Enable remote debugging in a running JVM

    Is it possible to debug an application, which is already running in the server without restarting. If so how? if not what is the reason?
    steps:
    1. run the application in the server with out adding the debugging arguments.
    2. once server is up, debug the application.
    Thanks!!

    yes, i believe it is possible. it's kind of obscure information, but it is basically similar to the ability of jvisualvm to dynamically attach to running java processes (in later versions of the jdk). this is enabled via some platform specific means of communication which dynamically starts the remote jmx agent within the running jvm (the last bit being the part that is relevant to your question). i don't know off-hand what incantations are necessary, but google should be able to find something about dynamically starting agents in running java vms.
    sure enough (and it seems to be related to the Attach API, which is what jvisualvm uses): http://osi.fotap.org/2008/06/27/dynamically-installing-agents-in-java-6/
    Edited by: jtahlborn on Nov 6, 2010 9:33 AM

  • How to check bit mode of running JVM

    HI experts,
    i am using JNI which are 64 bit . libraries looks well at their proper place.
    but stll i m facing error
    [java.lang.UnsatisfiedLinkError: /xxx/xxx/xxx/xxx/native_bin/mylib.so: ld.so.1: java: fatal: /xxx/xxx/xxx/xxx/native_bin/mylib.so: wrong ELF class: ELFCLASS64]]
    i want to confirm about bit mode of running JVM as it should be 64 bit.
    i m using solaris 9. can any body tell how to check running JVM bit mode that is (wheather it is 32 bit or 64 bit)
    thanx

    HI experts,
    i am using JNI which are 64 bit . libraries looks well at their proper place.
    but stll i m facing error
    [java.lang.UnsatisfiedLinkError: /xxx/xxx/xxx/xxx/native_bin/mylib.so: ld.so.1: java: fatal: /xxx/xxx/xxx/xxx/native_bin/mylib.so: wrong ELF class: ELFCLASS64]]
    i want to confirm about bit mode of running JVM as it should be 64 bit.
    i m using solaris 9. can any body tell how to check running JVM bit mode that is (wheather it is 32 bit or 64 bit)
    thanx

  • Forcing the use of a currently-running JVM

    Hi there.
    I am writing a Java application. Now, due to the (relatively) slow startup times of Java apps, I would like to enable my app to startup when the user's OS loads, but in the background (i.e. no GUI). Then, when the user double-clicks the icon to actually run my app, the background instance becomes visible and the user doesn't need to wait.
    My problem is that when the user double-clicks to run my app, a new JVM instance is started... which can't access the state info, threads etc. held in the JVM that contains my hidden app. I need a way to force my shortcut to use the currently-running JVM.
    I think this will require some dipping into native code to access the already-running JVM process, but I'd prefer not to do that. So, can anyone help me out here?
    (The above is a bit incoherent, I know. If it's not clear then please ask and I will try to clarify.)

    It's going to either:
    1. Require native code
    2. Require that you launch another JVM, at least temporarily
    Either way, you can have your Java app listen on a pre-determined port number, and your native (or Java app), when launched, attempts to send a special message to that port. When received, the application can show itself.
    If you want the double click to be on the exact same icon, then you are going to have to do #2, which means that you are going to be loading a new JVM - at least temporarily. If the time you are worried about is how long it takes the JVM to start, then that's not going to work. If the startup time is long because of things that your app is doing, then it will work.
    - K

  • Error on running JVM from a C program

    Hello there!!
    I'm using Open Watcom as a C compiler on Windows XP. I'm trying to run a JVM from a C program.
    I have specified the following as a library file :
    C:\Java\jdk1.5.0_04\lib\jvm.lib
    The code compiles very well, but I'm getting an error when running it.
    Windows tells me the following :
    "The entry point of the function ??_7VM_GetCurrentLocation@@6B@ can't be found in jvm.dll dynamic linking library"
    The code I've been trying to run is the following one :
    #include <jni.h>
    #include <stdio.h>
    #include <stdlib.h>
    void main()
    JavaVMOption options[3];
    JavaVMInitArgs vm_args;
    JavaVM *jvm;
    JNIEnv *jenv;
    long result;
    jmethodID mid;
    jfieldID fid;
    jobject jobj;
    jclass cls;
    int asize;
    printf("coucou\n");
    getchar();
    options[0].optionString = ".";
    options[1].optionString = "-Djava.compiler=NONE";
    options[2].optionString = "-verbose:jni";
    vm_args.version = JNI_VERSION_1_2;
    vm_args.options = options;
    vm_args.nOptions = 3;
    vm_args.ignoreUnrecognized = JNI_FALSE;
    JNI_GetDefaultJavaVMInitArgs(&vm_args);
    result = JNI_CreateJavaVM(&jvm,(void **)&jenv, &vm_args);
    /* if(result == JNI_ERR )
    printf("Error invoking the JVM");
    exit (-1);
    cls = (*jenv)->FindClass(jenv,"C:\Formation\Joly\FromCtoJava\WATCOM\samples\ide\win32\FromCtoJava");
    /* if( cls == NULL )
    printf("can't find class FromCtoJava\n");
    exit (-1);
    (*jenv)->ExceptionClear(jenv);
    mid=(*jenv)->GetMethodID(jenv, cls, "<init>", "()V");
    jobj=(*jenv)->NewObject(jenv, cls, mid);
    fid=(*jenv)->GetFieldID(jenv, cls, "arraySize", "I");
    asize=(*jenv)->GetIntField(jenv, jobj, fid);
    printf("size of array is %d",asize);
    (*jvm)->DestroyJavaVM(jvm);*/
    Cheers
    Joly

    I already did PATH.
    Open a console window.
    Explicitly set PATH to point ONLY to the appropriate java directory (where the dll is and executable) using something like the following
    set PATH=C:\xxx\yyy
    Then run your app again in the console window - no where else.

  • Setup.exe-install won't run-jvm-Error

    Hello forum I use win2000 with service pack4,
    and download Oracle9i Release 2 (9.2.0.1)
    but when I try to launch the universal installer that comes with the download, it start very find but when I tried next it just desapeared,just stop.
    Actually I had oracle 8.1.7 installed on my computer the problem started when I upgraded my win2000 to service pack3,and now to 4.
    C:\>java -version
    java version "1.4.1"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21
    Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
    very desperated situation.
    HERE IS THE LOGFILE.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6d48720a
    Function name=JVM_FindSignal
    Library=C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\hotspot\jvm.dll
    Current Java thread:
    at oracle.sysman.oii.oiip.osd.win32.OiipwWin32NativeCalls.GetAllOracleHomes(Native Method)
    at oracle.sysman.oii.oiip.oiipg.OiipgOracleHomes.getAllOracleHomes(OiipgOracleHomes.java:1136)
    at oracle.sysman.oii.oiip.oiipg.OiipgOracleHomes.getAllHomes(OiipgOracleHomes.java:1198)
    at oracle.sysman.oii.oiif.oiifw.OiifwInvLocWCCE.initialize(OiifwInvLocWCCE.java:106)
    at oracle.sysman.oii.oiif.oiifb.OiifbCondIterator.iterate(OiifbCondIterator.java:129)
    at oracle.sysman.oii.oiic.OiicPullSession.doOperation(OiicPullSession.java:586)
    at oracle.sysman.oii.oiic.OiicSessionWrapper.doOperation(OiicSessionWrapper.java:177)
    at oracle.sysman.oii.oiif.oiifb.OiifbLinearIterator.iterate(OiifbLinearIterator.java:116)
    at oracle.sysman.oii.oiic.OiicInstaller.run(OiicInstaller.java:358)
    at oracle.sysman.oii.oiic.OiicInstaller.main(OiicInstaller.java:637)
    Dynamic libraries:
    0x00400000 - 0x00405000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\javaw.exe
    0x77F80000 - 0x77FFC000 C:\WINNT\system32\ntdll.dll
    0x78ED0000 - 0x78F32000 C:\WINNT\system32\ADVAPI32.dll
    0x79290000 - 0x7934C000 C:\WINNT\system32\KERNEL32.DLL
    0x77120000 - 0x77191000 C:\WINNT\system32\RPCRT4.DLL
    0x77E10000 - 0x77E75000 C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F7C000 C:\WINNT\system32\GDI32.DLL
    0x78000000 - 0x78045000 C:\WINNT\system32\MSVCRT.dll
    0x75E30000 - 0x75E4A000 C:\WINNT\system32\IMM32.DLL
    0x6D420000 - 0x6D4EF000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\hotspot\jvm.dll
    0x77550000 - 0x77581000 C:\WINNT\system32\WINMM.dll
    0x6D220000 - 0x6D227000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\hpi.dll
    0x6D3B0000 - 0x6D3BD000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\verify.dll
    0x6D250000 - 0x6D266000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\java.dll
    0x6D3C0000 - 0x6D3CD000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\zip.dll
    0x6D020000 - 0x6D128000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\awt.dll
    0x77800000 - 0x7781E000 C:\WINNT\system32\WINSPOOL.DRV
    0x79360000 - 0x79371000 C:\WINNT\system32\MPR.DLL
    0x77A50000 - 0x77B47000 C:\WINNT\system32\ole32.dll
    0x6D1E0000 - 0x6D21B000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\fontmanager.dll
    0x72850000 - 0x72856000 C:\WINNT\system32\DCIMAN32.dll
    0x16810000 - 0x16991000 C:\WINNT\system32\nvoglnt.dll
    0x6E3B0000 - 0x6E3B6000 C:\WINNT\system32\INDICDLL.dll
    0x6D2C0000 - 0x6D2DB000 C:\Disk1\stage\Components\oracle.swd.jre\1.3.1.1.0a\1\DataFiles\Expanded\bin\jpeg.dll
    0x727B0000 - 0x727F6000 C:\WINNT\system32\ddraw.dll
    0x1B4E0000 - 0x1B4F5000 C:\Disk1\stage\Components\oracle.swd.oui\2.2.0.12.0\1\DataFiles\Expanded\bin\win32\oraInstaller.dll
    0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
    0x729B0000 - 0x729DD000 C:\WINNT\system32\DBGHELP.dll
    0x731B0000 - 0x731BA000 C:\WINNT\system32\PSAPI.DLL
    Local Time = Fri Aug 15 18:24:06 2003
    Elapsed Time = 6
    # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
    # Error ID : 4F530E43505002CC
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)

    Hi,
    You could probably post your question in the Database Installation for a better reponse.
    Hope this helps.
    Sujatha.

  • Running jvm 32 on  SUNW,UltraSPARC-IIe, OS 5.8

    I am using java 1.4.2_05 jvm on SUNW,UltraSPARC-IIe in 32 bit mode defualt. The SUN os is configured to run in 64 Bit mode.
    My question is
    1) What is the effect of JVM 32 running on a 64 Bit OS
    2) I am using a JNI in my project. The system goes into hanging mode during calls to jni methods and it sporadic.
    4) I am not able to make a thread dump using kill -3 <java pid>
    Is there a way to make a java thread dump under these situatuations.

    I am using java 1.4.2_05 jvm on SUNW,UltraSPARC-IIe
    in 32 bit mode defualt. The SUN os is configured to
    run in 64 Bit mode.
    My question is
    1) What is the effect of JVM 32 running on a 64 Bit OSYou cannot allocate more than 3.8 GB of heap (if you
    have that much physical memory).
    2) I am using a JNI in my project. The system goes
    into hanging mode during calls to jni methods and it
    sporadic.I would recommend trying Sun Studio 9
    http://wwws.sun.com/software/products/studio/index.html
    It comes with great Java/Native debugger and profiler.
    4) I am not able to make a thread dump using kill -3
    <java pid>Unless you are starting with the -Xrs option, it probably
    means you're stuck somewhere in native code.
    Is there a way to make a java thread dump under these
    situatuations.Studio 9
    -Alexis

  • Java 1.6 U12 installer not detecting running JVM

    What does the installer look for when upgrading to decide if a JVM is running? I have a problem where it does not realize a DLL is in use and it continues to install.
    Thanks.

    See this post:
    http://forums.sun.com/thread.jspa?threadID=5375847

  • SunPKCS11 : unable to reload nss-db in running jvm

    I'm using SunPKCS11 to load and check certificates from a nssdb store:
    KeyStore ks = KeyStore.getInstance("PKCS11", "SunPKCS11-nssdb");
    ks.load(null, "".toCharArray());
    This works fine, but eventhough the documentation of Keystore.load() method states "Note that if this keystore has already been loaded, it is reinitialized and loaded again from the given input stream.", but in a given JVM runtime, I cannot see changes in the nssdb, done by CLI outside the JVM, even calling this method again.
    I found other questions reporting this issue, but no clear answer.
    (note: running this on openJDK1.7, but openJDK1.6 shows the same behaviour)
    Any comment is wellcome...

    ther eis no MMC SAP snapin for Oracle.
    Period.
    Forget about it. SAP has never released it and I believe it doe not plan to do so neither.

  • How to change JVM options from a running JVM

    Hello, I have to launch a remote application on my machine. I managed to do that with code that invokes the main method of the application I want to execute. What I do is to launch an instance of the class containing main function, here is an extract of the code:
    Object obj = ....; //obj is the class containg main, for instance MyClass
    java.lan.reflect.Method m = .....; //m is the main method
    Object result = m.invoke(obj, args);This works, the main method gets called and so the application starts. Of course, the main method is called from a jar built in the right way.
    But the way the main method gets called is like doing
    java MyClassNow I have the problem to launch this application with some options to java command (these options are about remote debugging with JDI ).
    In other words, what I would like to dis the following, if I could do it from command line:
    java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket myApp.jar (myApp.jar is on a remote host)
    while all that I'm able to do is
    java myApp.jarOf course I want to do it from my java code, not from command line.
    Thank you

    It isn't possible as stated.
    You must change the way that you are launching the VM. Either by providing options or by providing a different way to launch it.

  • How do I run multiple java apps in one JVM to reduce memory use?

    Hi all,
    I saw an article either on the web or in a magazine not too long ago about how to "detect" if the app is already running, and if so, it hands off the new instance to the already running JVM, which then creates a thread to run the Java app in. As it turns out, my app will be used in an ASP environment, through Citrix. We may have as many as 50 to 100 users running the same app, each with their own unique user ID, but all using the same one server to run it on. Each instance eats up 25MB of memory right now. So the question is if anybody knows of a URL or an app like this that can handle the process of running the same (or even different Java) apps in one JVM as separate threads, instead of requring several instances of the JVM to run? I know this article presented a fully working example, and I believe I know enough to do it but I wanted ot use the article as a reference to make sure it is done right. I know that each app basically would use the same one "launcher" program that would on first launch "listen" to a port, as well as send a message through the port to see if an existing launcher was running. If it does, it hands off the Java app to be run to the existing luancher application and shuts down the 2nd launching app. By using this method, the JVM eats up its normal memory, but each Java app only consumes its necessary memory as well and doesn't use up more JVM instance memory.
    Thanks.

    <pre>
    import java.util.Properties;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.lang.reflect.Method;
    import java.lang.reflect.InvocationTargetException;
    import java.util.Enumeration;
    import java.util.NoSuchElementException;
    public class RunProg implements Runnable, Cloneable
    private String iProg;
    private String iArgs[];
    public static void main(String args[])
    new RunProg().main();
    // first step is to start main program itself
    private void main()
    Properties properties = System.getProperties();
    try
    properties.load(new FileInputStream("RunProg.properties"));
    catch(IOException e)
    System.setProperties(properties);
    int i = 0;
    System.out.println("enter main, activeCount=" + Thread.activeCount());
    while(true)
    String program = properties.getProperty("Prog" + i);
    if(program == null)
    break;
    StringTokenizer st = new StringTokenizer(program);
    String[] args = new String[st.countTokens() - 1];
    try
    RunProg rp = (RunProg)this.clone();
    rp.iProg = st.nextToken();
    for(int j = 0; st.hasMoreTokens(); j++)
         args[j] = st.nextToken();
    rp.iArgs = args;
    Thread th = new Thread(rp);
    th.setName("prog" + i + "=" + program);
    th.start();
    System.out.println("prog" + i + "=" + program + ", started");
    catch(CloneNotSupportedException e)
    System.out.println("prog" + i + "=" + program + ", can't start");
    i++;
         System.out.println("end of main, activeCount=" + Thread.activeCount());
    // next step is to start all others one by one
    public void run()
    try
    Class c = Class.forName(iProg);
    Class p[] = new Class[1];
    p[0] = String[].class;
    Method m = c.getMethod("main", p);
    Object o[] = new Object[1];
    o[0] = iArgs;
    m.invoke(null, o);
    catch(ClassNotFoundException e)
    System.out.println(iProg + "ClassNotFoundException");
    catch(NoSuchMethodException e)
    System.out.println(iProg + "NoSuchMethodException");
    catch(InvocationTargetException e)
    System.out.println(iProg + "NoSuchMethodException");
    catch(IllegalAccessException e)
    System.out.println(iProg + "NoSuchMethodException");
    System.out.println(Thread.currentThread().getName() + ", ended");
    System.out.println("exit run, activeCount=" + Thread.activeCount());
    // setup SecurityManager to disable method System.exit()
    public RunProg()
         SecurityManager sm = new mySecurityManager();
         System.setSecurityManager(sm);
    // inner-class to disable method System.exit()
    protected class mySecurityManager extends SecurityManager
         public void checkExit(int status)
              super.checkExit(status);
              Thread.currentThread().stop();
              throw new SecurityException();
    * inner-class to analyze StringTokenizer. This class is enhanced to check double Quotation marks
    protected class StringTokenizer implements Enumeration
    private int currentPosition;
    private int maxPosition;
    private String str;
    private String delimiters;
    private boolean retTokens;
    * Constructs a string tokenizer for the specified string. All
    * characters in the <code>delim</code> argument are the delimiters
    * for separating tokens.
    * <p>
    * If the <code>returnTokens</code> flag is <code>true</code>, then
    * the delimiter characters are also returned as tokens. Each
    * delimiter is returned as a string of length one. If the flag is
    * <code>false</code>, the delimiter characters are skipped and only
    * serve as separators between tokens.
    * @param str a string to be parsed.
    * @param delim the delimiters.
    * @param returnTokens flag indicating whether to return the delimiters
    * as tokens.
    public StringTokenizer(String str, String delim, boolean returnTokens)
    currentPosition = 0;
    this.str = str;
    maxPosition = str.length();
    delimiters = delim;
    retTokens = returnTokens;
    * Constructs a string tokenizer for the specified string. The
    * characters in the <code>delim</code> argument are the delimiters
    * for separating tokens. Delimiter characters themselves will not
    * be treated as tokens.
    * @param str a string to be parsed.
    * @param delim the delimiters.
    public StringTokenizer(String str, String delim)
    this(str, delim, false);
    * Constructs a string tokenizer for the specified string. The
    * tokenizer uses the default delimiter set, which is
    * <code>"&#92;t&#92;n&#92;r&#92;f"</code>: the space character, the tab
    * character, the newline character, the carriage-return character,
    * and the form-feed character. Delimiter characters themselves will
    * not be treated as tokens.
    * @param str a string to be parsed.
    public StringTokenizer(String str)
    this(str, " \t\n\r\f", false);
    * Skips delimiters.
    protected void skipDelimiters()
    while(!retTokens &&
    (currentPosition < maxPosition) &&
    (delimiters.indexOf(str.charAt(currentPosition)) >= 0))
    currentPosition++;
    * Tests if there are more tokens available from this tokenizer's string.
    * If this method returns <tt>true</tt>, then a subsequent call to
    * <tt>nextToken</tt> with no argument will successfully return a token.
    * @return <code>true</code> if and only if there is at least one token
    * in the string after the current position; <code>false</code>
    * otherwise.
    public boolean hasMoreTokens()
    skipDelimiters();
    return(currentPosition < maxPosition);
    * Returns the next token from this string tokenizer.
    * @return the next token from this string tokenizer.
    * @exception NoSuchElementException if there are no more tokens in this
    * tokenizer's string.
    public String nextToken()
    skipDelimiters();
    if(currentPosition >= maxPosition)
    throw new NoSuchElementException();
    int start = currentPosition;
    boolean inQuotation = false;
    while((currentPosition < maxPosition) &&
    (delimiters.indexOf(str.charAt(currentPosition)) < 0 || inQuotation))
    if(str.charAt(currentPosition) == '"')
    inQuotation = !inQuotation;
    currentPosition++;
    if(retTokens && (start == currentPosition) &&
    (delimiters.indexOf(str.charAt(currentPosition)) >= 0))
    currentPosition++;
    String s = str.substring(start, currentPosition);
    if(s.charAt(0) == '"')
    s = s.substring(1);
    if(s.charAt(s.length() - 1) == '"')
    s = s.substring(0, s.length() - 1);
    return s;
    * Returns the next token in this string tokenizer's string. First,
    * the set of characters considered to be delimiters by this
    * <tt>StringTokenizer</tt> object is changed to be the characters in
    * the string <tt>delim</tt>. Then the next token in the string
    * after the current position is returned. The current position is
    * advanced beyond the recognized token. The new delimiter set
    * remains the default after this call.
    * @param delim the new delimiters.
    * @return the next token, after switching to the new delimiter set.
    * @exception NoSuchElementException if there are no more tokens in this
    * tokenizer's string.
    public String nextToken(String delim)
    delimiters = delim;
    return nextToken();
    * Returns the same value as the <code>hasMoreTokens</code>
    * method. It exists so that this class can implement the
    * <code>Enumeration</code> interface.
    * @return <code>true</code> if there are more tokens;
    * <code>false</code> otherwise.
    * @see java.util.Enumeration
    * @see java.util.StringTokenizer#hasMoreTokens()
    public boolean hasMoreElements()
    return hasMoreTokens();
    * Returns the same value as the <code>nextToken</code> method,
    * except that its declared return value is <code>Object</code> rather than
    * <code>String</code>. It exists so that this class can implement the
    * <code>Enumeration</code> interface.
    * @return the next token in the string.
    * @exception NoSuchElementException if there are no more tokens in this
    * tokenizer's string.
    * @see java.util.Enumeration
    * @see java.util.StringTokenizer#nextToken()
    public Object nextElement()
    return nextToken();
    * Calculates the number of times that this tokenizer's
    * <code>nextToken</code> method can be called before it generates an
    * exception. The current position is not advanced.
    * @return the number of tokens remaining in the string using the current
    * delimiter set.
    * @see java.util.StringTokenizer#nextToken()
    public int countTokens()
    int count = 0;
    int currpos = currentPosition;
    while(currpos < maxPosition)
    * This is just skipDelimiters(); but it does not affect
    * currentPosition.
    while(!retTokens &&
    (currpos < maxPosition) &&
    (delimiters.indexOf(str.charAt(currpos)) >= 0))
    currpos++;
    if(currpos >= maxPosition)
    break;
    int start = currpos;
    boolean inQuotation = false;
    while((currpos < maxPosition) &&
    (delimiters.indexOf(str.charAt(currpos)) < 0 || inQuotation))
    if(str.charAt(currpos) == '"')
    inQuotation = !inQuotation;
    currpos++;
    if(retTokens && (start == currpos) &&
    (delimiters.indexOf(str.charAt(currpos)) >= 0))
    currpos++;
    count++;
    return count;
    </pre>
    RunProg.properties like this:
    Prog1=GetEnv 47838 837489 892374 839274
    Prog0=GetEnv "djkfds dfkljsd" dsklfj

  • Communicating with objects running in different JVM's

    Hi All
    I have a program which is running in multiple JVM.Each Jvm is using some special object.
    Now i need to monitor the state of that special object using a GUI sort of tool.ie i need to build a gui for seeing those special objects in all the running JVM.
    So whats the best way to do this
    Thanks
    Raj

    Please do not crosspost
    http://forum.java.sun.com/thread.jsp?forum=31&thread=400828&tstart=0&trange=100
    You have already been given a perfectly good answer more than once - try using RMI. Do you have a specific problem that is stopping you from using RMI? Have you read an RMI tutorial?

Maybe you are looking for

  • Multiple Domains on NWDI

    Hi experts! I've started using NWDI, and i've noticed that i already have 23 tracks. I would like to group tracks by some kind of category. As far as i understand, the domain tab could function like a category to group my tracks. But when i go to "Do

  • Does the camera have a focus or zoom function

    does the camera have a focus function or zoom function?

  • Can i make calls(plus mesaages) to some one from ipad air cellular?

    Because in my country there is no 3G so can i make calls and text through gsm to my friends from ipad air cellular? if no it means ipaid cellular is only for 3g or 4g connections to access internet anywhere?

  • OWB : source_import_task component task not work properly ?

    Hi, My config is : OWB 11.2.0.3, Windows XP, 32bit client, to REHL6 64bit database server. I have an 'expert' which makes use of the 'source_import_task' component, but this produces an empty 'OWB Error' dialogue immediately the 'expert' is started.

  • Need Suggestion for SRH Heidelberg program of SAP masters

    HI , There are two SAP masters program available in the SRH Heidelberg University of Applied Science.However, the masters of computer science which has specialization in SAP costs 10,000 euros and the SAP corporate masters program  costs 40,000 euros