Navigation | Category » Java

September 3, 2008

Difference between a Java interface and a Java abstract class

Methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior.
Variables declared in a Java interface is by default final. A Java abstract class may contain non-final variables.
Memebers of a Java interface are public by default. A Java abstract class can [...]

Filed by Paul Gu at September 3rd, 2008 under Java
2 persons have commented this post

July 19, 2008

6 Common Errors in Setting Java Heap Size

Two JVM options are often used to tune JVM heap size: -Xmx for maximum heap size, and -Xms for initial heap size. Here are some common mistakes I have seen when using them:
    * Missing m, M, g or G at the end (they are case insensitive). For example,
      java -Xmx128 [...]

Filed by Paul Gu at July 19th, 2008 under Java
No comments on this post yet

July 19, 2008

Increase Java heap size

If Java runs out of memory, the following error occurs:
Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
This can have two reasons:
    * Your Java application has a memory leak. There are tools like YourKit Java Profiler that help you to identify such leaks.    * Your Java application really needs [...]

Filed by Paul Gu at July 19th, 2008 under Java
No comments on this post yet

July 18, 2008

Debugging Tomcat as an External Tool from Eclipse

You can also configure Eclipse to be able to start and stop tomcat as a program (this approach also seems to work well on Windows). To configure Eclipse to be able to start and stop tomcat:

If you have not already done so, set a breakpoint somewhere in your code (preferably something not associated with startup) [...]

Filed by Paul Gu at July 18th, 2008 under Java
No comments on this post yet

July 18, 2008

Setting Up Tomcat For Remote Debugging

To configure tomcat to allow remote debugging, start tomcat using the catalina startup script (from your tomcat home) instead of the normal startup script like so (tomcat must be stopped before you can change over):
WIN:
set JPDA_ADDRESS=8000set JPDA_TRANSPORT=dt_socketbin/catalina.bat jpda start
UNIX:
export JPDA_ADDRESS=8000export JPDA_TRANSPORT=dt_socketbin/catalina.sh jpda start
We recommend adding this stuff to your startup script so that you are [...]

Filed by Paul Gu at July 18th, 2008 under Java
No comments on this post yet