?
Solved

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

Posted on 2003-03-26
8
Medium Priority
?
2,070 Views
Last Modified: 2007-12-19
Hi!
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.

BUT...
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!
AntiBit
0
Comment
Question by:AntiBit
7 Comments
 

Expert Comment

by:Zeroshade
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?
0
 
LVL 92

Expert Comment

by:objects
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.

0
 
LVL 2

Expert Comment

by:bkrahmer
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.

brian
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 

Author Comment

by:AntiBit
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?
0
 
LVL 92

Accepted Solution

by:
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.
0
 

Expert Comment

by:CleanupPing
ID: 9058472
AntiBit:
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 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month6 days, 16 hours left to enroll

594 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