If you have a log file that you want to monitor the incremental changes, you can use the following simple code. Whatever new log entries written to the log will be quickly picked up and printed out to console. It does not interfere with the application that writes the log file. To test the code, you can use any text editor to append more entries to the end of log file (don’t forget to save it).
It’s pretty straight forward to run Maven based projects in NetBeans IDE. For some projects that involve console related capabilities, you have to run it from OS console. One example is projects that use the JANSI APIs for colorful console output (see my last post for a sample). If you run the code within IDE, you won’t see the colors as would in a console.
Almost all of the Java console application I had seen were boring black background and white fonts on Windows. This can be changed using a small Java library called Jansi which is open sourced under Apache 2.0. The download link can be found at its project home. The source code is also available on Github here.
If you develop a command line tool, you would probably need to parse options and arguments. In Java, you can use Apache Commons CLI to handle the parsing. Since I don’t write much command line program, I don’t need these tools. While reading vCO API sample, I found one command line tool called args4j which is written by Kohsuke Kawaguchi who had created the famous Hudson/Jenkins server.
While using Netbeans IDE to generate Javadoc for a Maven project, I noticed the generated pages has a default copyright notice at the bottom of every page, say “Copyright 2013. All Rights Reserved.” Because it’s default, it does not show the name of copyright owner. To change it, I found it’s not really straight-forward, therefore it may be worthwhile to share it.