Archive for the ·


· Category...

Java 7 Released

1 comment

Oracle (finally) released Java 7 today, 4 years and 7 months after the initial release of Java 6. The previous version updates used to be on a 18 months schedule, so that makes this release 37 months late. It’s getting a pretty good bashing on Slashdot, primarily for its current owner, Oracle.

New features includes syntactic sugar like Strings in switch statements; underscores in numeric literals; and type inference for generic instance creation. The Open JDK site lists the same features, so I’m guessing that means everything is open sourced already. However, it seems smaller items on my wish-list did not make it, like the Immutable annotation. (The JSR 305 has been inactive for ages, and still the only implementation is a Google Code hosted project.)

The new Java Doc is here, and latest download from Oracle here. The Open JDK binaries are also available in the repositories of major distributions.

yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel

sudo apt-get install openjdk-7-jre openjdk-7-jdk

Java Applet Test

Comments Off

Mostly for my own reference: An old Java Applet which I continue to use to verify that Java Applets works. The applet itself is demonstrating Casteljau’s algorithm to draw a B├ęzier_curve.

You can move the red control points, and then animate the drawing of the curve.

Comments Off

Back references in Java regexp

Comments Off

The Java API documentation for regular expressions says that:

Back references
\n Whatever the nth capturing group matched

This seems to be difficult to get working though. Here’s an example of a work-around:
str.replaceAll(“user(.*)”, “$1″)

“username” => name

Comments Off