http://wiki.eclipse.org/Jetty/Tutorial/Jetty_HelloWorld
Java ecosystem is too big, and it is common for newcomers to overlook the juicy parts. The mainstream frameworks and libraries reflect the mainstream use of java: big apps for medium/big companies.
You may wanna try playing with some variables. With the following command line:
java -cp .:servlet-api-2.5.jar:jetty-all-7.0.2.v20100331.jar -client -XX:MaxPermSize=1M -Xmx2M -Xms2M HelloWorld
I've added -client -XX:MaxPermSize=1M -Xmx2M -Xms2M. It took it down to 7Mb from 9Mb. However, this should not concern you in VPS/Amazon EC2 instances, as you can always run linux there, and these problems should not come by.$ java -cp .:servlet-api-2.5.jar:jetty-all-7.0.2.v20100331.jar -client -XX:MaxPermSize=1M -Xmx2M -Xms2M HelloWorld Error occurred during initialization of VM Too small initial heap for new size specified
I can't get it to run in under 30MB RES according to top. This is after hitting it with a little traffic, i'm not sure if you hit yours with any traffic.
Note that depending on the enverionment it may say it is too small, so you may have to ramp up a bit some of these stats. I also get it if I set lower than then ones I gave.
Note that jvm is very tunnable[1,2]. Also note that you can use a 32 bit jdk in a 64bit machine. It won't get you beyond 2GB vm, but if you are going for small memory, this is not something that matters (and it should allow you to get to a very small memory footprint).
Also note that there are other JVMs, like Oracle's JRockit (with extra memory options[3]), and KVM[4] (designed for small memory footprint[5]).
But hey, that is lower than 32 MB already!
Edit
You can also try some other lesser drastic measures[6,7]. Note that you are getting in less mainstream use of the JVM, and things can get a little crazy in this area.
[1] http://www.oracle.com/technetwork/java/javase/tech/vmoptions...
[2] http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp
[3] http://download.oracle.com/docs/cd/E15289_01/doc.40/e15060/t...
[4] http://en.wikipedia.org/wiki/K_virtual_machine
[5] http://java.sun.com/products/cldc/wp/
[6] http://www.coderanch.com/t/202896/Performance/java/Ways-redu...
[7] http://stackoverflow.com/questions/4893192/process-memory-vs...
I think the commenter you're quoting is confusing the heap size with the total size. Or I'm missing something and would love for someone to show me what I'm missing.