Monday, November 22, 2010

[Java] What will be printed to a console?

ArrayList<Integer> list = new ArrayList<Integer>();

Thursday, November 18, 2010

Note for starting new Eclipse workspace

  • Import Formatter.
  • Customize Save Actions.
  • Set text editor "spaces for tabs" and "displayed tab width".
  • For MacOSX, change "Content Assist" short-key.
  • Set content assist to help import favorite static members.

Monday, November 1, 2010

[Java] Jars inside Jar

Jar that contains multiple jars inside is not support directly by Java. There are some workarounds on this.
  • Put jars in to jar as ordinary files then load them with your own customized classloader. There is a tool such as One-JAR™ but some people told that it causes performance problem (I have not try this).
  • Extract jars to .class and pack them together to a single jar. You can archive this easily with Ant's Zip Task
For me, I choose the second approach. There are more workarounds in reference links below.

Java: Easiest way to merge a release into one jar-file
Is it possible to package all the jar dependencies in one big jar ?

Clojure how to get JVM options from inside application

(.getInputArguments ( Credit:  How to get vm arguments from inside of java applic...