You Know You Are In Trouble...
When this dialog box shows up:
Yes. It appears that my PC is infected with a virus/malware/badware.
What a relaxing and productive use of the Christmas vacation. Not!
Brian and Brian and Brad and David, you can start laughing at me now for not converting to a Mac.
Java 6 For Leopard Is Coming
(Via Dean Wette on the OCI internal mac-user mailing list.)
Arnold Kim of MacRumors.com: Next, Apple has finally seeded Java SE 6 Preview 8 for Leopard. Apple had been secretive about the Java 6 support for Leopard and the product launch was met with disappointment amongst Java developers hoping for support for the latest version. Tonight's release provides an implementation of Sun's Java SE 6 for Mac OS X 10.5 (Leopard) and includes Java SE 6 version 1.6.0_01. This latest seed requires a 64-bit capable Intel-powered Mac and is described as having received only limited testing thus far.
If this rumor turns out to be true, it looks like my prediction from 52 days ago is fulfilled (with a bit of stretch):
Weiqi Gao: Through my crystal ball I see that by Christmas time, there should be Java 6 on Max OS X.
Tim's Scala Slides Is Online
I did not do a live blog about Tim Dalton's Scala talk last week at the JUG. Michael Easter promoted the talk before hand, and Alex Miller posted his reactions the day after.
I just want to mention that the slides of the talk is now online:
Improving Generics: The Votes Are In, We Want It
Reporting from Javapolis on Voting on Java 7 language changes, Stephen Colebourne reported that:
Stephen Colebourne: The strongest support was for Improving Generics, String Switch and Multi-catch. Attendees were giving a clear 'yes' to these being in Java 7.
The voting was done using a white board. The result for improving generics is 112-4-11, as shown in this image I grabbed from the results page:
So the cause of Erase Erasure lives on.
Closures In Java
(Via Pure Danger.)
Dario Laverde: Yesterday Alex Miller posted "Through the Java looking glass", which brought up some interesting points regarding the new Java 7 additions to the language wondering aloud if Java 7 "is going to succeed in creating an environment that still makes sense or whether it will be just the ugly step-child of these ideas which are better executed in their own environments".
Let me first acknowledge that I have not read any of the closure proposals. I have not played with the initial implementations by Neal Gafter, (although the closures.ztar has been sitting on my desktop for a while) or anybody else's initial implementations (are there anything else that are available?).
But I do have an opinion, or rather, a question, which I heard asked by Lauri Peterson, a fellow JUG steercom member, whenever something new and shiny is introduced:
Back in the days when local classes were added, one of the things that baffled many people is "Why do I have to declare a method parameter or a local variable final before I can use it in a local class?" And the answer given at the time was "to allow access to non-final method parameters and local variables would entail supporting lexical closures in the JVM."
So, before any new syntax are introduced, can we allow access to non-final method parameters and local variables in local classes? That way, we can say to the entrenched Java developer "You can still do everything you did, except now that you don't have to add a bunch of finals before your local classes will compile."
That's the closure I want. Can I have it?
Beyond that, I don't mind syntactic sugar that eliminates boilerplate code. But those should be introduced with care. First of all, make sure your syntactic sugar is not sour. Secondly, make sure your syntactic sugar doesn't cause cavities. And most importantly, don't introduce anything that would require a programmer to think some deep thoughts every time he codes with it, or worse, everytime he reads code with it.
Remember the original refrain that we used in our attempt to push C++ to the corner:
In C++, you need to approacha = b + c;with caution.
I just wish Java will never evolve in a way that will put itself on the receiving end of a similar comment.
[Update] Several things:
- There is a lengthy debate on this topic at the JavaLobby.
- Many people posted their opinions in the past couple of days. I find myself agreeing with almost everything Tim Bray said.
Tim Bray: But if they’re going into Java, they need to earn their way and be field-tested in the open-source ecosystem first.
Friday Java Quiz: Know Your java.beans Classes
Adam reminded me that I haven't posted my Friday Java Quiz yet. So here's a quick one: What will this program print:
public class Foo {
public static void main(String[] args) {
System.out.println(
java.beans.Introspector.decapitalize("HTMLParser"));
}
}
The same rules: no actually using the compiler or searching the internet for answers.
NetBeans 6.0: A Week Later, And A Much Better Story
First, an apology: My initial reaction to NetBeans 6.0 seven days ago was overly harsh. That post was made ten minutes after the download. And now I'm sorry (I'm really sorry, as in "I wish I never did it") I made that post in such a haste.
Now I have some explaining to do. As I mentioned in the comments to the earlier post, I tried two non-Java related features: C++ projects and UML reverse engineering. The C++ project exhibited some weird behavior—Netbeans claimed that my C++ project doesn't have any source files in it, despite my repeated attempts to add C++ source files to it. The UML reverse engineering project did not behave as in the NetBeans tutorial—no model was generated, only an XMI file.
Over the weekend, something wonderful happened. My Debian GNU/Linux 4.0 informed me that I have updates:
And I said, "Cool, now I can get NetBeans updates from the Debian repository." I did not mention this in my Getting Sun Java 6 On Debian 4.0 With APT Pinning post 37 days ago, but I also installed NetBeans 5.5 from the Debian unstable repository. NetBeans is in the contrib portion of the Debian unstable repository, so I have to change my /etc/apt/sources.list file:
# deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official amd64 DVD Binary-1 200704
07-12:15]/ etch contrib main
deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official amd64 DVD Binary-1 20070407
-12:15]/ etch contrib main
deb http://ftp.debian.org/debian/ etch main non-free
deb-src http://ftp.debian.org/debian/ etch main non-free
deb http://security.debian.org/ etch/updates main contrib non-free
deb-src http://security.debian.org/ etch/updates main contrib non-free
deb http://www.debian-multimedia.org etch main
deb http://www.dipconsultants.com/debian etch main
### unstable #######
deb http://ftp.debian.org/debian/ unstable main contrib non-free
and follow that with
[root@gao]# feta update [root@gao]# feta install netbeans-ide netbeans-platform
With that bit of work, my reward is the automatic update of the software packages when the new version comes out.
To make a long story short (as I've already made this short story long), I tried the same things on my Debian GNU/Linux 4.0 box, and they worked as expected. I was able to create C++ applications, static libraries and dynamic libraries. I was also able to reverse engineer a Java project to generate an UML model.
That got me thinking. What did I do wrong on my Windows box? The only thing that I could think of was when I started NetBeans 6.0 for the first time, it asked "I see that you have a NetBeans 5.5 profile in .netbeans, would you like me to import that?" and I said yes.
So I went back to my Windows box, deleted the .netbeans directory, and started NetBeans 6.0 again. And this time my two tasks worked correctly even on the Windows box.
One thing that I have to do to make the C++ project work is to add C:\cygwin\bin to my System path, otherwise NetBeans couldn't find the compiler, the debugger, make or the shell.
There you have it. It's been a week, and I like NetBeans 6.0 a lot more.
Friday Java Quiz: Know Your java.lang Classes
This weeks Friday Java Quiz is provided by Brian Coyner.
Q: What does the following Java program print:
public class Foo {
public static void main(String[] args) {
System.out.println(Math.min(Double.MIN_VALUE, 0.0d));
System.out.println(Math.min(Integer.MIN_VALUE, 0));
}
}
Like always, answer the question without the help of actually compiling and running the class or looking anything up in a book or on the Google.
Bonus Q: Is
-1
an integer literal?
Java News Brief (JNB): Why Scala?
This month's OCI Java News Brief (JNB) features Tim Dalton on the topic Why Scala?.
Tim Dalton:Introduction
Scala is a programming language that integrates features of object-oriented and functional programming languages. It is statically typed and compiles to JVM bytecode. A scripting interpreter is also part of the Scala language distribution. At the time of this writing, the current release of Scala for the JVM is version 2.6 with a significantly less mature .NET version beginning to get more attention. This document provides an overview of those aspects of Scala that make it an intriguing option for development on the JVM platform and perhaps eventually .NET as well.
Summary
Scala's features make it as close to a dynamic language as a statically type language can get and yet maintain the performance characteristics of compiled Java. Scala approximates features that make dynamic languages like Ruby and Groovy attractive. Functional language features allow Scala programs to follow a more functional style when it is better suited for the task at hand or take an non-functional imperative approach.
Like many of the other articles in the JNB, Tim's article is written in a tutorial style that flows naturally. It is best suited for a quiet afternoon's reading and experimenting at the terminal. Just download Scala and follow along. You won't be disappointed.
BTW, Tim will be the presenter at the December 2007 St. Louis Java Users Group meeting Thursday December 13. The topic—Scala.
Come!
NetBeans 6.0 Released, Still Doesn't Work (For Me)
Well, well, well. It was released yesterday. I downloaded it. I installed it. I started it. I tried two things. Neither worked.
Can you guess which two things I tried?
Hint: I'm still a IntelliJ IDEA user. So I wasn't trying to do anything that IDEA can do.
I used to claim that NetBeans was annoying. I won't make that claim now. Actually, this time it may very well be that I'm too stupid to set it up right. But the end result is the same nevertheless.