?
Solved

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

Posted on 2003-03-26
8
Medium Priority
?
2,052 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
[X]
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
8 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
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

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

[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