This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, This is my very first visit to this saloon (my frnd suggested visiting place).I hope this is a friendly place.
when I say java Hello.java: 1. will the OS start a new JVM ? (prepare JVM, load it in momory & run it) 2. By default how much physical memory will JVM occupy? 3. can I check total memory available beforehand and allocate some % of it to the JVM? (like I have 512MB RAM every time I run the a java program can I ask JVM to occupy about 50% of memory?)
You can't "java Hello.java". You must compile "Hello.java" to "Hello.class" using the compiler, "javac". Then you can "java Hello".
The "java" command starts a new JVM to run your specified class. There are other ways to run Java applications, such as applets, application servers, custom launchers (JNI invocation interface) etc, but the "java" command is the main one to think about, as a beginner.
The JVM started by "java" command will take some memory for its own code, some for its internal data, some for loaded classes, some for stacks for local variables, and some for the heap on which your objects will be stored. There are parameters (e.g. "-Xmx") to the "java" command through which you can control stack size and heap size. The defaults will usually be fine for beginners, however.
To my knowledge, the "java" command cannot be told to take a percentage of the available memory. It's a nice idea - Sun, are you listening?! An advanced Java user could write their own launcher to do that, I guess.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.