Java.exe CPU %

Hi,
We are running Resin Servlet runner on our web server. Our web site mostly serves out .XML documents using XSLT. The problem we periodically have is java.exe consumes 100% of the CPU until the web server stop responding. Restarting the servlet runner usually takes care of it, but sometimes on restart, java.exe will immediately starting chewing up memory to about 150 meg. We run with -Xms128m -Xmx256m memory parameters.
How can I tell what is eating up the CPU and memory? Any suggestions would be helpful.

with the minimum heap size set at 128 megs... As soon as you start java it will take about 150 megs... That fact that it's eating up CPU time is more diffcult.... Either it's really processing something that has to be done.. or you have some bad code spinning somewhere... or it's just not written right to begin with.

Similar Messages

  • Oracle.exe and java.exe are running my CPU 100% under XP Prof SP3

    11gR1
    oracle.exe and java.exe are running 100% CPU
    I have increased virtual memory to 4 gig
    I have defragmented the drive.
    I checked the drive for errors.
    I am searching the whole drive for viruses
    I do not have the problem with Redhat Fedora 12 running 11gR1
    I have 1 gig of RAM but cannot install release 2 because the installer expects
    1 gig + 1

    ooops!!! left that off...sorry
    XP Prof SP3 32 bit..*.no problem with Redhat Fedora 12 running MySQL and 11gR1*
    1 gig RAM Dell precision W/S 1.5 Gig rate 74 GiG SCSI HD 15000 RPM
    Don't pass out but I am also running MySQL server 5.1.41 and MS SQL Server Express 2008.
    Lucky it didn't catch fire
    I installed XP prof months ago but this CPU domination occurred only starting last night!
    However slow everything works in 11gR1
    sqlplus myname/password and then select rows from table
    sqldeveloper
    PHP web sites
    I've had plenty of trouble with Java running slow and hogging memory!
    Edited by: landonmkelsey on May 2, 2010 12:21 PM
    Edited by: landonmkelsey on May 2, 2010 12:24 PM
    Let me guess...stop services for MySQL and MS SQL Server and see what happens!
    Edited by: landonmkelsey on May 2, 2010 12:26 PM

  • Netbeans(java.exe) chewing up CPU

    [Please excuse me if this shows up twice but after make my last post this thread never showed up!]
    Hello, everytime I run an emu, no matter which one including wtk, netbeans java.exe starts chewing up lots of CPU time it's like at 98percent and nb comes to a halt and Ihave to wait a few minutes for it to settle down. I really gets bad when I do , "System.out.println()" on a large buffer that really kills it. so I now I can't display large buffers and I have no alternative.
    What can I do to stop java.exe from chewing up cpu time when I run and/or print large buffers?
    My Environment:
    CPU: AMD 64 +3200
    MEM: 1GB
    OS: XP Pro SP2 (version 5.1 )
    EMU: Nokia S60 3rd Ed. / Nokia S40 / Sun WTK 2.5.1
    Java: 1.5.0_12
    VM: Java Hotspot(TM) Client VM 1.5.0_12-b04
    NB Product Ver: Netbeans IDE 5.5.1 (Build 20070422300)
    I would appreciate any help!
    Thankyou.

    I found the problem and once I did find it I googled for it and found a thread right here about it.
    http://forums.lenovo.com/t5/X-Series-ThinkPad-Laptops/X220-Ricoh-Media-card-driver-high-system-cpu-u...

  • Java.exe capped at 50% CPU usage

    Hi forum,
    I have written a program that uses Java2D to draw an image. Each pixel in the image is determined by an equation. When I execute the program, java.exe seems to be capped at 50% CPU usage. It takes a long time to draw these images, so I would like to see 100% CPU! Why is this happening and what, if anything, can I do to fix it.
    Edited by: toaster33 on Jul 11, 2008 9:05 AM
    Edited by: toaster33 on Jul 11, 2008 9:05 AM

    Tip to help speed up your calc and draw processes:
    use Multi-threading
    You must split the byte array up into x amount of groups
    decide on how many bytes each thread will process say 1000
    do calculations and drawLine() in ThreadedDrawer's run method
    Create a class ThreadedDrawer that will make use of Runnable
    public ThreadedDrawer(JComponent, byte[]) OR
    public ThreadedDrawer(Graphics2D, byte[])
    In the other class use the following code
    public void draw(Graphics2D g2d, byte[] data){
      int grpSize = 1000;
      int i = 0;
      for(i=0;i<(data.length / grpSize);i++){
        byte[] grp = //bytes from data[i*grpSize] to data[(i+1)*grpSize]
        new ThreadedDrawer(g2d,grp);
      if(data.length % grpSize != 0){
        byte[] grp = //bytes from data[i*grpSize] to data[data.length-1]
        new ThreadedDrawer(g2d,grp);
    }Ranges should be correct but don't hold me to them its not tested

  • Java.exe *32 is consuming 90% CPU

    Dear Gurus,
    I have production server on which i have Operating System : Windows 2008 R2 Standard Edition. Ram = 4 GB.
    We have observed that java.exe *32 is comsuming 80% - 90% CPU utilization. Please help me in this regard. I have AMD dual processor installed.
    Kindly see below link for screen shorts.
    1) http://i46.tinypic.com/dfc6rd.jpg
    2) http://i45.tinypic.com/34qwpd0.jpg
    If you need any further details for analyzing do let me know. But please help in this regard special thanks
    Thanks
    Adeel Imtiaz

    Malik Adeel Imtiaz wrote:
    Dear Gimbal2,
    Here the problem is in production server and not in the game server there is lot of difference. I wasn't talking about servers. I was talking about processes, like you were. Let me spell it out for you so you can hopefully understand. You are going to a JAVA PROGRAMMING forum to ask why some random Java application is utilizing a lot of CPU. That is nonsense, how can anyone here explain that? The reason is simple: its doing something CPU heavy, nobody here can say what exactly. For all I know it is a busy for loop.
    So yeah I create an example that I hoped would show to you just how ludicrous it is, imagine you having a problem with any native application at all. Lets pick something different than a game since you apparently can't understand the relation properly, so lets pick Microsoft Excel. Its using up 80%, do you go to a C++ programming forum to ask why? No. You ask Microsoft, who built the application.
    But now you're apparently giving more information you were previously hiding. You are now asking why YOUR application is using so much CPU?

  • A process java.exe uses 100% cpu

    This problem stops me start database 10g on Windows XP. I am wondering anyone might have same experience before and could share how to fix the issue. Here is situation:
    Every time when 10g database starts, a process java.exe which is loaded by nmesrvc.exe (I think it is OracleDBConsoleMyInstance, right?) uses 89% cpu forever. Because of this, OEM couldn't work! Shutdowning the database and restarting it didn't solve the problem. Killing nmesrvc.exe can stop the java.exe. SQL*Plus still works. But iSQL*Plus didn't works.
    If I stop process OracleDBConsoleMyInstance from Services of Windows, I got error: Error 1053.
    What is wrong here. Your help will be appreciated,

    I had the same problem and was able to resolve it.
    I am using 2 W2K3 servers, one for infrastructure and one for mid-tier (Portal). On the infrastructure machine I used the Administrative Tools -> Services Management Console and first stopped the OracleDBConsole, CPU was still 100% busy. Then I stopped the OracleINFRAControl and the CPU went to 0%. Then I restarted the OracleINFRAControl and then OracleDBConsole and now the CPU is hovering around 2%.
    I ran some tests from another machine and everything seems fine.
    Bill G...

  • My Applet crashes java.exe to crash

    Ok, I'm not sure why, but on some computers my applet is making java.exe crash. When i attach a debugger to java.exe when it crashes I see a "Access Violation Error". The oddest part is that while one computer will crash and another identical computer with the exact same setup wont. The crash happens the moment the applet starts.
    Now I've done just about everything i could to figure this out. I've installed uninstalled and reinstalled java. I've run ram, hard drive, cpu, ect tests all reporting no problem. I've disabled anti-virus and did the uninstall and reinstall again. I've installed older versions of the java. I've resigned my jar file, created a new key and then resigned. Practically the only thing i have not done and is not a viable solution is reformat/replace the computers. So I'm left thinking it might be something in the applet that is causing it.
    It could be in the applet parameters but i doubt it.
    Pram fp is about 5,000 characters long
    Pram VerfyType is about 1 character long
    Pram Arg1 is a max of 11 characters long
    Pram Arg2 is a max of 11 characters long
    This applet is meant to interact with a program on the computer that connects to a variety of fingerprint scanners that we use and passes information form the internal site to the scanner and vice versa. So it just starts a loop back socket. For the loop back socket, i have tired 127.0.0.1 and localhost which still yield the same result.
    Here is the applet. It's very simple.
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import java.awt.Image;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.MalformedURLException;
    import java.net.Socket;
    import java.net.URL;
    import java.net.UnknownHostException;
    import java.security.AccessController;
    import java.security.PrivilegedAction;
    public class Verify extends JApplet {
         private static final long serialVersionUID = 908206045464466336L;
         public JLabel jLabel1;
        public jPanel jPanel1;
        public String Template = "";
        public String VerfyType = "";
        public String Arg1 = "";
        public String Arg2 = "";
        public Thread t;
        Socket socket = null;
        public void stop()
             jPanel1.threadRun = false;
             if (socket != null)
                  try {
                        socket.close();
                   } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
         public void init()
            //Execute a job on the event-dispatching thread:
            try {
                javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                         Template = getParameter("fp").trim();
                         VerfyType = getParameter("VerfyType").trim();
                         Arg1 = getParameter("Arg1").trim();
                         Arg2 = getParameter("Arg2").trim();
                         initComponents();
            } catch (Exception e) {
                System.err.println("getParameter didn't successfully complete");
            StartVerify();
        private void initComponents() {
              jPanel1 = new jPanel();
              jLabel1 = new JLabel();
              jPanel1.setPreferredSize(new java.awt.Dimension(66, 66));
              jPanel1.setBackground(new java.awt.Color(255, 255, 255));
              jLabel1.setText("Initializing Please Wait.");
            setBackground(new java.awt.Color(255, 255, 255));
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 66, Short.MAX_VALUE)
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 66, Short.MAX_VALUE)
            jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(224, 224, 224)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel1)
                    .addContainerGap(116, Short.MAX_VALUE))
        public void StartVerify()
             t = new Thread() {
              public void run()
                  AccessController.doPrivileged(new PrivilegedAction() {
                  public Object run()
                            PrintWriter out = null;
                            BufferedReader in = null;
                            try {
                                socket = new Socket("localhost", 4001);
                                out = new PrintWriter(socket.getOutputStream(), true);
                                in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                            } catch (UnknownHostException e) {
                                 jLabel1.setText("Unkown Host Error.");
                                return null;
                            } catch (IOException e) {
                                 jLabel1.setText("Unable to get communication streams..");
                                return null;
                            String reponse = "";
                            try {
                                reponse = in.readLine();
                                if (reponse.equalsIgnoreCase("cmd"))
                                    out.write("v\n");
                                    out.flush();
                                    reponse = in.readLine();
                                    if (reponse.equalsIgnoreCase("send"))
                                        out.write(Template+"\n");
                                        out.flush();
                                        reponse = in.readLine();
                                        if (reponse.equalsIgnoreCase("finger"))
                                             jLabel1.setText("Please Have the client place their finger on the scanner.");
                                             while (true)
                                                  reponse = in.readLine();
                                                  if (!reponse.equalsIgnoreCase("pulse"))
                                                       break;
                                            if (reponse.equalsIgnoreCase("good"))
                                                try {
                                                     DoRedirect();
                                                    socket.close();
                                                } catch (IOException ex) {
                                            else if (reponse.equalsIgnoreCase("bad"))
                                                           int _return = LoopTellCanceled(socket, out, in);
                                            else
                                                 jLabel1.setText("Unexpected response from finger print server.");
                                        else
                                             jLabel1.setText("Unexpected response from finger print server.");
                                    else
                                         jLabel1.setText("Unexpected response from finger print server.");
                                else
                                     jLabel1.setText("Unexpected response from finger print server.");
                            catch (IOException ex)
                                 jLabel1.setText("We lost connection to the finger print reader.");
                                 System.err.println(ex);
                            try {
                                out.close();
                                in.close();
                                socket.close();
                            } catch (IOException e) {
                                System.err.println("Couldn't get I/O for the connection");
                                return null;
                            return null;
            t.start();
        private int LoopTellCanceled(Socket socket, PrintWriter out, BufferedReader in)
             int res = JOptionPane.showConfirmDialog(null, "Incorrect Finger Print. Would you like to try again?", "Finger Print was Bad", JOptionPane.YES_NO_OPTION);
             while (res == JOptionPane.YES_OPTION)
                String reponse = "";
                try {
                    out.write("v\n");
                    out.flush();
                    reponse = in.readLine();
                    if (reponse.equalsIgnoreCase("send"))
                        out.write(Template+"\n");
                        out.flush();
                        reponse = in.readLine();
                        if (reponse.equalsIgnoreCase("finger"))
                             jLabel1.setText("Please Have the client place their finger on the scanner.");
                             while (true)
                                  reponse = in.readLine();
                                  if (!reponse.equalsIgnoreCase("pulse"))
                                       break;
                            if (reponse.equalsIgnoreCase("good"))
                                try {
                                     DoRedirect();
                                    socket.close();
                                } catch (IOException ex) {
                            else
                                 res = JOptionPane.showConfirmDialog(null, "Incorrect Finger Print. Would you like to try again?", "Finger Print was Bad", JOptionPane.YES_NO_OPTION);
                } catch (IOException ex) {
                     System.err.println(ex);
             return res;
        public void DoRedirect()
              try
                   if (Arg1.equalsIgnoreCase(""))
                        getAppletContext().showDocument(new URL("javascript: fprintVerified("+VerfyType+");"));
                   else
                        if (Arg2.equalsIgnoreCase(""))
                             getAppletContext().showDocument(new URL("javascript: fprintVerified("+VerfyType+", "+Arg1+");"));
                        else
                             getAppletContext().showDocument(new URL("javascript: fprintVerified("+VerfyType+", "+Arg1+", "+Arg2+");"));
              catch (MalformedURLException ex)
                   ex.printStackTrace();
    }Edited by: Pyromanci on Mar 1, 2011 7:58 AM

    What does your error console report? - Which one? Browser, PC, ect
    How about your java console say? - I have no clue what it could be saying since java.exe crashes the moment the applet starts the console is no longer accessible.
    What browser and version? - Firefox v3.6.13
    Have you tried a different one? - Yes Ie 6,7, and 8. Though the site the applet runs form was designed specifically for firefox (internal site)
    Have you tried Appletviewer? - Yes applet runs as intended.
    Did you give the Applet permission? I know you said you signed it - did it all go right? - Yes. Gave me the usual response of will expire in x months

  • Problem with java applications - java.exe in loop

    Hi
    I just install j2sdk1.4.1_01
    I got a problem:
    when I run any code without graphics (clasic hello world with println) everything run fine
    when I try to run anythig else (with some swing) the java.exe process start to use 100% of the CPU and never end (probably a loop)
    The same think happen when I launch Java web Start so I suppose that the problem is not the code (I just use some dialog with one or two buttons and the application run fine on other pc).
    My system:
    OS: w2k server - SP3
    CPU: P4 1.8GHz
    RAM: 512 MB
    several services running: IIS with dhcp server, DNS server.
    The system was scanned and no viruses are found.
    I unistall everything (j2sdk, jre, web start) and I got the same after reinstalling them.
    I launch the application from the comand line and the results doesn't change.
    I install a different version of SDK (02 instead of 01) but nothing change.
    The same happens if I try to use jbuilder8.
    Any idea

    Try updating DirectX.

  • Java.exe - power hungary program?

    Ok, this is a very weird problem (I think). A few times now, I've run a java program (using java <classname>) and my computer (top of the line Dell Inspiron 9100, very fast, 1 gb of RAM) has slowed considerably. To put it in perspective, I've rendered a video using Premier, at the same time as playing Counter-Strike, with no noticable decline in performance. Now, for the real proof, I've used Task Manager every time to find the problem. Every time java.exe has been using greater then 95% of my CPU. It has Hyper Threading, and Both CPU's are hitting 100%. It's a very fast jump from normal operating to ~100%, and it'll platue there, until I close the java.exe process. I can't imagine why it's doing this, can you? Should I be using any sort of arguments in the command. I also (the last time, I can't remember the others) was using a batch file to run my program. Will THAT effect anything? (I've never in my years dealing with computers, seen a shortcut/batch file clobber the CPU).
    Ok, the other program factors. At the time this happened, I was running a Server I wrote for a game I'm making. I was also running the client (both are threaded) at the same time (well duh, when else would I run the client thwap). I can provide code for both, if need be, they're short enough. I have run both at the same time before, and did here for about two minutes before I noticed the CPU acting up.
    Any thoughts are appreciated, solutions even more so :) Thanks for your time!

    I was assuming that it was the "author of <classname>'s fault, namely, me. But the circumstances are weird, and I can't duplicate them. Here's an update.
    I just re-ran the combination of my two programs, and while one spiked to 73% when it loaded (the GUI client), neither of them took much CPU. It ran at about 15% the entire time kI was testing (and running some music, and browser). This is completly normal. So, I tested using multiple copies of the Client, multiple servers, and neither had the desired (or rather, undesired) effect. I tested running one from jGRASP< one from the Batch file. I tested both from the batch file, no luck. I'm completely stumped. Yes, I am running the latest 1.4, not going up to 1.5 (or should I say 5, or perhaps Tiger?) until it's out of Beta. This has happened, by my account, 4 times in the past, and it's always been with classes I use a lot. Now it's seemin to me that its some weird case that my classes are just eating java.exe, but I can't imagine how. Here's my two thread (i.e. the classes, minus the initializers).
        public class Server implements Runnable
           public void run()
             while(connected)
                try
                   socket = serverSocket.accept();
                   socket.setSoTimeout(200);
                   new Player(socket, me);
                   numberOfPlayers++;
                   System.out.println("New player " + numberOfPlayers + "!!\n" + socket.getInetAddress());
                    catch(IOException e)
                      e.printStackTrace();
        public class Player implements Runnable
           public void run()
             while(socket.isConnected())
                try
                   String toPrint = input.readLine();
                   System.out.println(toPrint);
                    catch(IOException e)
    }No, so far I don't actually talk to the Player class, it just creates itself. The Client class is just a GUI that accepts input from a Menu, or textField (not implemented yet, save to copy the text to a Text Area). If you select connect, you connect to my server, and it asks for a name. That's all I have so far, and I can't see that either of the threads would cause a problem. ANy suggestions appreciated. Thanks

  • Web Analysis is degrading system performance (java.exe)

    Hello Everyone,
    We have got a situation here. Each time we start the web analysis studio, java.exe starts taking up 60-70% of the CPU. The system works almost fine for a few minutes, but after opening up a few dashboards and/or some reports, the system stops responding and reports take more than 30 minutes to open up. Task Manager shows up java.exe taking up 100% CPU.
    The system configuration is as follows:
    Intel Xeon 1.8 GHz Duo
    2 GB Ram
    Windows 2003 server.
    Can anyone suggest any possible reason or solution?
    Thanks.
    Regards,
    Sayantan

    See if this helps. On one of your client machines set the Java heap size:
    Start | Settings | Control Panel
    Double-click Java, which opens the Java Control Panel
    Choose tab "Java"
    under "Java Applet Runtime Settings" click "View" button
    under "Java Runtime Parameters" paste this as-is:
    Xms64m -Xmx128m -Xss4m
    If that still fails try tweaking those numbers for your environment, probably decrease them.
    -Karen

  • Java.exe looping

    I have purchase the core jave v1 fundamentals book. When I try to compile and execute the SimpleFrameTest in chapter 7, I get no response and java.exe is consuming 1 cpu. I have a dual processor machine running windows 2000 professional. I have two monitors and 2 video cards...version is
    C:\CoreJavaBook\v1ch7\SimpleFrameTest>java -version
    java version "1.3.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
    Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

    thanx for the reply....i figured out what was happening overnight....i never re-booted my machine after installing the jdk. after rebooting all works well....thanx

  • Plugin-container.exe占用cpu太高

    plugin-container.exe在看在线视频的时候占用cpu太高,我已经降FLASH到10.3版本了,并且将dom.ipc.plugins.enabled和dom.ipc.plugins..java.enabled改成False仍然占用很高,只是没有以前那么高了,我想问问,在最新版本的火狐浏览器中如何关闭plugin-container.exe这个程序,简直太烦了这个程序!~~

    Firefox 3.6.4 introduced this plugin-container.exe to make sure that plugins are better behaved. So if you're watching a video or playing a game and it crashes because of a faulty Flash plugin, only the plugin will crash and it wouldn't take down all of Firefox.

  • Java.exe has encountered a problem and needs to close.

    I installed Oracle8i on my P4 then when I reboot I get the error "java.exe has encountered a problem and needs to close." even if I click on "don't report" if keeps popping up, anything to do to resolve this?
    Thanks.

    Hello...
    i had the same problem. then when i searched oracle documentation, it suggested as follows:
    1. go to your %ORACLE_HOME%\Apache\Apache\conf\httpd.conf
    2. comment out 2 lines that has
    include ....\jserv.conf
    include ....\oracle_apache.conf
    so your new line will be:
    #include ....\jserv.conf
    #include ....\oracle_apache.conf
    Those lines are at the end of the file.
    3. save the file.
    4. reboot your machine.
    that solution works for me.. hope it works for you too.
    GOOD LUCK!
    --Melani                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Error while running java.exe

    Hi,
    I have installed JDK1.4 on Windows NT4.0.
    The path where the "javac" and "java" are is "D:\jdk1.4\bin."
    I have added this directory to the PATH variable.
    I have no problem when executing "javac" from any location(Directory) where as its reporting an error "no 'client' JVM at 'D:\\bin\client\jvm.dll' ".
    And the same is not reporting any error if I execute it by giving the complete path or if I am in the same directory i.e D:\jdk1.4\bin.
    Regards,
    Sridhar.

    Did you add "D:\jdk1.4\bin" to the end of the Path variable? Perhaps the OS is finding another java.exe before it finds the one in d:\jdk1.4\bin. Try putting "D:\jdk1.4\bin;" at the start of the Path variable.

  • Hi i wrote a java program for scanning a system for java.exe 's

    hi ,
    i wrote a program which scans the system for java.exe 's and then it captures them in a linked list and then i
    iterate through it for "\\Java\\jdk1.5.0_08\\bin\\java.exe and my aim is to return true in case the linked list contains the string "\\Java\\jdk1.5.0_08\\bin\\java.exe" and stop scanning the system.
    If the linked list does not contain "Java\\jdk1.5.0_08\\bin\\java.exe" it should return false.
    But my problem is the program is continuing to scan the system even if the linked list has "\\Java\\jdk1.5.0_08\\bin\\java.exe"
    Any sort of help is appreciated.
    The code is as follows:
    package com.installanywhere.exper;
    import com.zerog.ia.api.pub.CustomCodeRule;
    import com.installanywhere.exper.SearchTool;
    * @author
    public class eFileTool extends CustomCodeRule {
         /* (non-Javadoc)
         * @see com.zerog.ia.api.pub.CustomCodeRule#evaluateRule()
         @Override
         public boolean evaluateRule() {
              // TODO Auto-generated method stub
              SearchTool searchtool=new SearchTool();
              boolean valueTocheckfor=false;
              valueTocheckfor=searchtool.find();
              String someothervalue=Boolean.toString(valueTocheckfor);
              if(someothervalue.equalsIgnoreCase("true")){
                   return true;
                   //System.exit()
              else if(someothervalue.equalsIgnoreCase("false")){
                   try {
                        Thread.sleep(5000);
                   } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
              System.out.println(valueTocheckfor+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
              return valueTocheckfor;
    The code of search tool is
    package com.installanywhere.exper;
    import java.io.*;
    import java.util.*;
    public class SearchTool
         * @param args
    static     boolean valuesToReturn=false;
    static     boolean anothervalueToRefer=false;
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              SearchTool           t = new SearchTool();
              System.out.println("xxxxxxxxxxxxxxxxxxxx");
              boolean someArgument=t.find();
              System.out.println(someArgument+"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"+"");
                   public boolean find()
                        System.out.println("2222222222222222222");
                   boolean someThing=searchcomp("java.exe");
                   System.out.println(someThing+"inside the othere one");
                   return someThing;
              public boolean searchcomp(String file)
                   System.out.println("3333333333333333333333");
                   File[] drives=File.listRoots();
                   boolean valueIdentified=false;
                   for (int ctr=0;ctr<(drives.length-1);ctr++)
                        valueIdentified=search(drives[ctr],file);
                        System.out.println("4444444444444444444");
                   System.out.println(valueIdentified+"something i need to accomplish");
                   return valueIdentified;
                   public boolean search(File dir,String file)
                   File[] directories=dir.listFiles();
              System.out.println("55555555555555555555555");
                   if (directories == null)
                        System.out.println("666666666666666666666666");
                   return false;
                   for(int ctr=0;ctr<directories.length;ctr++)
                        if(directories[ctr].isDirectory())
                             System.out.println("77777777777777777777777777");
                             valuesToReturn=search(directories[ctr],file);
                             System.out.println(valuesToReturn+"india is great");
                        else
                             if(directories[ctr].getName().equals(file))
                                  String path = directories[ctr].getAbsolutePath().toString();
                                  System.out.println(path);
                                  List someList=new LinkedList();
                                  anothervalueToRefer=allPaths(path);     
                                  System.out.println(anothervalueToRefer+"god damn it");
                                       //System.out.println(anothervalueToRefer+"let me seeeeeeeeeeeeeeeeeee");                                        
                                  return anothervalueToRefer;
                   return valuesToReturn;
                   public boolean allPaths(String allPath)
                        List l=new LinkedList();
                        String somepath=allPath;
                        l.add(somepath);
                        //return l;
    /*if(l.contains("C:\\Program Files\\Java\\jdk1.5.0_08\\bin\\java.exe")){
                             System.out.println("yepeeeeeeeeeeeeee");
                             //System.exit(0);
    else{
         System.out.println(" the face");
                        ListIterator li = l.listIterator();
                        System.out.println("inside the method of all paths");
                        if(li.hasNext())
                             if(li.next().toString().contains("\\Java\\jdk1.5.0_08\\bin\\java.exe"))
                             System.err.println(somepath+"this is the path i wanted to resolve correctly");                         
                             return true;
                             else{
                                  System.out.println("trueeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
                                       return false;
                        else {
                                  return false;
         }

    A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.
    *http://forums.mozillazine.org/viewforum.php?f=25
    The helpers at that forum are more knowledgeable about web development issues.<br>
    You need to register at the MozillaZine forum site in order to post at that forum.

Maybe you are looking for