Thursday Dec 03, 2009

Year of the store - Java Store

As usual, the picture tells the story, for more details, read below ...

The Chinese zodiac calls 2009 as the year of the rat. I'll argue that in the tech world it has been the year of the store (Nokia, Samsung, Microsoft, Google, etc.). The Java team has recently released a new UI of the Java Store client. The interface is written in JavaFX and the backend services are running on an Enterprise GlassFish deployment. Folks that want to get a better idea of what the store does and the developer angle (value proposition) should watch this excellent video.

If you are inspired enough to install the store, you can exercise the easier install in the history of software development :-)

Monday Nov 16, 2009

Java Store application cleanup

I assume that most of the people in the Java community have already noticed that the Java team at Sun has released a beta version of the Java Store. Lots of details about the launch can be read here. If you are a consumer that uses the store, you have several options of installing and uninstalling the applications that you've installed from the store. I'll focus on the more obscure ways of uninstalling apps on Windows:

  • end user - launch the store, open the My Apps menu and uninstall at will
  • advanced user - launch the Start | Control Panel | Programs | Uninstall a program | look for the application by name, select it and choose Uninstall from the menu of the Windows application
  • developer - Open the Java Control Panel (Start | Control Panel | Choose Classic View | Java | General | Settings; here you either choose to delete all files or follow the path (e.g. C:\\Users\\<username>\\AppData\\LocalLow\\Sun\\Java\\Deployment\\cache) to where the apps are installed and give it your best shot. I really don't recommend doing this
  • hacker - javaws -uninstall <jnlp app name>; note that if you just call javaws -uninstall it will uninstall all Java Web Start apps from your system

Monday Nov 02, 2009

Java database application performance

Web enabled database applications is one my favorite old pastime. I've built tools for this usecase. There are many ingredients that go into making a technology decision as you are building a site and the choice of database (assuming that you have that choice). For convenience, many folks use PHP & MySQL on the front end since they is part of the LAMP stack. Others choose JavaServer Faces since it is already part of the Java EE standard and provides a rich component set as well as the ability to easily bind to data sources. No matter what choice you make, one will have to deal with the performance considerations as they build their tiered application.

A good opportunity to tune your performance skills will be available Nov 5th during this webinar. Mark is an expert and you'll be able to learn directly from the source (author of the Connector/J driver).

Wednesday Oct 21, 2009


The NetBeans team (Tomas, Jirka & all) has just released version 1.2 of the VisualVM, Java profiling and troubleshooting tool. A bunch of good stuff in this release:

  • Sampling CRU and memory profiler
  • Redesigned charts with dynamic tooltips (my favorite feature by far)
  • Enhanced support for jstatd connections

I've already had a version the visualVM that came with JDK 6 update 16 (look in <JAVA_INSTALL_DIR>/bin/ for jvisualvm executable), however these new improvements made it worthwhile to install the stand alone version as well.

Thursday Oct 01, 2009

Java at Oracle Open World

Oracle Open World is approaching fast and the Java team is signed up to present a few sessions and give a few demos. There are a few new highlights since Java One (June '09). First of all the Java Store, while still in beta, is completely redesigned. Second the Authoring Tool for JavaFX seems to be ready for the Early Access program. You'll also see JavaFX on a few handheld devices, also on a TV.

If you end up attending the Oracle Develop portion of the conference, I highly recommend the "Intro to JavaFX ..." session by Richard Bair and Stuart Marks. You'll get to meet the cool folks that are building this extension of the platform, get some details on the upcoming release of the platform, the obligatory demos, etc.

Monday Sep 14, 2009

Java Store and license management

The Java Store that was previewed during Java One earlier this year is getting ready to release support for paid applications. Developers who are getting ready to publish apps to the store should be aware of the license rights management facility. Here are the requirements in a nutshell:

  • Is transparent to users
  • Ensures users stay within their usage rights
  • Ensures that simple script based attacks to remove the rights management code aren't feasible
  • Eliminates the need to have an online connection when the application is used
Here is some sample code on how to use license management in your application:[Read More]

Duke's gallery

If you are looking for Java's mascot - Duke art work, you can now find it here. It is stored on the same infrastructure ( that powers many other open source projects.

Thursday Jul 16, 2009

Java and the Centaur

Nowadays there is a lot of hype about Netbooks. I've seen several projection from our marketing folks talking about the potential growth. I finally gave up and decided to find out for myself if the Netbooks are worth ones time. I am mostly interested how Java (SE) fares on these hybrid devices. Given that the netbooks are small notebooks that exibit many of features and behaviours if a smart phone, I'll call them personal centaurs

[Read More]

Thursday Jun 25, 2009

Contributing to OpenJDK

There is no secret that the Java community would like talented developers around the world to contribute their expertise to the OpenJDK project. There are many ways to contribute and not all of them have to include writing code. Though, I suspect that most of the folks are interested in scratching their itch (read - fix an annoying bug or adding their favorite lang feature). In my case I want to introduce #ifdef in Java (I still miss that from my days programming in C).

With that in mind, I decided to try to become an OpenJDK contributor and see where the community will guide me, based on expertise and skill set.

My enthusiasm was spoiled upon reading the contribution process. Having to fax the SCA is rooted in the 20th century. I pulled the sources from the repository without much fuss and I was pleasantly surprised by how fast is Mercurial. The documentation advises you to find a sponsor. Read ahead, since it seems that a sponsor is needed just for the basic setup :-).

Building OpenJDK (on Windows) should a lot simpler. The instructions on the project website are generally clear, however I could not find easily any info how to build the sources. I googled the topic and found some instructions which made me cringe. I have some of the software requirements other than cygwin. The rest seems very archaic. 

Once I have more time, I'll get back to the build process and I hope to come up with some suggestions on how to improve the process. Perhaps that will be a form of contribution in itself!

Thursday May 28, 2009

JVM Language Summit

Brian Goetz and the VM folks are doing it again - the 2009 JVM Language Summit. Come share your programming language expertise with industry experts and the JVM crew. There will be a number of traditional talks as well as time to interact with subject mater experts in informal settings.

Sept 16-18 (Sun campus in Santa Clara, CA)

Friday May 22, 2009

Java for Business

Java One is around the corner and many times developers and analysts ask us how we make money with Java. In Jonathan's blog you get a glimpse of how we leverage the ubiquity of Java on the Windows desktops to sell distributions services. There is also licensing and middleware/hardware enablement via world class performance of our VM. One of the less known programs that enables us to monetize Java in the enterprise is Java for Business. Lot's of details on the website, however if you don't have the time, here is the offering in a nutshell:
  • A subscription service offering that provides more control for customers that depend on our software while developing a compelling partnership/relationship between Sun's key customers and Sun's Java experts
  • A replacement and enhancement for Java Multi-Platform Support offering
  • A framework to offer a wide range of requested services and features to our customers
    • Porting, tuning, custom work, special builds, emergency fixes, long-term support, etc.
    • Desktop, asset management, etc.

Friday Apr 24, 2009

SDK 3.0 for mobile Java developers

Craig Gering's team recently released the Java ME SDK 3.0. The bundle includes the Java Wireless Toolkit 2.5.2 and JavaToolkit 1.0 for CDC. The tooling is predictable (in a good way): emulator (Windows only for now) and utilities for rapid application development using CLDC/MIDP, CDC and BD-J. In addition you also get LWUIT support. This is cool, especially since I've seen very rich UI on HTC phones at the MWC in Barcelona earlier this year.

The SDK will be complemented later on this summer by the release of Java FX 1.2. The team is shooting for Java One in June. I am looking forward to seeing on devices on the show floor.

Thursday Apr 16, 2009

Students get in full access at Java One

The Java One 2009 Conference will give full access (general and technical sessions, hands-on-labs, etc.) to all students that can make the trip. This new program provides students a huge opportunity to learn, network and interact with industry experts.

Friday Apr 03, 2009

Ricoh and Java Developer Challenge

I had a great time at the Ricoh & Java Developer challenge in London. I represented Sun, one of the sponsors of the this University event, and judged the submissions by the five finalists of the contest.

Being the judge was quite an interesting experience. I was truly inspired by the innovation and dedication of the students from Norway, Spain, Germany, France and Hungary that presented projects at the competition. Submissions ranged from Optical Mark Readers, to Context aware Multi Function Printers (MFP) software. Judging had to take into account both technical and business point of views. Hungary (Zoltan Szabo & Balazs Lajer from University of Pannonia) won, by a hair ahead of Germany. Congratulations to all the students and professors involved.

Tuesday Mar 24, 2009

JDK 7 features

Mark Reinhold just published a blog which details the list of features that are currently planned for JDK 7, by the OpenJDK community. The idea is to give a  preview at Java One in June and release in the spring of CY10.

We are hoping for comments and feedback, via the openJDK mailing list. Dalibor is also working out the schedule for the next OpenJDK call, which will be open to all the folks in the community.

Thursday Feb 05, 2009

Java SE 6 update 12 supports Windows 2008 Server

 Java SE 6 update 12 shipped earlier this week and it is now available for download here. Key improvements include:

  • Windows 2008 Server Support : Java 6 Update 12 now support Windows 2008.
  • Java Plug-in now supports 64-bit browsers (4802695)

Thursday Jan 08, 2009

Java TV Spec released

Talking about pace. The Java TV folks created in a very short period of time the Java specification for digital terrestrial TV. In a nutshell, the API has been designed to provide access to functionality unique to digital television receivers. Here are some of the key features:

  • Audio/video streaming
  • Conditional access
  • Access to in-band and out-of-band data channels
  • Access to service information
  • Tuner control for channel changing
  • On-screen graphics control
In the future this should tie nicely with key value proposition of the JavaFX platform which will enable to seamless deployment of RIA across multiple devices, including TVs.

Tuesday Dec 30, 2008

Java with passion

A priceless resource for developers trying to learn Java and related technologies is the free service that Sang Shin provides online. This is a site maintained by a Sun employee who provides a huge set of online tutorials. I recently reviewed some of the courses to see if we could help provide some expert assistance. The materials are truly well put together and easy to follow. I highly recommend this site to all students and professional looking to learn Java, Ajax, Web Services, Java EE.

I am now looking forward for the update of the JavaFX programming course.

Friday Nov 28, 2008

The renaissance of Java

The next key iteration of the Java platform & language is currently planned. The stakes, for this highly anticipated release, are high, however Java 7 looks promising. There are several JSRs (203, 294, 291, etc.) in progress and the issue of modularity is also on the docket. A modular Java platform will help address issues of performance (download & startup time, memory footprint), platform scalability (e.g. Java SE scaling to small devices) and packaging (fixing the jar hell issues). These are real customer problems that Java 7 will attempt to address.

The blog to watch for more details is Mark Reinhold's.

Wednesday Nov 12, 2008

Message to developers

Here is a demonstration of the power of the JavaFX platform. We are still fixing some issues, so the clip will only play if you are within Sun's internal network an it will only play on the Mac since the clip is encoded as mp4. 

Media player - written in JavaFX Script

<script src=""></script> <script> javafx( { archive: "", width: 530, height: 305, code: "simplevideoplayer.Main", name: "SimpleVideoPlayer" } ); </script> Below is the code of the JavaFX applet that creates the video player. This sample is bundled with NetBeans 6.5, the upcoming  distribution that  has support for JavaFX Script.
package simplevideoplayer;

import javafx.stage.Stage;
import javafx.scene.Scene;
import com.sun.fxmediacomponent.\*;
import javafx.scene.Group;

def mediaUrl:String =
println("using mediaUrl = {mediaUrl}");
var vidWidth = 512;
var vidHeight = 288;
var fullWidth = 700;
var fullHeight = 400;

var mediaBox:MediaComponent = MediaComponent {
    // set the media and make the component visible
    mediaSourceURL : bind mediaUrl

    // the position and size of the media on screen
    mediaX: (fullWidth-vidWidth)/2 // center
    mediaY: (fullHeight-vidHeight)/2 // center
    mediaViewWidth : vidWidth
    mediaViewHeight: vidHeight
    mediaVisible: true

    // determines if the control bar is visible at all
    controlBarVisible: true

    // determines if the control bar is below the media or on top 
    staticControlBar: false
    // the position of the scroll bar.
    //leave as the defaults to have it be below the media
    //controlBarX: -1
    //controlBarY: -1

    // set the size for full screen.
    fullScreenWidth: fullWidth
    fullScreenHeight: fullHeight
    // make the movie play as soon as it's loaded
    mediaPlayerAutoPlay: true

    // set the volume
    volume: 0.5

Stage {
   title: "Simple Media Player"
   scene: Scene{
       width: fullWidth
       height: fullHeight
       content: mediaBox

Tuesday Jul 08, 2008

VisualVM now part of the JDK set of tools

The NetBeans team just announced the availability of VisualVM 1.0, which ships along JDK 6 update 7.

"VisualVM is a free opensource visual tool integrating several commandline JDK tools and lightweight performance and memory profiling capabilities. Designed for both production and development time use, it further enhances the capability of monitoring and performance analysis for the Java SE platform."

This version of the tool requires Java SE 6, so to run it on the Mac you'll have to install the latest version from the Apple website. In addition you'll likely have to invoke the tool with the --jdkhome flag to load the appropriate version of the JDK.

./visualvm --jdkhome /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/

As you can see from the screen shot, you can easily monitor local and remote Java applications. The tool will help you discover performance and memory bottlenecks, debug threading problems or inspect contents of the heap. The data can be saved into a single snapshot and processed offline.

Sunday Feb 17, 2008

What are the web servers that power the internet?

So how can you tell what server is being used to run a website? Here is a simple Java program that can help one figure out the kind of server that serves a particular website.

package whataretheyrunning;

import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

 \* @author octav
public class SnoopURL {

    String URLString = null;

    public SnoopURL(String URLString) {
        this.URLString = URLString;

    public void snoop() {
        try {
            // build URL
            URL url = new URL(URLString);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();


            // start talking

            // int length = conn.getContentLength();
            // System.out.println(" \*\*\*\* the length of the content is " + length + " for URL " + URLString);

            System.out.println(" \*\*\*\* Server type is:  " + conn.getHeaderField("Server";) + "\\n\\n";);

            // get more information
            Map map = conn.getHeaderFields();
            for (int i = 0; i < map.size(); i++) {
                System.out.println(" \*\*\*\* " + conn.getHeaderField(i));

            // cleanup
        } catch (MalformedURLException ex) {
            Logger.getLogger(SnoopURL.class.getName()).log(Level.SEVERE, null, ex);
        } catch ( ioe) {
        } finally {
            // do whatever cleanup ...

    protected void finalize() throws Throwable {

    public String toString() {
        return super.toString();

The output of this program is something like this:

\*\*\*\* Server type is: Sun-Java-System-Web-Server/6.1

\*\*\*\* HTTP/1.1 200 OK
\*\*\*\* Sun-Java-System-Web-Server/6.1
\*\*\*\* Mon, 18 Feb 2008 04:46:48 GMT
\*\*\*\* text/html;charset=UTF-8
\*\*\*\* Servlet/2.4,JSP/2.0
\*\*\*\* chunked
\*\*\*\* Starload=star-fep5; Path=/

Now let's look at some popular websites.

Sun's is using the old Web Enterprise server, version 6.1 (the same is true for The site the publishes this blog: is powered by Sun-Java-System-Web-Server/7.0 (a newer version of the same web server). Google seems to use their own version: gws. Yahoo does not tell you (returns null). Microsoft eats their own dog food: Microsoft-IIS/7.0. Nice. IBM runs something called: IBM_HTTP_Server (I bet is Apache's web server).


Tuesday Dec 18, 2007

Patterns in Java & JavaFX Script

One of the thoughts that I had the other day was related to design patterns in JavaFX Script. Patterns are quite popular with developers. The are books on this topic and lots of web resources. The question is how could write, for instance a Singleton, in JavaFX Script.
In Java it would look like this:

public class OnlyOne {

    private static OnlyOne singleton = null;

    private OnlyOne() {


    public static synchronized OnlyOne getInstance() {
        if (singleton == null) {
            singleton = new OnlyOne();

        return singleton;

\* Test program to prove we've coded the singleton correctly
public class Driver {

    public static void main(String[] args) {
        // one would try this OnlyOne one = new OnlyOne();
        // and it won't work due to the private constructor
        // get an instance
        OnlyOne one = OnlyOne.getInstance();
        System.out.println("Myfirst attempt: " + one.toString());
        // get another instance to see if they are the same
        OnlyOne two = OnlyOne.getInstance();
        System.out.println("My second attempt: " + two.toString());

The result of running the Driver program is: 

Myfirst attempt: onlyone.OnlyOne@9b49e6
My second attempt: onlyone.OnlyOne@9b49e6

As expected, any time one is trying to get a handle to the OnlyOne object, the same instance is returned.

Wednesday Nov 14, 2007

A thread dump worth a 1000 bug reports

The old proverb: "a picture is worth a thousand words", has an interesting mapping in the world of programming. On the Java platform one has a few facilities that enable a developer to get a stack trace that can point to the cause of a UI freeze, slow down in an application performance, etc. A thread dump can save a developer a lot of time in troubleshooting tough problems. In the old days one could start the application and a terminal and call CTRL + Break on the Windows platform or kill -QUIT pid on the Unix platform. Of course if one has access to the sources you can force the application to show you the call stack by doing something "un-natural" such as Thread.getCurrentThread().dumpStack(). Keep in mind that this will crash you application, so don't do it on production code. This wiki entry has more details on how to, gently :-), get a Thread dump.

In a recent conversation with Tor I learned some more details. For instance, on the Windows platform, using Java 6 one could employ the jps -ln command to get the process id of Java application and then use the jstack command on that process id (jstack pid) to get a thread dump. Nice documentation can be found here.

If you really in the mood to experiment, take a look at the Visual VM project that was just launched on You'll find a cool tool, based on the NetBeans platform, that helps monitor and profile Java applications. It only runs on top on Java 6, however it can work on applications based on JDK 1.4.2 or later.

Tuesday Aug 14, 2007

A new way (for some folks) to keep up with Java and the related technologies

The answer is simple. Just subscribe to a blog's RSS (Really Simple Syndication, basically a computer-readable summary of the content of a web page) feed. Here is how and what should be on your radar:

There are several ways to subscribe and read feeds. I found this article quite useful. On the other hand I use Apple mail to read the RSS feeds.



« February 2017