Java.exe not ending

For some reason the java.exe process does not get removed from the Windows Task Manager when I exit out of my swing based java application. After awhile my pc runs into virtual memory errors because of the numerous java.exe's running. This only happens on my PC. I've tried uninstalling and reinstalling my JDK and JRE, running my virus program, ad-aware, spy-bot, windows updates, all with no luck. Has anyone come across this problem before? Any help would be appreciated. Thank you.

If you have access to the code, make sure you exit with System.exit().
If you relay on the return from main() to finish you application, there is no guarantee this will happen. If there are still threads running (created by you or by the libraries you use, for instance Swing), the task will not complete. Why it works on some machines and not on others? Maybe different JRE versions?

Similar Messages

  • Force jar to run through java.exe not javaw.exe

    Hi,I am programming using eclipse 3.5.1 when i try to export my project as a single jar file it always runs through javaw.exe
    even if its a console app the problem is that sometimes i want it to run through java.exe without having to write the annoying batch file (java -jar "appname.jar") which will only probably run under windows, is there a way around this that would force the jar file to run automatically in console mode?

    803038 wrote:
    Hi,I am programming using eclipse 3.5.1 when i try to export my project as a single jar file it always runs through javaw.exe
    even if its a console app the problem is that sometimes i want it to run through java.exe without having to write the annoying batch file (java -jar "appname.jar") which will only probably run under windows, is there a way around this that would force the jar file to run automatically in console mode?Windows, not java, has file associations which specify what happens to certain files when someone double clicks on it.
    You have one extension which you want to run two different ways. That of course isn't possible.
    You could write a wrapper that spawns a console via Runtime.exec. Then your console apps would be wrapped in that.

  • Calling back c++ method in an exe (not a dll) from java?

    Hi all,
    I have to make an hybrid C++/java from an existing C++
    application that compiled is a big single exe not a dll.
    I'm running under win32.
    The application consists of several windows. The hybrid
    will have widows in C++ and some in java. They have the
    same menu and tool bar. In the C++, there are some
    callbacks called when a button is pressed. How to call
    these callback from java given the fact that the JVM and
    the java classes are launched by the exe file.
    I know how, from C++, start JVM and call my java window.
    I also know how to call a C++ method that is in a dll from
    java. It's from the tutorial
    http://java.sun.com/docs/books/tutorial/native1.1/index.html
    But I don't know how to call a C++ method that is in in an
    exe which has launch a JVM from an object running in this
    JVM.
    Is there somewhere an example like this?
    Thanks,
    Xavier.

    Thanks this helped.
    For those who want a complete example, here it is:
    Tested on XP, java 1.4.2, VC++ 6.0.
    ************ File invoke.cpp *****************************
    #include <stdlib.h>
    #include <jni.h>
    #ifdef _WIN32
    #define PATH_SEPARATOR ';'
    #else /* UNIX */
    #define PATH_SEPARATOR ':'
    #endif
    #define USER_CLASSPATH "." /* where Prog.class is */
    void JNICALL displayHelloWorld(JNIEnv *env, jobject obj)
        printf("Hello world: made by printf from C++\n");
        return;
    void main() {
        JNIEnv *env;
        JavaVM *jvm;
        JavaVMInitArgs vm_args;
        jint res;
        jclass cls;
        jmethodID mid;
        jstring jstr;
        jobjectArray args;
        char classpath[1024];
         int result;
        /* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */
         JavaVMOption options[3];
         options[0].optionString = "-verbose:gc";
         sprintf (classpath, "-Djava.class.path=%s", USER_CLASSPATH);
         options[1].optionString = classpath;
         options[2].optionString = "-Djava.compiler=NONE";
         vm_args.options = options;
         vm_args.nOptions = 3;
         vm_args.ignoreUnrecognized = JNI_TRUE;
            vm_args.version = JNI_VERSION_1_4;
         /* IMPORTANT: Note that in the Java 2 SDK, there is no longer any need to call
          * JNI_GetDefaultJavaVMInitArgs. It causes a bug
        /* Append USER_CLASSPATH to the end of default system class path */
        /* Create the Java VM */
        res = JNI_CreateJavaVM(&jvm,(void**)&env, &vm_args);
        if (res < 0) {
            fprintf(stderr, "Can't create Java VM\n");
            exit(1);
        cls = env->FindClass("mypackage/Prog");
        if (cls == 0) {
            fprintf(stderr, "Can't find mypackage/Prog class\n");
            exit(1);
       JNINativeMethod nm;
       nm.name = "displayHelloWorld";
       /* method descriptor assigned to signature field */
       nm.signature = "()V";
       nm.fnPtr = displayHelloWorld;
       env->RegisterNatives(cls, &nm, 1);
        mid = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
        if (mid == 0) {
            fprintf(stderr, "Can't find Prog.main\n");
            exit(1);
        jstr = env->NewStringUTF(" from C++! calleded by C++, using argument from C++ but java method");
        if (jstr == 0) {
            fprintf(stderr, "Out of memory\n");
            exit(1);
        args = env->NewObjectArray(1,
                            env->FindClass("java/lang/String"), jstr);
        if (args == 0) {
            fprintf(stderr, "Out of memory\n");
            exit(1);
        env->CallStaticVoidMethod(cls, mid, args);
        jvm->DestroyJavaVM();
    }********************* File ./mypackage/Prog.java **************************
    package mypackage;
    public class Prog {
           public native void displayHelloWorld();
        public static void main(String[] args) {
            System.out.println("Hello World" + args[0] +"\n");
            Prog prog = new Prog();
            prog.displayHelloWorld();
            System.out.println("(called from java)");
            System.out.println("\nSo to sumurize:");
            System.out.println(" -1 Starting point is an exe (not DLL, there is no DLL) so C++ code");
            System.out.println(" -2 From C++ call java method using argument from C++");
            System.out.println(" -3 From java, that was launched by the exe, call to");
            System.out.println("    a native using the RegisterNatives in C++\n");
            System.out.println("You got a bidirectional example with as starting point");
            System.out.println("a single exe, launching JVM, loading class call back C++!");
    }******************* Command line for all ****************************************
    javac mypackage/Prog
    cl -I"D:\Program Files\j2sdk1.4.2_03\include" -I"D:\Program Files\j2sdk1.4.2_03\include\win32" -MT
    invoke.cpp -link D:\PROGRA~1\j2sdk1.4.2_03\lib\jvm.lib
    (Remark, the last path is using the short name for "Program Files" because with the blank
    even adding double quotes result into an error)
    You must have jvm.dll in your path for me it's Path=D:\Program Files\j2sdk1.4.2_03\jre\bin\client;
    Then simply call invoke and see the result. :-)

  • Memory grows in javaw.exe but not in java.exe process

    Hi,
    I'm testing some heavy emoticons(most of them are animated). Emoticons are shown in a popmenu, each emoticon is inside a JLabel with borders that are draw on mouse over. These JLabels are in a GridLayout.
    The test itself consists in pressing repeatly on a button that opens the popupmenu with emoticons many times.
    I noticed that this test, as a webstart app process (javaw.exe), makes the memory grow continously until someone (SO or JVM) thinks its time to free the mem.
    As a standalone app process (java.exe), mem does not grow - ok it grow about 3 MB and stabilizes
    Is there some good reason for this to happen?
    Thanks
    Edited by: maxupixu on Jul 1, 2010 7:30 AM
    Edited by: maxupixu on Jul 1, 2010 7:45 AM

    Hello,
    Metalink says that the OS is ok.
    But now i have found a workaround . I used the installer
    from the Oracle Designer patch 10.1.2.2 with the products.xml from the Oracle
    Developer Suite 10.1.2.0.2. The installation cancels at the end. Doesn't
    matter. I continue with the installation of the Oracle Designer patch 10.1.2.2.
    The installation is terminating successful, i correct the tnsnames.ora and the
    Designer is running.
    No award of beauty - but useable as a workaround.
    Greetings
    J. Häffner

  • "ASSERT FAILED" when java.exe ends

    What kind of error message is this:
    ASSERT FAILED:
    Executable: java.exe PID 218 Tid b04 Module kswdmcap.ax, 4 objects left active at line blablablablabla
    This happens when my java class ends from where I called a c++ method (that controls the windows media encoder sdk). It return without an error message from the c++ part, but when java.exe tries to end the class does this error message appear on the screen (Windows XP). Does anybody have a clue what that might be?

    I wouldn't say problem.
    Presumably the library you call does something. While doing that it creates "resources" of some sort. It could be a socket. Or a memory allocation. Or something else.
    But it expects you to tell it when you are done. Either with the library or with some specific aspect of the library. And you are not doing that before you exit.
    Keep in mind that I am only guessing. There could certainly be other explainations - like a bug in the library.

  • Java.exe console not appearing

    I have a java app that I usually start with javaw.exe.
    When debugging, I use java.exe to see the console.
    Today though, I found a PC where running java.exe did NOT create the console... it just poped up the gui app as if it was using javaw.exe.
    I thought something might be wacky with java, so I upgraded to 1.6_20.
    Still behaving the same though.
    Any ideas why this PC would behave this way?

    Paul,
    I think perhaps you misread my comments, or missed part of my previous explanations.
    paulcw wrote:What do you mean "to see the console"? You start java, it reads/writes to the command line.I explained above that I meant "the black dos window that shows the java output." when I said "console"
    paulcw wrote: What do you mean, "it jsut poped up the gui app"? Starting javaw doesn't create any kind of GUI. Maybe if your java program creates a GUI...but that would happen with java as well.as I said initially, I have a java app that I usually start with javaw.exe.
    Just to be pedantic though, I suppose, I should have said:
    I have a java (GUI) app that I usually start with javaw.exe.
    paulcw wrote:
    Any ideas why this PC would behave this way?Honestly, I think your expectations may be in error.I am not clear which expectations you think are in error. My only expectation is that two PCs running the same java program, using the same JVM, launched in the same way would behave in the same way. I am questioning why this one PC would not behave the same.
    Cheers
    --Ding                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Set CLASSPATH does not work, how do I run java.exe?

    Hi guys,
    I have a problem running the java.exe and I'm using Win XP. Here is my problem:
    Under the command prompt, I set the path: path = C:\Program Files\Java 2\j2sdk1.4.2_05\bin
    Then I created a folder in E:\Hello. I save my Hello.java in that folder, and I compiled it:
    javac Hello.java
    Now, there is a Hello.class created in that folder.
    Then I try to run it: java Hello
    but I got an error: "Exception in thread "main" java.lang.NoClassDefFoundError: Hello"
    So, I try to set CLASSPATH, however, the problem remains, no matter how hard I try.
    Any ideas?

    None of the suggestion worked, I wonder why???
    Here is my location for the JDK:
    C:\Program Files\Java 2\j2sdk1.4.2_05\bin
    Here is my location for my Java project file:
    E:\JavaProject\Hello
    Here is the file name:
    Hello.java
    Here is the command prompt:
    C:\Documents and Settings\Alex Ngai> e:
    E:\> cd JavaProject
    E:\JavaProject> cd Hello
    E:\JavaProject\Hello> path = C:\Program Files\Java
    2\j2sdk1.4.2_05\bin
    E:\JavaProject\Hello> javac Hello.java
    E:\JavaProject\Hello> java Hello
    Exception in thread "main"
    java.lang.NoClassDefFoundError: Hello
    E:\JavaProject\Hello> java -cp Hello
    // Does not work, it lists all of the options for java
    E:\JavaProject\Hello> set CLASSPATH =
    E:\JavaProject\Hello
    CLASSPATH="C:\Program
    Files\Java\j2re1.4.2_04\lib\ext\QTJava.zip"
    E:\JavaProject\Hello> java Hello
    Exception in thread "main"
    java.lang.NoClassDefFoundError: Hello
    // I have tried a lot more, none of them won't work!!
    Now what should I try in the following command prompt?
    E:\JavaProject\Hello>Given the above there is only one possible explaination.
    You have a file named "Hello.java".
    In that file you have a non-public class which is NOT named "Hello". Instead it is named something like "HelloWorld" or even "hello" (case matters.)

  • How to make jar files run using java.exe and not javaw.exe

    Hi ,
    I am developing a project in which there is an GUI which inturn will call a console . I have made it into an jar file now.
    Here comes the problem. When i run the jar files , i don't get a console. While going through this forum, i came to know that jar runs using javaw.exe and this stops it from bring the console up.
    Please suggest me a way of running the jar file through java.exe or any other method by which i can get an new console poping up.
    PS : i cannot start the application itself in a system console , because the Console mode is an added feature and it is not to be displayed every time but only when the user intends to.

    Thanks for the reply pbrockway2. But i think, i was not able to convey my problem properly.
    I am supposed to start my application in a GUI mode ( No console are should be present at this point of time). Within the GUI , i have a option for working in the console ( i.e if console is choosen, then i start giving my output and take inputs from the console. I am trying to do this by just calling the "System.out "and "System.in" methods. )
    Here is the problem. As i have started it through " jar " it would not have a associated console with it.
    PS: i cannot have launching .bat file because that would result in my application having a console displayed at the very start of the application. I want the console to be displayed only when the user wants to start in console mode.
    Please suggest me some ways of doing this. Can i create a console from my java program and then exit it.

  • Native app - Invalid number of parameters, java.exe is not recognized as an internal or external...

    Compilation complete.
    Patching package name...
    Patching version information...
    Patching app name...
    Updating the Android app project...
    [Path to Android project]>android update project --name "EmployeeCare2" --target 1 --path .
    Invalid number of parameters
    '"C:\Windows\system32\java.exe "' is not recognized as an internal or external command,
    operable program or batch file.

    Fixed it. I mean I got it to generate the app, I wouldn't call it fixed. This is one of those cases where I'm convinced that I am the only person who is using a particular feature because it doesn't seem like this would have ever worked for anyone.
    Open C:\Program Files (x86)\Adobe\Adobe RoboHelp 11\RoboHTML\MultiscreenExt\NativeApps\Android\UpdateApp.bat.
    Turn echo back on.
    Run the script to generate a native app.
    Check the output window when it fails. This line >SET PATH="C:\Program Files\Java\jdk1.7.0_51\"bin; should be >SET PATH=C:\Program Files\Java\jdk1.7.0_51\bin; no quotes around the path before bin.
    Back in UpdateApp.bat: I hardcoded SET PATH=C:\Program Files\Java\jdk1.7.0_51\bin;%3;%PATH%.
    When I run the script again, I get a different error. I cleared the output window, so I don't remember what it was.
    Delete everything in the output folder, run the script again.
    I haven't tested the app, but it says and looks like it was generated.

  • Could not find java.exe

    I've installed the jdk 1.4.2 with netbeans, but as i try to execute netbeans i received an error message saying "could not find java.exe"
    What do i need to do to fix this error? thanks

    Okay, I just moved to a Mac, which automatically has the 1.4.2 jdk installed. So I downloaded 5.0 and NetBeans 4.1. I set the platform for a certain project (I wish I could change the default, but I don't think it will let me) to 1.5.0 but still get an error when I try to use generics and the like. What am I doing wrong?
    theAmerican

  • I cant install WCS Sites. Could not find java.exe

    Hello! I I cant install WCS Sites Release 11g R1 (11.1.1.8.0).
    When i run csInstall.bat, I get an error:
    Please wait while the installation is configured for your system
    Eception in thread "main" java.lang.NullPointerException
          at COM.PutureTense .Apps .СSSеtuр.sеtupOМI I (СSSеtuр.java:1177)
          at COM.PutureTense .Apps .СSSеtuр.main(СSSеtuр.java:425)
    "W A R N I N G ! ! !
    The install could not find java.exe in your path.
    Please check your path and try again."
    My environment variables:
    JAVA_HOME    C:\jdk1.7.0_25
    JRE_HOME      C:\jre7
    Path                ...%JAVA_HOME%\bin;%JRE_HOME%\bin;...
    Before it I installed WebLogic Server without errors.
    Do you have any idea how i can solve this problem?

    all variables are correct.I fix the error after reading the topic https://forums.oracle.com/thread/2376280
    closed.

  • Javac.exe  is not using classpath, while java.exe is.

    I'll state the problem, then give my configuration. This does NOT seem to be a duplicate of other problems. I am running Windows NT sp 6a.
    INTRO:
    javac.exe, java.exe in directory E:\v\bin.
    file HelloWorld.java is in directory E:\v\lib\x\y (dir names shortened)
    PROBLEM:
    Once HelloWorld is compiled (and HelloWorld.class is in E:\v\lib\x\y ), I can run the exact command "java HelloWorld" from ANY directory anywhere and it runs and prints Hello World!.(So java.exe seems to be using classpath.)
    However, to compile, the command "javac HelloWorld.java" does not work (say in E:\v). The error message is "cannot read: "HelloWorld.java". I have to provide the full path name for HelloWorld.java, thus: "javac E:\v\lib\x\y\HelloWorld.java". This works, from any directory anywhere. In other words, javac.exe does NOT seem to be using classpath.
    CONFIGURATION:
    CLASSPATH is set to E:\v\lib\x\y in both system and user environment and ALSO through both javac -classpath and java -classpath. (When I run javac -classpath E:\v\lib\x\y, the list of options is not printed out, and I think this means the classpath is supposed to be set. ) I also tried setting sourcepath for javac, but that did not help.
    PATH is set since and the system recognizes the commands "java" and "javac" from any directory anywhere (each brings up the list of options.)
    Any thoughts.

    let's read the documentation first shall we ...
    http://java.sun.com/j2se/1.4.1/docs/tooldocs/windows/javac.html
    According to it the command line arguments must be file names. The compiler "cannot read HelloWorld.java" because it simply is not in the current working directory. You need to specify a path to the file. It is only after that, "when compiling a source file", that the classpath or sourcepath setting has any effect.

  • Pathname for java.exe does not work

    Hi all,
    on Windows, when prompted for full name to java.exe, I enter:
    C:\Program Files\Java\jre1.5.0_06\bin\java.exe
    Next, pressing OK, I get an error:
    Cannot find a J2SE SDK installed at path: C:\Program Files\Java\jre1.5.0_06.
    What am I doing wrong here?
    Kind regards - Remi.

    OK got it.
    I now use D:\oracle\Raptor\raptor\jdk\jre\bin\java.exe from my latest beta version.
    This appears to work just fine.
    Thanks - Remi.

  • Classpath, dos finds java.exe but not javac.exe

    Hi all,
    I have still been trying to have dos recognize the javac command. I have used many methods for updating the classpath and path in WinMe through the environment variable and in the autoexec.bat. I am using the J2SDK1.3.1_02. When I go to the proper directory and use the java command to run a .class file my simple "Hello" program runs fine. However, if I try to compile a new file ex. "Helloagain.java" using: javac Helloagain.java , I receive the "bad command or file name" message. This doesn't make sense because java.exe(which works), is in the same bin as javac.exe!
    My complete autoexec.bat file in notepad reads as follows:
    SET COMSPEC=C:\WINDOWS\COMMAND.COM
    SET windir=C:\WINDOWS
    SET winbootdir=C:\WINDOWS
    SET PROMPT=$p$g
    SET TEMP=C:\WINDOWS\TEMP
    SET TMP=C:\WINDOWS\TEMP
    SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\MSSQL7\BINN;C:\J2SDK1.3.1_02\BIN
    SET CLASSPATH=C:\PROGRA~1\CANONC~1\PHOTOD~1\ADOBEC~1;.;C:\J2SDK1.3.1_02\lib\tools.jar
    I have struggled with this for several weeks. I have also checked numerous online resources. any help would be appreciated.
    Thanks,
    Jeff

    Well, that's what is wrong! Change the
    C:\J2SDK1.3.1_02\BIN to C:\JDK1.3.1\bin
    Kamranyes, that is what was wrong. I should have used jdk1.3.1. I had tried that before but tried adding version #'s like 1.3.1_02.
    The initial java kit I downloaded says j2sdk1.3.1_02 on the winzip file, yet it extracted to a folder called jdk1.3.1, which is the one I should have used in the first place .
    Now that I have the dos prompt working , I will go and use ForteCE. lol. Thanks for you insight.
    Jeff

  • Path not working in win xp pro, can call java but not javac !

    Hello,
    I just upgraded to win xp and set up the J2SDK. I have set the path variable in the environment settings.
    when I tried to test this by typing java from my documents directory it works all right but not the javac command, to which it gives the error
    "'javac' is not recognized as an internal or external command,
    operable program or batch file."
    when I type path then I get the following result -
    PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\FSC\PCOBOL32;C:\Program Files\FSC\PCOBOL32;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;c:\borland\bcc55\bin; c:\jdk1.4.0_01\bin;C:\FSC\PCOBOL32;C:\PROGRAM\PCOBOL32 , so my path settings are correct.
    Why is this happening? Thanks for any help.
    - rdg
    P.S. I also am also unable to invoke the c++ compiler from my documents, so I think this may be a problem with my path, but then how am i able to call the java.exe ?

    -----BEGIN PGP SIGNED MESSAGE-----
    In win xp you must type the name of the directory as Dos-8 format,
    for example, if you want to use c:\J2sdk1.4.0_01 you must write in
    the path c:\j2sdk1~1.0_0
    -----BEGIN PGP SIGNATURE-----
    Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
    iQEVAwUBPWL6quIx3Zm+mBoJAQFhVwf/dM2pfQYN5Wp5AnmD+HV1Nx+5MSm1zmUs
    b3UPC8xJt0JhJItyims6YLEJKAv+Mrm0sk3fVyfg1o4Tcpw0bzG/RsVdsTsrmlDu
    vUlqWrxgTRH85IAjro83lGNuLUo6PKs10hVj4h4tqL8BkLE4pCkZfLT2tpG7VLt0
    YylUFx6DZQzF1HVK9+6MqYOvBEjxLhkNRHThNysUJj6SBkNHKDbDgnOcUQf+8PpZ
    RxItuKGUys6FdLSvrxonbj2qbHJ34Ewb/a8DL1MXcCOtP2QGIta4ozq/3SVPDAK4
    BD/NG97FsuYbL/l18Je4EzXRWqtG9IlIY8WBhbdx8X3B3fpuq8gICw==
    =UJDG
    -----END PGP SIGNATURE-----

Maybe you are looking for

  • Dark line across white menu bar space

    Something really weird just happened. Across the white menu bar (where it lists Finder and shows the clock, etc) there is now a somewhat faint black line. it's a few cm thick, and looks a little blurred. This is what happened prior to the line appear

  • Error in SSO test

    Hi all,   I have implemented the SSO by using SSO configuration between SAP Portal 7.3 and ECC 6.0 Ehp 6 document.   The system object test is successful and trust is established.   For  SSO testing system admin-->support-->Application integration an

  • Which Project Photos are in Albums

    I'm new to Aperture. I have many photos in a single project, and I have many albums in the project. When I look at my photos in the project, how do I tell which (if any) album they have been placed in? I'm trying to make sure all photos in a project

  • Getting Process Handle

    Hello all... Can I retrieve an handle to a running Process referencing the name or the Process ID?!?!? I would start my SMTP server from a GUI but it should run in another process, and retrieving its handle makes me to start and stop it without probl

  • CS4 crashing problems - will the update help

    hi I upgraded to CS4 early this year, but have long since given up on it, since every time I use CS4, either on my (Toshiba Qosmio) laptop or on my (Dell 690) Desktop PC, it crashes with ridiculous regularity (I think around 20 mins is I think the lo