Weird Problem: Difference between javaw.exe and java.exe (?)

Posted on 2003-03-26
Medium Priority
Last Modified: 2007-12-19
I hav programmed a little app and noticed a very weird memory-poblem:

When I create an executable-jar File of my compiled source and run the App,
the task-manager tells me that this process ("javaw.exe") needs ~20 MB of Memory.
That's way too much, it is no big application... And it doesn't get less, indeed it
does increase the amount of needed RAM a little bit.

When I directly open a DOS-Propt and start my App. by typing "java ProgramName", then
the TaskManager tells me that this process ("java.exe") needs ~20 MB of memory, too.
But after a few minutes the amount of needed RAM decreased to about 240 KBytes! Like
it should be...

So what is the difference between javaw.exe and java.exe?? Why does running the JAR need permanently
that much memory (20 MB), while normal executing behaves as it should normally behave (pending memory-use
between 200KB and 8 MB). How can I change that?

Thank you for your answers!
Question by:AntiBit
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8213210
From what i understand javaw.exe is used for gui based applications where as java.exe isn't. My guess would be JVM is requiring that much memory to handle the gui actions?
LVL 92

Expert Comment

ID: 8214271
> RAM decreased to about 240 KBytes

Thats seems really low.

The amount of heap allocated to the JVM can be controlled by the command line options -Xms -Mmx. Have a look at "java -X" for more details.


Expert Comment

ID: 8215863
AFAIK, the only difference between java and javaw is that java interacts with the console, and javaw runs without a console (stdin, stdout, and stderr won't work), and without a window for that matter.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 8219625
Thanx for your comments!
Ok, now I know the difference between java and javaw, but that doesn't explain why the javaw.exe memory increases and increases and doesn't seem to do any garbage-collecting.

But java.exe does...
Why? What can I do to change this?
LVL 92

Accepted Solution

objects earned 500 total points
ID: 8222760
The only difference between the two is that one has a DOS console and the other doesn't. Any memory difference is possibly due to how Windows is handling the processes.
Use the Runtime class to see how much memory is being used by directly by the JVM.

Expert Comment

ID: 9058472
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
LVL 15

Expert Comment

ID: 9732800
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept objects' comment as answer.

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month9 days, 6 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question