Sometimes measuring time using the trusty System.currentTimeMillis() static call isn’t of high enough resolution to measure the execution time of methods with any meaning. Fortunately for those facing this problem, Java 5 introduced a method of accessing the system’s most precise clock through the System.nanoTime() static call. This returns a long that represents the current clock time in nanoseconds, easily solving the problem of measuring time more precisely than milliseconds can provide.
Thus ends another quick post, get back to work :)
A quick search on google for “Reading environment variables in java” yielded a lot of (older) documentation stating that System.getEnv(”varname”) has been deprecated. This is no longer accurate, as System.getEnv(”varname”) and System.getEnv() have been reinstated as of Java 1.5. Quick post, I just wanted others to know that the API again exposes those useful method calls.
GCJ, the GNU compiler with java extensions, does a great job at compiling Java into bytecode, but still has some bugs in its libraries when dealing with Swing components. Installing Sun’s Java packages on Debian thus is occasionally necessary, and has historically been a chore. I won’t list the process here to even show my distaste for it – it just wasn’t very fun.
Things are much easier now, though. Just make sure a non-free package repository is listed in your sources.list, and things become magic:
sudo echo "deb http://ftp.us.debian.org/debian/ lenny non-free" >> /etc/apt/sources.list
(Note that if you aren’t using lenny, you should change that. Also, feel free to choose a different mirror.)
Now update your package repository:
sudo apt-get update
And finally install whichever Sun Java packages you want!
sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin
Cheers to Matthias Klose (Ubuntu), Juergen Kreileder (Blackdown), Barry Hawkins, Jeroen van Wolffelaar, and the other folks behind debian-java for adding these packages to Debian’s repositories. It is another push that greatly enhances the usability of the project for both developers and users alike.