Java Notes

Skip to end of metadata
Go to start of metadata

Debugging

Running Tomcat in debug mode

  • Edit catalina.sh and add:

Running JBoss in debug mode

  • Edit run.conf and uncomment:
  • OSX change: edit run.sh and on line 79 change:

Connecting to a remote app from Eclipse

  • Run > Debug Configurations > New
    Connection Type Standard (socket Attach)
    Host localhost
    Port 8000

Eclipse notes

Setup

  • Import the Java code style formatter: code-style-formatter-v1.0.xml
  • Import eclipse preferences: eclipse-preferences.epf
  • html, htm, css file assoications
  • Text Editors: tab width to 2, insert spaces for tabs, print margin, line numbers
  • Sync cvs / svn after checking out

Java notes

Bytes in Java

Bitwise and Bit Shift Operators

C style String formatting

Create String from Date

Create Date from String

Create Date in the past

The for loop with Generics - Java 6

Log4J

  • Logging levels:
  • Reference log4j.properties

Reference JMock

JMock notes

Reference Junit testing for thrown exception

Loading properties

Starting an application with a debug listener

  • To start tomcat or resin with a debug port open, add the following arguments to the start:
  • In this case, connections from localhost to 8000 will be accepted.
  • Port 8000 is the default port for Eclipse.

Setting up jmx localhost

  • Start the java application with -Dcom.sun.management.jmxremote.
  • Then start jconsole from the localhost.

Jetty configuration

Fixing the windows shortcut

  • The default behavior of a windows folder short cut is to open a folder without the left "folders" tree and to only ever open one window (clicking the link just brings the open window to foreground.)
  • Replace the target in the Properties window to:
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.