An Internationalization and Unicode Web Service?

Chances are that your favorite development platform already has internationalization support built into it. And probably Unicode charset support is there too. For example, Java and .NET platforms contain lots of APIs for formatting dates, numbers, etc in locale-sensitive ways. And you can get Unicode character data easily too. Unfortunately, the Unicode standard changes periodically, typically much more frequently than your development platform. You applications probably do NOT have full awareness of the latest Unicode database properties. Maybe that’s not important to you? But maybe it is? What do you do in that case? What can you do? You wait…and wait a little more. You wait until your platform’s authors update their Unicode support. That can be a very long time.

Do you think there’s a need for a web service to provide up-to-date Uncode character property information? If there were such a thing, would you use it?

Maybe Unicode character data isn’t exciting enough for you. So how about this? What if a web service existed that could provide human readable dates, times, and numbers in locale-sensitive formats? Sure those APIs exist in Java and .NET…but again, those platforms aren’t always up to date with the latest locale data and formats. What if your application could use use a web service to retrieve those formats?

Oh, and we haven’t mentioned calendar support yet. With Java, you get Gregorian, a Japanese Imperial calendar, a Thai one….and maybe that’s it. Those are important of course. But what if you need something more exotic? A Hebrew or Islamic or … any number of other calendars in use today and the past. What if a web service existed that could provide that information to your application. Would you use it?

No. I don’t have this web service today. But I wonder if others see a need for it. If so, drop me a note, let me know your ideas. If you don’t think it’s needed, let me know that too. I’m interested in arguments for and against such a service.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

My valiant attempt to install JavaFX 1.2 into NetBeans 6.7

If you follow NetBeans development, you know that NetBeans 6.7 has been released this week. By far the friendliest IDE for JavaFX development has been NetBeans. However, in a very surprising twist, the latest NetBeans 6.7 release does not include the JavaFX SDK 1.2. Instead, the download’s information page clearly indicates that you’ll need NetBeans 6.5.1 if you also want JavaFX.

I’m sure there’s a good reason for not including JavaFX with NB 6.7. No one has said a thing to me, but I suspect he reason for not including JavaFX 1.2 is the JDK requirement. JavaFX requires Java SE 1.6 Update 13, and Update 14 is recommended. NetBeans requires only JDK 5 Update 18. Perhaps the NetBeans team doesn’t want to require Java SE 6 Update 13, even though the JavaFX team apparently must.

The NetBeans team didn’t include JavaFX 1.2 “in the box”. Maybe they want you to be able to continue using NetBeans on the older JDK? The JavaFX team, on the other hand, does not have the same large user base. They can require an upgrade to Java SE 6 U13 because, well….they simply don’t leave too many existing users behind by doing so. That’s reasonable I think, but it leaves you wondering whether JavaFX SDK 1.2 will even work on NetBeans 6.7. I mean…the NetBeans site doesn’t actually tell us whether it works.

Of course, I had to try to install the JavaFX SDK 1.2 anyway.

First, the JavaFX SDK plugin simply doesn’t appear in the list of available plugins for NB 6.7. That’s ok, you can add the NB 6.5.1 update site to the list of plugin repositories.

Once you do this, the JavaFX plugins show up in the plugin catalog:

Now that’s exciting to see. You’re just a single “Install” button click away!

Or so I thought…no. As soon as I pressed the “Install” button on the plugins page, a warning/error dialog tells me that an unmet dependency stands in the way. Something called the “Editor Hint” plugin is necessary:

Suppose we just forget the referenced “JavaFX Kit”? Would that work? I unchecked the JavaFX Kit plugin. Nope. The next complaint is against the weather example plugin. OK, let’s get rid of that. Now the only thing selected is the JavaFX SDK itself. After pressing the “Install” button again, I watch NetBeans 6.7 download and install the “JavaFX SDK for Windows”. OK so far, but I’m not sure what I’m going to miss without the JavaFX Kit plugin.

Other than a short message about the unsigned nature of the plugin, this JavaFX SDK plugin appears to install without a problem. But what does it give me? I quickly realized that all the JavaFX Project and JavaFX file type references that usually show up in the New Project and New File dialogs just aren’t available yet. Hmmm….that “JavaFX Kit” plugin is necessary after all. I bet it contains exactly what’s needed to add JavaFX file types to NetBeans. But that requires something called the “Editor Hints” plugin….sigh.

I’ve checked around the NetBeans plugin site. I can’t seem to find the “Editor Hints” plugin. If you know anything about it, let me know. Until then, we’ll have no JavaFX 1.2 in NetBeans 6.7. I feel like I’m close, very close. So come on Joshua M, Jasper P., one of you guys…if you’re listening….give me a hint. I know you know how to make this work…even though it’s not “officially” supported by NB 6.7 yet. :)

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

UTF-8 charset encoding update

The UTF-8 encoding is easy to abuse in some ways. Or rather, sometimes people use it in unexpected ways.

Recently the Java platform received an update to reject one malformed UTF-8 encoding sequence called “non-shortest form.” You can learn more about this fix and its implications for you in the article Overhauling the Java UTF-8 Charset.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

Will Oracle support NetBeans?

By now you know that Oracle intends to purchase Sun. It’s a welcome deal that will no doubt be approved by stockholders. It certainly has the board’s approval. So let’s assume that Oracle will own Sun by the end of summer. Now we can start asking some questions.

Will Oracle embrace NetBeans? Like many open source projects, NetBeans gets a lot of support from corporate interest. In this case, it’s no secret that Sun pours cash into NetBeans. However, Oracle already supports an IDE. Let’s make that two IDEs: JDeveloper and Eclipse. Both receive financial backing from Oracle already, and…well, my first thought is that Oracle simply won’t need a third IDE.

As Oracle continues to evaluate its new assets, how will it value NetBeans? Although I personally enjoy and use NetBeans, I don’t think Oracle will care much for it. Not that NetBeans isn’t an excellent product, but like I said, Oracle already has IDEs. In my opinion, NetBeans and its users will have to find new support elsewhere. I doubt Oracle will continue funding its development.

Hey, this is just speculation. I’d enjoy hearing your ideas, particularly if you think that Oracle will champion NetBeans in the future.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

Discovering resource bundles at runtime

hellodlg

Yesterday a friend asked me a question about Java resource bundles: how can I get my application to discover resource bundles dynamically?

It seemed like a simple question. I answered in my typical fashon: Well, everytime you need a new bundle, just add that bundle’s jar or directory to your classpath and run the application. Or if it’s just a single properties file, add that file to your existing classpath, maybe drop it into the same directory as your other properties files.

My friend wasn’t content with that. He had done some homework before asking me. He said, “My application is in a jar file. I launch it on the command line like this, java -jar MyApp.jar. When I wanted to add new resource bundle jar files, I tried this: java -cp Hello_ja.jar -jar MyApp.jar. It didn’t work. The app doesn’t see the additional Hello_ja.jar file.”

I explained that when you use java -jar MyApp.jar, the jar’s own classpath settings defined by its manifest file will override anything on the command line that is defined by the cp option. The cp option is worthless for setting a classpath in this situation.

Of course, he still needed a solution. Hmmm…how could I help him?

It turns out that you actually can add classes to your classpath dynamically at runtime. Your application can discover new jar files and use the functionality it finds in them. The ClassLoader class can help you. The ClassLoader class can add class directories, jar files, and even lists of jar files to a classpath. Then when you need a class from that directory or jar file, you can use ClassLoader to load the class.

Let’s look at how this might work for loading resource bundles. In my examples, I’m going to create an application that displays three greetings in a panel. I’ll package the application as a jar file. The application will load its resource bundles from jar files that I’ll place into a “plugins” subdirectory directly under the application jar. The big deal about this is that the application will discover the jar files that are in the plugins subdirectory each time it launches. So, if you want to add another localized set of bundles, just drop the new jar into the plugins directory.

First, let’s start with the Greetings application. It’s simple just to demonstrate the point. It loads resources from a standard resource bundle and puts the resource strings in a dialog. Although the ResourceBundle for messages is just a standard bundle, notice that I’ve provided a class loader. The class loader has been instructed to add jar files to the classpath, specifically the jars found in the plugins subdirectory. I’ll show you the ResourceLoader class later. For now, here’s part of the basic dialog-based app:

package com.joconner.hello;

import com.joconner.resplugin.ResourceLoader;
import java.util.Locale;
import java.util.ResourceBundle;

/**
 *
 * @author JOConner
 */
public class GreetingDialog extends javax.swing.JDialog {
    /** A return status code - returned if Cancel button has been pressed */
    public static final int RET_CANCEL = 0;
    /** A return status code - returned if OK button has been pressed */
    public static final int RET_OK = 1;

    private ResourceBundle res = null;

    /** Creates new form GreetingDialog */
    public GreetingDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        ClassLoader resourceLoader = ResourceLoader.createForDirectory("plugins/");
        res = ResourceBundle.getBundle("com.joconner.hello.resources.messages",
                Locale.getDefault(), resourceLoader);
        initComponents();
    }

    /** @return the return status of this dialog - one of RET_OK or RET_CANCEL */
    public int getReturnStatus() {
        return returnStatus;
    }

    private void initComponents() {
        tfMorning = new javax.swing.JTextField();
        tfAfternoon = new javax.swing.JTextField();
        tfEvening = new javax.swing.JTextField();
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                closeDialog(evt);
            }
        });
        tfMorning.setText(res.getString("greeting.morning"));
        tfAfternoon.setText(res.getString("greeting.afternoon"));
        tfEvening.setText(res.getString("greeting.evening"));

As you can see, the above dialog doesn’t do anything surprising with the bundles; it retrieves a bundle, pulls strings from it, and uses those strings in 3 text fields. However, notice that I’ve instructed the ResourceBundle class to use a special class loader. The class loader code is here:

public class ResourceLoader {

    private ResourceLoader() {}
    private ResourceLoader(File dir) {
        this.directory = dir;

    }

    /**
     * Create a ResourceLoader for a specific file system location.
     * All JAR files and subdirectories in the location will be added
     * to the classpath
     */
    public static ClassLoader createForDirectory(File dir) {
        ResourceLoader loader = null;
        if (dir.isDirectory()) {
            loader = new ResourceLoader(dir);
        }
        loader.addJarsToPath();
        return loader.getClassLoader();
    }

    public static ClassLoader createForDirectory(String dir) {
        File f = new File(dir);
        return createForDirectory(f);
    }

    private File[] addJarsToPath() {
        File[] jarFiles = directory.listFiles();

        List urlList = new ArrayList();
        for(File f: jarFiles) {
            try {
                urlList.add(f.toURI().toURL());
            } catch (MalformedURLException ex) {
                Logger.getLogger(ResourceLoader.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        ClassLoader parentLoader = Thread.currentThread().getContextClassLoader();
        URL[] urls = new URL[urlList.size()];
        urls = urlList.toArray(urls);
        URLClassLoader classLoader = new URLClassLoader(urls, parentLoader);
        this.loader = classLoader;

        return jarFiles;
    }

    public ClassLoader getClassLoader() {
        return this.loader;
    }

    private File directory;
    private ClassLoader loader;
}

This ClassLoader puts all jar files that are in my application-defined “plugins” subdirectory onto the classpath. See the addJarsToPath method for the exact wa to do this. Of course, this particular implementation isn’t robust. If you were doing this in an important application, you might want to confirm that a jar file really was a resource jar file….maybe your jar has a particular manifest file entry to provide very basic assurance that it is what you think it is.

Finally, just create your ResourceBundles as you normally would. Create jar files for each set of localized bundles for a specific language. Then drop them into a “plugins” directory immediately under your application’s main directory…the place your applications sits on the file system.

Now you can add new localized bundles to your application without having to recompile or jar your primary application. You don’t even have to change its classpath since new “plugins” jar files will automatically be added to the classpath for resource bundle creation.

There you go. Enjoy.

VN:F [1.9.3_1094]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

Is the Swing Application Framework necessary now?

Although resurrecting the Swing Application Framework (SAF) is a noble and respectable goal, is that even necessary now with JavaFX? If Sun does finalize and fix any remaining rough spots in SAF, is any significant number of developers going to benefit?

Even though I mean no harm or disrespect, someone is bound to view my question as an attack. It’s not. I thought the Swing Application Framework was a great idea. I even spent time writing about and promoting it. But I’m thinking differently these days. I think JavaFX confuses the issue for me.

SAF really is all about making it easier to write Swing application GUIs. The newbie benefits tremendously. Even a veteran benefits because some of the basic boilerplate setup and application structure is already defined. That doesn’t change at all. SAF still fills the void there if you’re going to write Swing applications. For newbies, it’ll get you started in the right direction. For veterans, it might save you some time.

However, most existing applications won’t need SAF. Any of the basic problems that the simple SAF resolves have already been fixed in any existing, big application. The effort to retrofit an existing application to SAF is…well, maybe it isn’t worth it.

More importantly, don’t you really get the feeling that the near and mid-term future of GUIs is JavaFX? Don’t you think the vast majority of Sun resources has been going to JavaFX? I really do. So…any newbie in the world of Java GUIs would probably do best to learn JavaFX, not Swing. Considering Sun’s efforts to push and promote JavaFX for rich GUI apps, JavaFX is really the right place to put your energy right now — especially on new development.

Maybe you don’t buy into JavaFX just yet because of its short history. In that case, go ahead with Swing and the SAF. But…I think any effort put into SAF is for a short-term benefit at this point.

Enough already. I’ve said it. The Swing Application Framework was a good thing, but it didn’t really get the support it needed in the time frame that would have helped its adoption. Resurrecting it now may be a noble goal, but I personally think the people and projects that need SAF the most are now looking at JavaFX.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

NetBeans 6.5 still coughs on spaces

NB6.5

I’ve been trying to slowly introduce NetBeans to my colleagues for over a year. I think they’d actually use it in our current products and projects, but NetBeans won’t make it easy for us. How’s that you ask?

It turns out that we have several projects named with spaces. For example, one project is Tag Server, and another is Agent Registry. Why spaces? Well, the original project was developed using Eclipse, and well…no one told the team that they shouldn’t use spaces. So they did, Eclipse doesn’t mind, and…. that’s the current situation.

I was really encouraged when I found out that NetBeans 6.5 has an Eclipse project importer. It slurped in our Eclipse workspace and projects in what appeared to be just an easy, casual task. It looked fine at first glance. I beamed with pride. My NetBeans was doing so well.

My smile didn’t last long. NetBeans soon began to sputter, gag, and choke. The problem is that NetBeans has had a long-standing problem with path and project names that contain spaces. NetBeans coughed up on the project when trying to compile and run it. It complained that my problem “might be because your user directory is on a Windows UNC path (issue #46813).” I don’t have a UNC path in this project; everything looks like very old-school paths. It’s all on my D:\workspace\… subdirectory. OK, yes, there are some spaces in those subdirectories. But spaces in file and directory names aren’t really special anymore.

Ugh. NetBeans is so close to being perfect in so many ways. Unfortunately, despite the fact that it could be my team’s IDE for most reasons, it cannot be our IDE for one reason. So why don’t we just change our paths and remove the spaces. One reason is that we have dozens of ANT scripts that work with these directories, and we’re on a short timeline ALL of the time. We just don’t have time to mess with it if it doesn’t work. So, NetBeans doesn’t get any traction here.

So, despite the fact that bug id#46813 is supposedly fixed in NB 6.5, something still apparently haunts the product when spaces are involved. Sigh…maybe I’ll try again another day.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

JavaFX Community, let’s do this!

Not really finding theJavaFX community anywhere else, I’ve created one. Sure, the site itself is ugly as hell now, but that will change…if the community wills it. My intention is that YOU will take this over, you the community, you the JavaFX user.

Here’s what you have from me:

  1. a decent domain name that communicates the purpose pretty well; that’s learningjavafx.org
  2. a community content management system that can support users, forums, blogs, aggregated site feeds, uploads, etc. It’s Drupal. I evaluated others. This works.
  3. a willing host to provide this to the community. That’s me.

I’ll help; I’ll lead; I’ll guide — as much as you want anyway. If you have experience doing this elsewhere, let me know. I’ll let you run a part of the site, moderate a forum, whatever you like. Let me know your interest level, and we’ll figure this out!

The primary purpose I have for the site is a single place for group discussion, articles, blogs, forums — all about JavaFX of course.

Email me at john@joconner.com. Let’s do this as a community.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

Installing JavaFX 1.0 on NetBeans 6.5

You might want to go directly over the the JavaFX website to download the JavaFX SDK, but if you work in NetBeans 6.5 you don’t have to bother. JavaFX 1.0 is available to NetBeans 6.5 users with only a few mouse clicks. Seriously, only a few mouse clicks will get the JavaFX SDK plugin for you and integrate it directly into your NetBeans 6.5 IDE. Here’s how:

  1. Select Tools->Plugins from your NetBeans 6.5 menu.
  2. Select the Available Plugins tab.
  3. Click on the Reload Catalog button just to make sure you have a fresh copy of all available plugins
  4. Scroll down the plugin list to find the JavaFX 1.0 plugin, and click on its check box. You can also select a JavaFX debugger and several demos in the same area of the plugin list!
  5. Click the Install button
  6. Continue working until the download is finished and restart NetBeans IDE

That’s it. Now NetBeans 6.5 has the JavaFX 1.0 SDK integrated directly. You should notice a new JavaFX Project type available to you when you select File->New Project

Sorry for the short post, but I have to get back to my NetBeans IDE and JavaFX. I’ll be back later with more information about my initial overview of the SDK, the language, and much more!

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot

NetBeans 6.5, your IDE, your community

NetBeans 6.5

Several months ago, I submitted a bug against NetBeans 6.1. Sure, I expected someone to see the bug, but I didn’t expect the real and substantial interactions that followed.

After logging the bug, I received an email thanking me for my submission. A couple days later, when a NetBeans engineer was able to evaluate the problem, I received another email…this time with comments and even questions just for me. I responded. The NetBeans team responded and made comments on the bug report. The team engaged me, asked questions, and took my feedback seriously.

What an amazing experience! I was impressed by the team’s commitment to engage with its community, to interact directly with an individual.

Just yesterday, I received another email…this time to let me know that the bug fix is in NetBeans 6.5. The NetBeans community didn’t forget about me. I guess someone figured that I’d want to know the status of a bug…especially since I took the time to report it in the first place. They were right; I was interested.

I’ve always known that I’m a NetBeans user, but I would never have gone so far as to call myself a community member. I feel differently after this experience though. I’m glad to be part of the NetBeans community. If you use NetBeans, you’re part of the community too!

As a community member, exercise your rights to be influential in shaping NetBeans. You use NetBeans. Now do something to shape it and to improve it.

How can you get more involved in the NetBeans community? Here are some ideas:

Getting involved is easy, and there are dozens of ways to participate in this thing we call the NetBeans Community. Pick one of these suggestions, or find your own way to contribute. It’s really pretty simple to get involved.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Add to favorites
  • Yahoo! Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Slashdot