Planet Classpath
According to an article in SDTimes, Craig Hayman from IBM thinks that Apache Harmony is "ready for prime time". That surprised me (OK, not really) so I decided to give the latest release (milestone 10) a quick workout with JFreeChart. I ran various demos and concluded very quickly that Harmony is...drum roll...not ready. This also seems to be at odds with the general perception that Harmony is ready for certification as a full implementation of Java 5 (even moreso when you consider that JFreeChart only requires Java 1.3 or later).

The problems were numerous, but here's a typical one to illustrate: I took DialPlotDemo2.java (alas DialPlotDemo1.java produced no output at all) and ran it on both Harmony and IcedTea (a derivative of OpenJDK). These are the screen shots (the one on the left is from Harmony, the one on the right is from IcedTea):



When running on Harmony, the code fails before the chart renders completely, giving the following stack trace:

java.awt.geom.IllegalPathStateException: First segment should be SEG_MOVETO type at java.awt.geom.GeneralPath.checkBuf(GeneralPath.java:209) at java.awt.geom.GeneralPath.lineTo(GeneralPath.java:236) at java.awt.BasicStroke$BufferedPath.createGeneralPath(BasicStroke.java:1791) at java.awt.BasicStroke.createStrokedShape(BasicStroke.java:269) at org.apache.harmony.awt.gl.CommonGraphics2D.draw(CommonGraphics2D.java:310) at org.jfree.chart.plot.dial.StandardDialRange.draw(StandardDialRange.java:339) at org.jfree.chart.plot.dial.DialPlot.draw(DialPlot.java:565) at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1235) at org.jfree.chart.ChartPanel.paintComponent(ChartPanel.java:1669) at javax.swing.JComponent.paint(JComponent.java:1000) at javax.swing.JComponent.paintChildren(JComponent.java:979) at javax.swing.JComponent.paint(JComponent.java:1002) at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:1438) at javax.swing.JComponent.paint(JComponent.java:998) at javax.swing.JComponent.paintChildren(JComponent.java:979) at javax.swing.JComponent.paint(JComponent.java:1002) at javax.swing.JLayeredPane.paint(JLayeredPane.java:220) at javax.swing.JComponent.paintChildren(JComponent.java:979) at javax.swing.JComponent.paint(JComponent.java:1002) at java.awt.Container.paintComponentsImpl(Container.java:1007) at java.awt.Container.paint(Container.java:936) at java.awt.Component.processPaintEvent(Component.java:3676) at java.awt.Component.dispatchEvent(Component.java:3502) at java.awt.EventQueueCore.dispatchEventImpl(EventQueueCore.java:149) at java.awt.EventQueue.dispatchEvent(EventQueue.java:144) at java.awt.EventDispatchThread.runModalLoop(EventDispatchThread.java:74) at java.awt.EventDispatchThread.run(EventDispatchThread.java:48)

OK, so the exception relates to some problem in Harmony's Java2D code, but there are also visible issues with the font rendering, the Swing layout in the lower part of the panel, the labelling of the JSlider components and the look and feel.

The phrase "ready for prime time" is surely premature.
jtreg 4.0 b03 is now available, and fixes a number of minor issues. You can find it on the standard jtreg download page

It includes the following minor fixes and updates:

  1. Do not follow symlinks when cleaning a directory.
  2. Avoid potential NPE when cleaning a directory.
  3. Allow annotation processing of class files in jtreg directives.
    New option /process for @compile tag disables requirement that one or more *.java files must be given to @compile.
  4. Set test.src and test.classes properties for @compile tasks.
    These properties can now be used by annotation processors invoked by the @compile task.
  5. Recategorize -e option as a general option instead of a JDK one.
  6. Set MKS to use case-sensitive compare in launcher script.
  7. Remove obsolete reference to JAVA_HOME from launcher script.
  8. (jtdiff) Avoid NPE in standard jtdiff if no output file given.

At least according to Symantec.

I want to make a screenshot, but I don’t know how to do this in Windows XP. I probably need the Ultimate Edition or so. God, this crappy OS doesn’t even have the most basic functionality, or it hides it so well that nobody finds it. No, the print key doesn’t work.

Folks, I really gave this OS another serious chance. Actually I was more or less forced to, due to my new job and new hardware and lack of Linux install CDs for 2 weeks in the US. But it so gets in the way of everything and is generally so unusable, I think I really do the same update that David Gilbert (*) mentioned in the article above.

Interesting side detail: I tried a couple of games in Windows that I tried in Wine before, it must be said that nowadays almost all games I would want to play work perfect in Wine (Heroes series, Starcraft, Baldur’s Gate, Settlers series), some show the same buggy behaviour in Windows as in Wine (SimCity4) and some others actually work better in Wine (!!), namely Settlers IV and Baldur’s Gate I. As far as I found out it’s a bug in the NVidia driver not supporting DirectDraw properly.

* David, is that you: http://en.wikipedia.org/wiki/David_Gilbert ? ;-)

Update: Ok, thanks to Robert I managed to make the print key work. Here is the screenshot:

Java Doom Trojan Horse

With the release of OpenJDK, Sun donated to the World not only a big piece of Software and some gigazillion of men hours (and so money), they donated knowledge. This knowledge will be forever part of the humanity, because Java is a Free Software project now.

I have read since day 0 about Apache‘s childish complains about how bad is that or that other. The same childish complains that made Harmony one of the most significant Open Source failures of all the time, despite all the good intentions and efforts we put into it.

Now I read this article from Stephen Colebourne, linked here. This comes after a series of similar articles. Now, I follow Stephen since quite some time, and he is a really smart guy, with lots of experience, and I really do not intend to start a personal crusade, specially against him. The reason I chose his blog is because he describes things that are both of general interest and seem to share the point of view of Apache. I just ask myself few questions so.

Why Sun should, for whatever reason, give Apache access to the TCK? I mean, OpenJDK is already there, and nobody in the community needs anything else, with the few problems that still remain being addressed (Thye even let us run the TCK for Cacio, and this was before Roman joined Sun). Apache instead thinks Sun should just give access to the TCK, for free… Apache may be a non profit foundation, but it‘s backed by IBM and Intel, and can count on lots of money. Intel and IBM (above all) that have big interest there so much that they screwed on harmony when we tried to collaborate on it. Look at the Harmony code repository. Silent for months, at some point tons of code hits it, at least very weird.

Of course, it‘s all about the licenses, I realise it very well. With Harmony passing the TCK (come on, even if sun gives you access to it, I bet Harmony will never be able to pass a simple test from the suit anyway!), IBM/Intel would not need to be a Sun licensee anymore. They could use Harmony, call it Java, and never have the need to give back any code (because the funny Apache license allows that). As Radiohead would say, “We suck young blood“.

But what I don‘t really understand is this sentence, also from one of Stephen‘s blog entries:

“All the evidence I see is that Java SE is no longer an open standard and the next release will be JDK 7, not Java 7.”.

So, Java was an open standard? Cool, I never realised that, I‘m so bad. But now that the development is in the open for real, and Stephen should know, because he classified bronze on the Challenge with something that will be part of the JDK 7 code, I see the complains from companies like IBM (ops, I meant Apache…). Even Google, basically the only remaining big Harmony user in the World, is more clever, open and collaborative with the OpenJDK community, than IBM (ops again, Apache).

I think they should not be worried so much, if they can pay for the license, the TCK is a tool for driving money, they can make their business. Or if they cannot, well, they can just sit and code a better product, with less politics, people will eventually use it. Eventually.

Update: pun intended :)

"What do you want me to do?  LEAVE?  Then they'll keep being wrong!"

Back to the code :)

One thing that was always quite painful with Classpath (eh…) was mixing awt and swing components in the same application.

This is by definition painful, because of the heavyweight vs lightweight approach, and in Classpath we reverted to all sort of tricks to try to make it work correctly, often with poor results even.

The JDK support some mixing, but they also have problems in some corner cases. Today I wrote one of those corner case. It‘s a stupid app that has two panels, a swing and an awt one. In the panels there are few different widgets, some awt and some swing for each panel. There is a jlist that should cover the bottom panel and the awt/swing components when something from the list is shown, so there is pretty much everything. This setup doesn‘t work with the JDK, I get some painting problems with the widgets, the reason is that the app is poorly coded of course, no body would fix a bug report cause by this code, and I did on purpose to test what happens if…

Surprisingly, with Cacio on SDL it just work. SDL doesn‘t support multiple windows yet, so this came as a surprise, because we have to do the clipping by ourself and fake all the stuff, more or less like we did in Classpath back then. Because Roman wrote most of the clipping code and the full screen managed window, my kudos go to him! Here are some screenshots, left is the JDK and right Cacio.








GNOME sponsorship badge

Thanks to the generous sponsorship of the GNOME Foundation and GNOME Travel Committee, on Thursday I’m heading to the Gran Canaria Desktop Summit. This conference is a combination of GUADEC and Akademy and promises to be an excellent week of discussions, presentations, etc.

I’ll be giving a talk on Eclipse, focusing on our work at the Linux Tools project and of course showing the CDT and Mylyn and all the other awesome stuff I can fit into 30 minutes. I’ve been to GUADEC twice before and was really impressed with everyone’s enthusiasm. I’m sure this year will be just as good and I look forward to the inspiration that comes from conferences like this.

This year was my first time at Jazoon. It's a conference in central Europe in Zürich, Switzerland, a few weeks after JavaOne and almost 6 months away from Devoxx, the large European Java Event at the end of the year in Antwerp, Belgium. It attracts international speakers, and a diverse European audience. It has continuously grown in attendance, year after year, to more then one thousand visitors this year, another 20% increase from last year's visitor numbers.

The conference takes place in a cinema in Zürich, with a setup similar to Devoxx - comfortable chairs, wifi, large screens for presentations, a proper stage for speakers, freshly made coffee and espresso, Swiss-clock-like organization, IP TV recordings of talks being projected into the Internet surfing room, and most importantly: Guaraná Antarctica was available in the Coop shop across the place where the cinema is. So while a lot of people I know had a great time at FISL in Porto Allegre in Brazil last week, I put myself in the spirit of Braziiiiiiiiiil in Zürich with my favorite soft drink, and brought some of it back to Hamburg. I'll be checking out the local shops to restock my supplies once they run out - should be soon enough!

My own talk on Thursday (slides) went without a hitch, and I was able to sprint through my 'deliberately made to be tweetable', 10 words or less slide deck at the pace of about 4 slides per minute. It's the second time I've tried this approach, and the idea worked out nicely, with some people tweeting what they saw in their feeds from the talk, and the face to face and online feedback was very positive. I guess there is a wining combination of conference hashtags, slides-made-for-retwittering and a twitter session back channel hidden in all that waiting to be discovered by my twittering friends over at Redmonk.

The sessions I enjoyed the most at Jazoon were Neal Ford's entertaining keynote motivating people to make their own futures, and Linda Cureton's keynote on the rising use of social networking tools inside NASA to improve collaboration.
So, like I said in my last post, I went to LinuxTag again this year, to speak on OpenJDK. I was a bit surprised and flattered to find the talk announced in the regional German press, given that it was a 'regular' talk, rather then a keynote, so I wasn't quite sure what to expect.

Since I had to be in Zürich for Jazoon the day before and after my talk at LinuxTag, I flew in on an early morning flight to Berlin Tegel, arriving at the venue about an hour before my presentation was due to start. After acquiring my speaker badge, I went to listen to the Maven 2 talk right before mine, which allowed me to put the Maven 3 presentation from Jason Van Zyl at Jazoon I heard the day before in context, so it was a really nice experience. Coming up after that myself, I noticed that my notebook's external port and the video system's don't match, so after some brief thinking about solving the hardware compatibility issues, I decided to go slideless for the talk, and turn it into an interactive session. Given that we had around 40-50 people in the room, that's the size for which the slideless approach works pretty well, and as a presenter, is way more fun for me then working with slides.

The talk went well, with questions ranging from 'when will JDK 7 be released' to language feature specifics. To an audience familiar with Linux, the benefits of splitting the JDK into smaller native packages are obvious, so Jigsaw in particular and the modularity features of JDK 7 in general are just an obvious improvement on existing practice in this domain. The small language changes received a lot of attention from the audience, as well as invokedynamic, and its effects on JRuby, Jython, etc. performance.

I spent the early afternoon catching up with friends from other free software projects, like Michal Bielicki from the OpenSolaris community, Marko Jung from the OpenSUSE community, and last but not least, Robert Schuster, Mr. OpenJDK-cross-compilation from the Jalimo and OpenEmbedded projects.

Unfortunately, I missed Ken Gilmer, whose talk on the BugLabs on Wednesday seems to have been cancelled at the last minute, so instead I went to see Matthias Ettrich's very interesting talk on free software development at Nokia, around the example of QtCreator IDE. It's been interesting to compare the approach taken by Nokia in growing the community around Qt after the acquisition - it's similar in some ways to what we've done in OpenJDK, but also quite different in others.

With a head full of new ideas, I went back to Jazoon to talk on OpenJDK there the next day. But that's a matter for a separate blog post.
And the hardest part
Was letting go not taking part
Was the hardest part
And the strangest thing
Was waiting for that bell to ring
It was the strangest start

I could feel it go down
Bittersweet I could taste in my mouth
Silver lining the clouds
Oh, and I,
I wish that I could work it out

And the hardest part
Was letting go not taking part
You really broke my heart
And I tried to sing
But I couldn't think of anything
And that was the hardest part

I could feel it go down
You left the sweetest taste in my mouth
Silver lining the cloud
Oh, and I,
Oh, and I,
I wonder what it's all about
I wonder what it's all about

Everything I know is wrong
Everything I do it just comes undone
And everything is torn apart
Oh and that's the hardest part
That's the hardest part
Yeah, that's the hardest part
That's the hardest part

Coldplay

I guess I should say something too… Let‘s this speak instead…

I have done a massive amount of fixes to IKVM.Reflection.Emit to make it full featured (even though it still doesn't implement all Reflection.Emit APIs, the functionality should (almost) all be there, for example via different overloads).

I completed support for generics (I think) and fixed many bugs in that area, ikvmc only uses a very small amount of generics so these fixes are unlikely to affect it.

It's worth explicitly stating the design goals of IKVM.Reflection.Emit:

  • It's a write-only API. Some GetXXX methods or properties may be implemented, but that's mostly for its internal convenience.
  • There is intentionally no error checking. During ikvm development the error checking in System.Reflection.Emit has cost me a huge amount of time, it is generally much easier to diagnose the problem when you have a broken assembly file. PEverify and ILDASM are your friends.
  • Code that uses System.Reflection.Emit in a write-only way is supposed to "just work" (modulo missing APIs, but those changes should be trivial).

I've done some pretty heavy duty testing on it. It should be ready for external (i.e. non-ikvmc) usage now. If you decide to use it (or consider using it), please let me know. As always, feedback is appreciated.

Changes:

  • Added support for ByRef and Pointer types.
  • Completed support for all literal field constant types and fixed null literal fields.
  • Added ModuleBuilder.DefineInitializedData().
  • Fixed many generics related bugs.
  • Added a (non-standard) API to ModuleBuilder to set the PE image base address.
  • Added TypeBuilder.SetParent().
  • Added TypeBuilder.GetMethod() and TypeBuilder.GetConstructor() to instantiate methods on generic types.
  • Added a (non-standard) API to ILGenerator to disable the "helpful" automatic leave/endfinally instructions in exception blocks.
  • Added support for pinned local variables.
  • Added UIntPtr and TypedReference signature encodings.
  • Fixed handling of TypeBuilder enums in custom attributes.
  • Added MethodBuilder.SetSignature().
  • Added GenericTypeParameterBuilder.SetInterfaceConstraints() and .SetGenericParameterAttributes().
  • Fixed (Method|Type)Builder.SetCustomAttribute() to set HasSecurity flag when SuppressUnmanagedCodeSecurityAttribute is set.
  • Added support for defining events.

Binary available here: ikvm-refemit-0.41.3464.zip

Survivor: Eclipse DemoCamp Toronto Edition

On what was the hottest day of the year so far (at the time), about 25 intrepid souls braved the heat of the Red Hat Toronto conference room to attend the Eclipse Galileo DemoCamp Toronto. The group of attendees was very diverse with representatives from small companies, big companies, academia, and government. We had some great demos from some of the Eclipse Linux Tools Project team include Jeff Johnston on autotools and libhover, Kent Sebastian on OProfile integration, and Elliott Baron on Valgrind tools. Ioan Salau then demonstrated his eHealth Software Production Line followed by Remy Chi Jian Suen demonstrating fancy-schmancy ECF project collaboration. Andrew Ross brought some swag to give away and recorded the talks. They’re available for download here Thanks, Andrew and FOSSLC!



Afterwards, we went to the Rose and Crown for some refreshments courtesy of the Eclipse Foundation.




Thanks to everyone who came out.

Fedora 11 Release Party

It seems like we always have events on hot days. Last week, a bunch of us packed into the awesome Linux Caffe for a look at what Fedora 11 has to offer. Chris Tyler spoke about Fedora’s four foundations and I followed it up with a run through of the awesome Fedora 11 feature list. Much fun was had trying to fix things on odd hardware and many CDs, DVDs, and USB keys were turned into Fedora goodness. I didn’t manage to get any pictures or a headcount, but I think we had around 15 or 20 people hang out for a few hours and managed to attract some people who happened to be at the Linux Caffe anyway. Thanks to David Patrick for letting us host there and for the great food and drinks courtesy of Fedora. See you in 6 months for the Fedora 12 party.

A few weeks back, I had to buy a laptop at short notice. In France. The laptop (a cheapish one) came with "Microsoft Vista Edition Familiale Basique" preinstalled. Everything in French, as you'd expect. I found the control panel and spent quite some time looking for the option to switch the display language to English. Modifying the country / region didn't change the language. There were options to change the locale for date and currency formatting, but nothing to change the language. I had to be missing something.

langue.png

Anyway, I had work that needed doing, so I pressed on with installing the applications I needed and copying across my data files. Only later did I come back to search again for the display language setting. And you know what - THERE ISN'T ONE. It turns out that if you have a "low end" version of Vista, you don't get to change the language. Ever. Unless you buy another version of Vista (apparently Windows Vista Ultimate or Enterprise will let you switch languages---I guess it is an "ultimate" kind of feature). I could rant and rant about how mind-numbingly stupid this, but is doesn't matter anymore because I downloaded a free update that fixes the problem (and a whole bunch of others too), and now I have my system displaying the language of my choice:

http://www.ubuntu.com/getubuntu/download

Where did you go yesterday?
"Wait, no, that one also loses. How about a nice game of chess?"
I am the Jazoon conference in Zürich this week. It began today with a keynote by James Gosling, and it's a fun event, that feels like a very laid back version of Devoxx executed with Swiss charme and attention to detail - same setting in a movie theatre, well working wifi, with a good list of speakers. I'm looking forward to jvanzyl's Maven talk later today, for example, while listening to James Ward is talking on Flex. I had a chance to meet the Glassfish team yesterday, they are at Jazoon to talk about Glassfish 3.0, JEE 6, JSF 2.0 and JavaFX. The Spring team is here to discuss Spring 3.0, and there is a lot of talks from the JBoss team on topics ranging from JBoss tooling to implementing memcached in Java.

I'll be speaking there on OpenJDK on Thursday, at 16h in Arena 5. Drop by, if you want to know more about what's been happening in OpenJDK recently and how to get involved.

On Wednesday, I'll spend the day at the LinuxTag conference in Berlin, speaking on OpenJDK at 11h in the room Europa I.

Finally, on Friday, there will be a talk on OpenJDK at the FISL conference in Porto Alegre in Brazil, held by Bruno Souza.

Update: Since FISL is streamed live, you should be able to see it live at the FISL streaming site for the corresponding room.
One evening during JavaOne 2009, Google held a party at a very nice hotel in downtown San Francisco and Roman and Mario convinced me to come along - the only problem being that they had invitation cards and I didn't. The nice ladies at the door frowned a little when I said I didn't have an invitation, but I think Mario said some magic words in Italian and soon we were inside drinking free Google beer! And there was some very good food too. I told my companions that *I* was the one *really* paying for the beer, due to the amount of cash I hand over to Google each month to advertise JFreeChart. Now oddly enough, I know roughly what I spend in a month on advertising, but I didn't (until just now) know the total spend since I started using AdWords way back when. So I ran a report and the total is: US$38,105.31!

Now you might be wondering, is it worth spending that much to advertise a FREE product? To be honest, I don't know for sure, but I suspect it is (and for that reason I'm still running my Adwords campaign). You see, every new JFreeChart user is a potential purchaser of the JFreeChart Developer Guide...and I need to sell a few more of those to pay off the credit card bill I have from attending JavaOne. Which is slightly lower than it might have been, thanks to Google for the free beer. And Mario for the seafood.

Short summary of happened and happening things:

  • JavaOne2009: Great. Lots of faces to finally put on email addresses, IRC nicknames, etc.
  • San Francisco: Great. Includes previous point. Plus: Seafood (oh my!). Extremely poor vs. extremely rich people. Lots of things that I almost got done, but not quite. Some photos.
  • Cacio: Great: Of course. BOF went good, but attendence was low. Should have invited all the audience for beer instead. Seems we are not that famous after all ;-) Many small things improved before, during and after JavaOne.
  • East Coast: Great. New job. Setting up stuff. Not much real work so far. Couple of interesting dinners and philosophic chats with new boss. And Terminator.
  • Neil Young Archives: Great! First seen at JavaOne (yay). Seen again in record store. Could not resist. Must watch trailer.
  • FontManager: Still trying to set a record for pushing the largest patch ever into OpenJDK ;-) Round 5.
  • Family: Not great. Miss them quite badly. 3 more days to go…

I know I am supposed to write about JavaOne, my new Job at Sun, the USA, all the cool stuff that happens in Cacio, etc, but this is probably much more interesting: Is there an artificial god?

The Letux 400 has a wide-VGA screen, 800x480 pixels. Bright, crisp and well readable, but sure an uncommon format. 800x600 was common for laptops for a long time.
How do standard desktop applications fare on the Netbook? Some just don't fit, but there are several which just work and allow to have a small workspace available.

The first screenshot shows that albeit crammed, the Workspace is fine. The panel with the folders could be closed to gain even more space. Behind you can see the Terminal application. Sure, only one can be seen at a time, but it is enough to work.

Then we have the AddressManager showing up in all its glory. Fits tight but fits. A really useful application on a Netbook!






The last image shows the Vespucci browser on the Letux. Works fine.

Note: Screenshots are from applications actually running on the Letux 400, not mock-ups.


Did you see Bill's FindBugs slides from JavaONE 2009? You should create some step by step directions on getting started with NetBeans, FindBugs and the OpenJDK. We need to get developers working on this.
Humm, Ok, I'll look into that.
Don't just "look into it", do it!
Ok ok already, I'll "do it".
And try and talk about how to fix warnings, and especially the FindBugs errors, maybe talk about some kind of best practices.
Yeah yeah, and I'll take care of the world peace problem too.
Smart ass, how did you ever get this job in the first place.
Everything else I wanted to do was illegal, creating software seemed like the most criminal thing I could do that wouldn't put be in jail.
Oh geez, why does this seem like a Dilbert comic? Get to work!
Aye aye Captain! Batton down the hatches, full speed ahead, we be looking for the White Whale...
"Drink, ye harpooners! drink and swear, ye men that man the deathful whaleboat's bow -- Death to Moby Dick!"
Oh for heavens sake, maybe you should look into a mental institution.

Ok folks here we go...

My sincere apologies to the Whales and Whale lovers out there, just remember Moby Dick is just a fictional story and I am in no way condoning the slaughter of those innocent and fantastic animals.

NetBeans, FindBugs, and Hunting Moby Dick

For a developer that wants to actually change the source code, the very best way to work with a tool like FindBugs is through an IDE.

  1. Get .

    Download and install NetBeans 6.5.1, I used the smallest "Java SE" version but any one of the "Java" versions will do. It installs quickly and easily. I would normally recommend the newer NetBeans 6.7, and I am trying 6.7 myself right now, but so far I have been unable to get the other steps below to work with 6.7, so I'd stick with 6.5.1 for now.

  2. Turbo charge it .

    Configure the NetBeans memory settings for the best performance, this is optional. See my NetBeans performance blog. Effectively we want to boost the memory sizes to improve the interactive experience. Of course, if you have less than 1Gb RAM, you may want to avoid this completely or adjust the -Xmx number down:

    
    Mac1> mkdir -p ${HOME}/.netbeans/6.5/etc
    Mac2> cat >> ${HOME}/.netbeans/6.5/etc/netbeans.conf
    netbeans_default_options="-J-Xms256m -J-Xmx768m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m
    -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true -J-XX:+UseConcMarkSweepGC
    -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled"
    
    NOTE: Keep in mind that if you run FindBugs inside NetBeans as I am suggesting here, you may need to adjust the above -Xmx number even higher depending on what you are running FindBugs on (e.g. how many class files or the size of the jar file). Running FindBugs as a separate process allows you to avoid using NetBeans heap space, but you won't get the good integration with the IDE that I'm advertising here, and what I think you need to actively work on fixing the bugs. FindBugs does use up some heap space, just make sure you have enough.

  3. Get FindBugs .

    The NetBeans FindBugs plugin is a bit hard to find. You need to tell NetBeans where the UpdateCenter center is that has this plugin. The NetBeans plugin is not maintained by the FindBugs developers. To do this you need to start up NetBeans 6.5.1 and do the following:

    1. Select "Tools->Plugins".
    2. Select "Settings".
    3. Select "Add"
    4. Enter any name you want in the "Name:" field, and for the "URL:" field use:
      https://sqe.dev.java.net/updatecenters/sqe/updates.xml
      then select "OK".
    5. Select "Available Plugins", select the "SQE Java" plugin, select "Install", and go through the plugin install process.
    You should now see several new icons in NetBeans, specifically the icons for the SQE site , the FindBugs tool , and the PMD tool . My experience with FindBugs has been very positive and I trust this tool completely, rarely has it been wrong or given bad advice. On PMD, you will note that the PMD tool has the image of a gun in it's icon, for a good reason, be very careful with PMD, shooting yourself in the foot is pretty easy to do.

  4. Find a NetBeans project to play with. My first example is jmake, a small Java project available from kenai.com. Get yourself a clone with:
    hg clone https://kenai.com/hg/jmake~mercurial ${HOME}/jmake
    Then use the NetBeans "Open Project..." to open up this directory ${HOME}/jmake as a NetBeans project. It should load up fine, build cleanly, and you can try using FindBugs to look at and even fix some of the bugs.
    Note: You need to be a developer member of the jmake project to push changes back.

    Or you can get sources, and either find a NetBeans project or create one. I chose to create one and picked the jdwpgen tool in the jdk/make/tools/ directory. So I did this:

    1. Cloned the OpenJDK sources (just a partial forest):
      hg clone http://hg.openjdk.java.net/jdk7/jdk7 ${HOME}/myjdk7
      cd ${HOME}/myjdk7
      hg clone http://hg.openjdk.java.net/jdk7/jdk7/jdk
    2. Tell NetBeans to create a "New Project", pick "Java Project with Existing Sources", naming the project "jdwpgen", and I'll locate this throw away project at ${HOME}/jdwpgen, then select "Next".
    3. Then I tell it to use the source directory ${HOME}/myjdk7/jdk/make/tools/src/, and select "Next".
    4. Then I specify build/tools/jdwpgen/** in the "Includes", and select "Finish" to complete the project definition. This process should work for any clean subset of Java sources in the OpenJDK, but I can't attest to that fact, yet.
    5. Try a build (should compile 50 files or so), run FindBugs, try and fix something.
      Note: You will need to be a member of the OpenJDK project and be able to create correct changesets to push changes back, this normally requires a BugID, and will require that certain changeset comment and whitespace rules are followed. (Yeah yeah, I know we are working on this, someday I'll be able to describe this better and it will all be open and completely logical ;^). Anyone outside of Sun that has tried to push changes into OpenJDK will confirm how difficult this currently is, but we are working on it.

That's it, play with it, try fixing FindBugs errors or compiler warning errors. Aye, we didn't manage to kill Moby Dick, but we sure sunk in a few good harpoons.

Command Line Usage

The FindBugs and PMD tools can be run from the command line to create all kinds of reports. You will need to download and install FindBugs and/or PMD of course.

Some sample FindBugs command lines:

findbugs -maxHeap 512 -textui -effort:default -low -exitcode ${HOME}/jdwpgen/dist/jdwpgen.jar
findbugs -maxHeap 512 -textui -effort:default -low -exitcode -xml:withMessages -output ${HOME}/jdwpgen/build/findbugs.xml ${HOME}/jdwpgen/dist/jdwpgen.jar

Some sample PMD command lines:

pmd.sh ${HOME}/myjdk7/jdk/make/tools/src text basic,imports,unusedcode
pmd.sh ${HOME}/myjdk7/jdk/make/tools/src xml basic,imports,unusedcode > ${HOME}/jdwpgen/build/pmd_out.xml

I use the command line versions when I just want the data for statistic purposes or as part of a batch build process, which I'll talk about later.

Mac, NetBeans/Ant, and PATHs

FYI... anyone that works with Ant scripts (all NetBeans users) has found out that the best way to get the Ant <exec> to work well is to set PATH properly, but controlling PATH from a GUI launch is tricky. For the Mac see my previous post on NetBeans, Mac and PATHs, which explains the Mac tricks needed to set the PATH for NetBeans.

For Developers, Hudson IS The Answer...

Have you used Hudson? If you haven't, you should, I'll blog about it more very soon, but to get yourself started, do this:

  1. Download Hudson (hudson.war)
  2. In a separate shell window, run:
    java -jar hudson.war
  3. Go to http://localhost:8080/ and play with your very own Hudson, create a new job, browse the many plugins available,...

I'll talk about Hudson and how to connect it up to FindBugs, PMD, Warning Messages, etc. in a future blog...

-kto

The JavaOne tech keynote demo of Jigsaw inspired a bunch of feedback on blogs:

Alex Miller thinks the vision is pretty coherent:
The more I saw of this talk, the more I realize the scope here is ambitious - there is a pretty coherent vision in this demo and it’s broader reaching than I had previously understood. The vision includes a complete overhaul of how we compile, package, and startup our Java applications.


Peter Pilgrim thinks it made common sense:

I was particularly impressed with the Project Jigsaw, the JDK modularisation effort going since Christmas last year. At Devoxx, Reinhold just talked about it, at this year's JavaOne conference, he demonstrated it with Ubuntu Jaunty Jakolope. The first that vowed was the removable of the CLASSPATH that had the crowd in "oohs and aahs". Reinhold show the JDK can be pulled from Ubuntu repository in stages and the JMOD command. He built a simple application that required the installation of the compilation, awt and swing modules. Jigsaw finally made a lot of common sense.


Bram Bruneel was impressed by the native package generation:

Further more Mark showed us a nice demo of the packaging and distribution of Java apps on ubuntu. De JDK modules will be normal debian packages and you will be able to create your own Java application, export it to a debian package and define a dependency towards the java modules you need to run your app. Quite nice.


Gerard Davison looks forward to a future without mandatory CORBA downloads:

The one significant project was "Jigsaw" which reduces the JDK into much smaller modules. For example desktop profile made up of base; awt and swing. Really does cut down on the core download. Oh for the day we don't have to download the Corba support all those useless classes which pollute code insight.


Floris Ouwendijk thought the keynote demo was very clear on the functionality of Jigsaw:

Mark Reinhold took over the presentation to discuss the JDK7 features. The focus is on modularity and multi-lingual capabilities. The modularity features (project Jigsaw) are intended to decrease download size for people without broadband (apparently more than a few), as well as supporting constrained devices. He performed a lengthy but very clear demonstration of the functionality provided by Jigsaw.


Augusto Sellhorn has a good post summarizing all the Jigsaw related sessions:

The main reasons to introduce Jigsaw into JDK 7 are the following:

* Eliminate classpath complexity (classpath/jar hell problem already discussed).
* Increase performance. The VM download size can be made smaller, and startup time should improve because for small programs (say HelloWorld) unnecessary classes don’t have to be loaded at all. Mark showed how he could run HelloWorld by only using 2 modules listed by the new jmod command; jdk.base@7-ea and jdk.boot@7-ea.
* Enable native integration for installing modules.


Peter Kriens likes the native package generation for the JDK, but doesn't want to have to see it:

Then about Jigsaw. It is very focused on breaking up the JDK into modules. I like the native installers but I dislike the fact that they put this native packaging stuff in my face.


Jason Young thinks Jigsaw was a JavaOne highlight:

Highlights from my perspective:
* Project Jigsaw (Java 7 modules) – the modularization of the JVM and application libraries has a lot of promise, and can help cut down on bloat. The keynote demo of this went well.


Eric Newcomer uncloaks as a resident jigsaw-dev lurker:

One more thing to add - I have been following the Project Jigsaw public email list, and from what I could gather what was presented at Java One was more or less equivalent to what they could manage to get done by then.


And if you've really made it all the way down here, then let me point you to the latest JavaPosse interview from JavaOne with Mark Reinhold and Alex Buckley, about Jigsaw and JSR 294.
This JavaOne was a bit different from last year's. In terms of sessions at JavaOne, I've only had a relaxed and interesting OpenJDK Porters BoF to host with my co-host, David Herron, so I could instead of hacking away on slides spend my weeks leading up to JavaOne on preparing the OpenJDK pod in the exhibition space, and happily hacking away on jpkg, a small, easy to use packaging tool for Jigsaw modules. Jigsaw is a nice code base to work with, pretty consistent, tight and clear, so after reading the code, and the corresponding documentation, writing the first iteration of jpkg with support for Debian package creation was a breeze.

Separating the architectural concept of modules in the language in JDK 7 via JSR 294 from an actual implementation provides a lot of interesting optimization opportunities at deployment time. The level of granularity at which the developer operates, and defines his or her dependencies in the module-info.java file, can be decoupled from the level of granularity at which the deployment takes place, without having to give up the module abstractions in the process. As shown in the keynote, at deployment time, the base package of the JDK can be a few kilobytes, depending internally on a couple of other, automatically created, small packages that get pulled in at deployment time as necessary using the operating system's built-in software deployment mechanisms.

The separation of concerns between the language concept of modules and the concrete module system allows using tools like jpkg to create an N:M mapping of abstract modules to concrete deployment artifacts. The freedom to pick the best delivery mechanism for a given platform is an obvious benefit, for example - on platforms with a package manager the most user-friendly way to deliver the JDK is via corresponding packages. Going native through ahead-of-time compilation, where platforms demand it, becomes possible, too, without breaking out in sweat - it turns into just another post-processing step that could be applied to modules before they are wrapped into deployment artifacts, like pack200 and LZMA compression was in the current jpkg code. Splitting a module transparently into a couple of native deployment artifacts becomes easily feasible, as well - JNI libraries, for example, can be turned into separate, architecture-specific packages, reducing the download size for complex applications with native code for several architectures (incidentally that's just like the JDK), as well as making it a bit easier to deliver just a tiny updated package for the native library portion in case of a good old buffer overflow in the native code.

In the JavaOne technical keynote (watch the video of the JDK 7 part here), Mark Reinhold made a great point about module integration in the compiler and the runtime allowing the concept of a manually managed $CLASSPATH to be retired both at compile time, and at deployment time - i.e. the $CLASSPATH is dead. Once one succeeds in making the $CLASSPATH disappear, it turns out that a lot of other things become easy - like generating out-of-the-box native launchers for Java applications, as shown in the keynote. Similarly, for applications depending on the swing or awt JDK 7 modules, one could have jpkg automatically generate the right bits in place in the generated debian packages to make the installed applications appear in the desktop menus.

Since I spent most of time at JavaOne at the OpenJDK pod talking with curious visitors and chatting about JDK 7 and OpenJDK, I missed most of the regular sessions, and went for the BoFs instead. I enjoyed Joe Darcy's Small Language Changes session (slides), but missed John Rose's cool DaVinci VM talks (slides, and more slides), and Alan Bateman's new NIO talks (slides). Like every JavaOne, there were plenty of interesting BoF sessions to pick from, my favorites being the Caciocavallo BoF (slides), given that it's another OpenJDK Porters Group sponsored project, and Mark Reinhold's and Alex Buckley's laid back Modular Java Platform Q&A session.

There was a lot of good feedback in the Q&A session, and I was pleased to see some good feedback on the web too. But that's material for another post.

Nice evening today: come I to "Nord See", order something tiny. Suddely the waiter brings to me the big top range meal, smiling sweetly and saying "this is for you ... ". I look surprised but assume maybe some marketing activities. Exactly when I finish the same waiter runs back away, shouting "... when you have NOT been ordering this, you must say so!!!!". That should I do? "But the taste is really good" - reply I with the expression of the canibal in my face ,- "I will pay, no problem". Why to spoil the mood so raised, not so expensive after all. Reminds me.

A minor update.

Changes:

  • Changed version to 0.40.0.2
  • Changed build to generate rmi stubs instead of depend on .class files in openjdk6-b12-stripped-IKVM-0.40.zip. Thanks to Jo Shields for helping with this.
  • Fixed verifier bugs. Thanks to Brian Heineman for reporting this.

Binaries available here: ikvmbin-0.40.0.2.zip.

Sources: ikvm-0.40.0.2.zip, classpath-0.95-stripped.zip, openjdk6-b12-stripped-IKVM-0.40.zip

Have recently finished the practical part of "Advanced Operating Systems" in ETH. More a hobby - like activity, lots of time have passed since I have been a student the last time. Step by step, over half a year each student have implemented a tiny working system on the top of L4 microkernel for NSLU2. It even has its own ELF loader. At times I started to think that it may be interesting to put a java virtual machine on the top of L4 as the first (root) task. In L4, the root task can do many things that the ordinary program cannot do. Most interesting it can map and remap pages, so we can have chunks of memory appearing from nowhere in virtual space. Or extrafast moving by remapping (while it may be difficult to see as these pages are 4 kb at least and must be aligned). If some other task (normal L4 executable) wants to do such things it can only do via requesting root task to do this. Context switches and so on.

L4 also has quite pretty threads, and each thread can have individual mappings. For instance, they can have each its own stack exactly in the same place of the address space. But in general it is a very tiny kernel; apart maps, threads and interprocess pipes there is almost nothing more there. This is not because of incompleteness, it is more a kind of concept.

However drivers seems being a biggest problem, even if we restrict interface to the network alone. It was a not so bad network driver for the NSLU2 chipset in the provided package, but the problem is that this hacker-loved slug seems no longer in production. Some German groups try to run existing Linux drivers under L4 in some emulation mode.

There are young people playing leading roles, so the Star Trek movie is like a space road trip full of Wesley Crusher's space college friends. Which is actually a good thing, compared to other Star Trek movies. The movie is fun, at least for the first 80 or so minutes. The script takes care of providing regular comic relief to make the filler segments less annoying. The kill count puts any Rambo movie easily to shame, with a few billion species being supernova-ed and black-holed out of existence. There are space chases, warp jumps, tattooed & pierced villains wearing black, cracks in hulls, man made black holes, beaming accidents, and the occasional space monster, too.

The script doesn't hold up too well towards the final third, once the chase with the villain begins. It's relying a bit too much on every bizarre idea and heroic deed of the Enterprise crew working the first time. Escaping from all-devouring black holes? Piece of cake for them. But nevertheless, it's a lot more enjoyable then Star Trek movies were in a long while.

As we reported at JavaOne, a lot has been going on for javac over the past year.

Under the auspices of Project Coin, various small language changes are being considered: strings in switch, arm blocks, binary literals, large arrays, and the diamond and "elvis" operators. Project Jigsaw is investigating the use of modules; JSR 292 is providing support for the "invoke-dynamic" bytecode, and JSR 308 will provide support for annotations on types.

In addition, within javac, we've been finding and fixing bugs, including issues in the type system, and improving the diagnostics that may be generated. We've worked to produce an ANTRL-based grammar for the compiler, and we've worked with the OpenJDK release team to release javac as part of OpenJDK 6.


Well, after having ported to GShisen to Macintosh I had absolutely get it running on Windows. This requried some minor changs in the code since mingw is not a complete POSIX system.
However, as the screenshot testifies, GNUstep proves once again its portability power. The screenshot also shows the horizontal in-window style menus.
Gibson, Neuromancer, Cyberpunk, open drawer, close drawer. Well, not quite - Spook Country doesn't really have any super-futuristic gadgetry. It's set in the present, describing a post-9/11 world of dispersed, interconnected knowledge, where reality can have many layers, which ultimately end up meeting in the book. So far, so standard. A nice idea from the book is locative art, that takes the concept of tagging OpenStreetMap maps with useful information to adding interactive 3d virtual models representing different artists' work that can be seen as an overlay on reality. That's probably just one iPhone app away, these days. That kind of layering of meaning upon subjective realities takes place throughout the book, as the characters follow their fates and orders.

It is a book about shipping containers, money laundering, organized crime and corruption, and mysterious men that are rich and invisible enough to play practical jokes at the expense of the players in the system. It's also a book about the lack of anonymous superheros fixing a world where the distribution of power and responsibilities between organizations, individuals and governments has become highly dispersed and nontransparent, allowing large sums of money and people to disappear without a trace. As Gibson's characters try to work out their subjective identities and allegiances, their dislocation in the fading old system of the world is what they have in common, and it keeps the short chapters turning.

It's a quick read, and not bad at all. The themes of globalization, (dis)location, identity, surveillance, etc. are not pushed too hard in the reader's face, but ultimately, the book doesn't manage to reach out of the contemporary conspiracy theory literature niche to teach something new about the human condition in an increasingly virtual world. It's complicated - Well, yeah.

But the writing style, with fast paced chapters of a few pages at best, is something that's fun to dive into - almost like reading a web of short blog posts.
There are a lot of amusing moments in this one - plenty of references to old Terminator movies, and many highly awkward sequences that feel mashed up from somewhere else. My favorite is the couple of minutes long monologue by none other then Skynet, explaining in typical Bond-villain style with a human voice to its unwitting human-turned-bot tool how its evil plans are unstoppable, only to have them crossed by that Bond / tough dude character names Marcus. For added fun, director McG lets the Skynet offer different faces to Marcus, as if that would make the message more acceptable - an awkward nod to Contact out of nowhere in a sequence that feels like the worst monotonously monologue moments of Matrix Reloaded.

Salvation is very linear, and would be a pretty boring affair if it wasn't for the rhythm of explosions pushing it ahead every couple of minutes. During the course of a couple of days in the movie, two small scale nuclear explosions happen in the close vicinity of mankind's would-be savior, John Connor, one blowing Skynet SFO to pieces and the other one all of Connors combat troops for the day, though he somehow marches on and on, requiring a replacement heart every now and then, but otherwise apparently intact. There is a lot of awkward hand-to-hand combat with humanoid bots, something that feels as oddly out of place in a world supposedly dominated by machines, as do conveniently humanely placed keypads on Skynet's bunker doors. Skynet hasn't heard of RFID technology, apparently.

The explosions are neat, though. There is a scene in which John Connor decides to burn down a small patch of a forest from his helicopter in a sequence that could have been taken straight from a Vietnam War movie, if it wasn't for the Matrix-inspired 'hydrobots' snapping away at Connor's heels and bringing his helicopter down. Helicopters in the future in general crash early, and crash often, but like in Star Trek, that doesn't lead to anyone putting on safety belts. Of course, if nukes were exploding twice a week a few meters away from me, I guess I wouldn't care much about flight safety, either.

The real star of the movie isn't Connor, it's man-machine Marcus. He gets to smash screens, punch terminators and humans alike, walk on mines, develop love interests, get shot at, discover his split machine/human nature and so on. Between the muscled heroes, every now and then a female character gets a bit of screen time. The future is not kind to women, though - resistance's leadership is made up exclusively of men, and beside the single female pilot/love interest, and Connor's wife, female survivors seem to have largely missed out on the charms of joining the resistance and wearing army coats with red arm patches.

Completing the PG 13 picture's main male cast is man-boy Kyle Reese - the teenager destined to be Connor's father some day. The plot centers around the idea that Skynet must not capture & kill Reese, as that would ultimately prevent Connor from being born in the current timeline, which means Skynet would win (and Skynet knows that, as it's initially on a mission to kill Reese). Once Skynet captures Reese, though, for some Bond-villain-y reason Skynet decides not to kill the boy, and instead to wait for Connor to show up for a rescue mission lured in by his newly acquired man-machine friend Marcus. Then the old familiar Terminator show boxing takes place a couple of times, until Connor triggers a self-made nuclear device, MvGyver-style. Boom. Skynet SFO off line, more small scale nuclear explosions to come in follow up sequels, surely.

There are things to like, of course - Skynet and Connor are both relying on sheer luck a lot more then on systematic planning to achieve their goals, which is quite amusing in a movie where both main characters' motivations are centered around the idea of determinism. And of course, the movie has old rock music from the 90s in it - it's been years since I last heard Alice In Chains in a movie. At the same time, the prolonged lack of actual comic relief makes the movie pretty tedious to watch, like a long, witless version of a Mad Max road movie.