About software development for the enterprise. Focus on Java EE and more general Java platforms.
You'll read a lot about Conferences, Java User Groups, Java EE, Integration, AS7, WildFly, EAP and other technologies that hit my road.

Wednesday, October 27, 2010

Bleeding edge - First steps with OpenJDK 7 Build b115

08:10 Wednesday, October 27, 2010 Posted by Markus Eisele
,
Here it is. The guide, to making your first steps into the next version of Java we all are waiting for. Let all the others talk about politics. We are going to test drive what's there today. Prepare for some exciting times.

Preface
This is not a true beginners topic. I'll guide you through installing the binary builds and give some very brief hints at building your own OpenJDK7 version first. After that, we are going to take a look at some of the new features which are already working. But there are a couple of things, you should be aware of:
1) We are working with a development build. Expect this to be anything but mature, production ready or even stable. If you go on reading, you agree on being a geek willing to work with bleeding edge stuff. There is no other help from now on than yourself. Don't bother anyone of the OpenJDK developers with beginners questions. They are hard at work providing the complete set.
2) You should know how to write and compile Java classes without any IDE support. Non of the Eclipse or NetBeans versions were too happy about having a JDK 7 on board and they know nothing about it today. So you need to get yourself an editor and a cmd-line.

Download and install
If you are not willing to build everything yourself, you also could download a binary snapshot release. It's far easier to install this one. The list offers files for different platforms - please be sure to select the proper file(s) for your platform. Carefully review the files listed there to select the ones you want, then click the link(s) to download. The DEBUG builds have not been run through ANY quality procedures, and are only provided as a potential way to track down a bug in the more official product bits. There is no guarantee that the debug builds even will work. For a Windows Offline Installation, Multi-language JDK installation, you need the 86.22 MB jdk-7-ea-bin-b115-windows-i586-21_oct_2010.exe. It's installation is exactly what you know from previous versions. You have a couple of wizard screens. Follow them and you are done. It's better not to install the Public JRE! You are not willing to have OpenJDK7 in your browsers as the default JRE at the moment.


Download and build
If you are willing to build the OpenJDK 7 yourself. There are a couple of things you need:
- The source downloads for the OpenJDK Project. You could also grep the sources from the repositories.
- Some binary plugins. Also available from the source downloads page.
- Things listed at Minimum Build Environments
- GNU make
There is a very complete OpenJDK Build README out there, where to find more detailed explanations of what to do. If you are unhappy with it or you don't understand something. Don't try it. There are binary builds available.

First steps
Check, if your installation is valid. Switch to your %JDK7%\bin folder and type java -version.
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b115)
Java HotSpot(TM) Client VM (build 20.0-b02, mixed mode, sharing)
If you are willing to give it a try, you should put the %JDK7%\bin folder to your path variable.
Seems as if you are set. Next is to fire up some first tests. Make yourself familiar with the new features and give them a try. A good place to start is to look at Arul's post Rest of Project Coin explored, advantage Java 7. I tried the Strings in switch feature. I have waited for this too long :) Taken from Joe Darcy's Project Coin JavaOne presentation and adapted from Arul's blog. It takes a month name and a year as input and returns the days of the month in that year. Take your favorite editor and put it in (Classname and Package, as you like it).
int days = monthNameToDays("February", 2008);

public int monthNameToDays(String s, int year) {
   GregorianCalendar c = new GregorianCalendar();
    switch (s) {
        case "April":
        case "June":
        case "September":
        case "November":
            return 30;
        case "January":
        case "March":
        case "May":
        case "July":
        case "August":
        case "December":
            return 31;
        case "February":
            int days = 28;
            days += c.isLeapYear(year) ? 1 : 0;
            return days;
        default:
            return -1;
    }
}

And, as usual, compile the class and run it. For February, 2008 it returns 29 days. As expected. Great stuff! If you are looking for more advanced examples, you have to dig deeper. The new I/O API is probably a great place to look at. There is a quite old article (2008) about the new features on java.net.
Very short background: What used to be a java.io.File will now become a java.nio.file.Path. This is a more accurate name, since there was never any guarantee that a File object mapped to a real file. Also, paths can refer to both files and directories. The Path class is abstract and has no constructors. Instead, you'll ask a FileSystem object to create a path for you. This way, it can create a path that's specific to the type of file system.
import java.nio.file.*;

public class NioTest {
  public static void main(String... args) {
    FileSystem local = FileSystems.getDefault();
    Path p  =  local.getPath("bar.txt");
    String url = p.toAbsolutePath().toUri().toString();
    System.out.println("Path: " + p.toString());   
    System.out.println("Url: " + url);
    }
}

If I run it on my system I get what I expected:
E:\OpenJDK7Tests\src>java NioTest
Path: bar.txt
Url: file:///E:/OpenJDK7Tests/src/bar.txt

Further readings
This really was not everything waiting for you. You should make yourself familiar with all the new things to come. To be honest, it's not too easy to keep up with what's becoming Java SE 7 at the moment. As you might have heard, there are a couple of political things around which lead to many not technical search results, if you are googling for JDK7. The best place to start looking for further information is the openjdk.org homepage. If you are looking for a blog to subscribe to, look at the openJDK News blog or follow @OpenJDK on twitter. Next place to look are the mailing lists. Sad to say, that every project has it's own. If you are looking for some more advanced stuff, you can also have a look at Arul Dhesiaseelan's blog. He is looking into what's coming up for Java SE 8 (Lambdas, Rest of Coin ...). The offical Java Tutorials also start pushing content for JDK7 out. The Concurrency lesson now includes a chapter about the new Fork/Join framework. Also the NIO 2.0 parts are already featured. A short overview about the SDP (Sockets Direct Protocol) is also available. But be aware, that parts are still moving around. We are all waiting for the Java SE 7 JSR's to be filed and we will see the Expert Group (EG) moving around things, too. So, for the last time a friendly reminder not to take anything too serious at the very moment.
If I could make a Christmas wish, I would love to see some more Java SE 7/OpenJDK7 content coming up. @Java told me, that Santa heard my wish :) Let's look forward!

Wednesday, October 20, 2010

18 and more clicks to the future. Java EE 6 with IBM's WAS 8.0

11:18 Wednesday, October 20, 2010 Posted by Markus Eisele
, ,
Its out. Finally. The first beta version of IBM's WebSphere Application Server has arrived. The beta offers an initial glimpse into the future of IBM's flagship.
As of now, it isn't touting complete and total Java EE 6 support for the beta product. As they carefully state with the feature list which tells us about "support for portions of key Java Enterprise Edition 6.0 specifications." Those key portions include:
  • Enterprise JavaBeans 3.1
  • Java Persistence API (JPA) 2.0
  • JavaServer Faces (JSF) 2.0
  • JavaServer Pages (JSP) 2.2
  • Servlet 3.0
  • Java EE Connector Architecture 1.6
  • Contexts and Dependency Injection for Java (CDI)

Monday, October 18, 2010

NetBeans 7.0 Milestone 2 features WebLogic Server Support

15:35 Monday, October 18, 2010 Posted by Markus Eisele
,
The NetBeans folks have been busy working on their next release: Milestone 2 of NetBeans 7 is now available and it has a lot to offer:
- Java EE 6 enhancements,
- support for GlassFish 3.1 and
- Oracle WebLogic Server
For a complete list of new features, you should check out the new and noteworthy page. This post is about all the new WebLogic Server features available.

The past
NetBeans always has been the development tool for GlassFish and Tomcat. With Oracle taking over control and committing their support, it was obvious, that WLS will follow. This happened early with NetBeans IDE 6.10 Milestone 1. As of todays M2 the support grew significantly.
If you are willing to try it out, get started today. Grep your copy of NetBeans and install it to your favorite location. Start with a new Webproject and select "Add" next to the serverruntimes shownn (GlassFish, of course). Next is to browse for your WLS install. Remember not only to point it to the %HOME% but directly to the server folder (e.g: D:\Oracle\wls11gR1P2\wlserver_10.3). Click next and choose a domain and enter admin user and pwd. A final click on "finish" will close the wizard and lets you go on with the webproject creation.

Thursday, October 14, 2010

Software Quality on JSF Mojarra 2.0.3-SNAPSHOT

13:58 Thursday, October 14, 2010 Posted by Markus Eisele
,
Seeing all those political stuff on my blog lately I personaly need a break. And what is best? Get your hands dirty :) And this is what I did. I downloaded the latest mojarra-2.0.3-FCS-source.zip (12/10/10), build it and did a brief setup of my favorite software quality checker with both the API and the RI.
And back to the initial topic, here are the dirty findings :).

Preface
I did this without knowing that much about the project. I am not a committer or in any other way related with the Mojarra Team. Therefore, my findings may leak a bit of interpretation. I also missed to discuss the findings with the team before publishing. First of all, they are not critical (everything works and runs literally in a thousands of places) and second they are not about security or anything else compromising. A quick "Thank you!" to Jochen, who helped me with the msg.Java measuring station. I am open to questions and would love to hand the complete report to the team (@Edburns, you know, how to reach me :)).

msg.Java measuring station
The JMP is described in more detail in a previous post (dec last year). Up to now only the tool versions changed. We are running at the moment:
[echo]  ==         Ncss 32.53
[echo]  ==   Checkstyle 5.0
[echo]  ==     FindBugs 1.3.9
[echo]  ==       Simian 2.2.24
[echo]  == Dependometer 1.18

Tuesday, October 12, 2010

Java SE 7 - new features in detail

04:40 Tuesday, October 12, 2010 Posted by Markus Eisele
,
A lot has been talked about the planned roadmap. And up to now it seems as if it is still not sure, that we will have a new Java SE 7 as planned (Mid 2011), but I thought it may be time to take a deeper look at what's in it and give you a collection of further readings on the separate topics. Following the post by Mark Reinhold from yesterday, where he states details about plan-b this is a more detailled collection with aggregated links and further readings.
The umbrella JSR for Java SE 7 should be submittet during the next weeks. Mark points out, that there might be changes to the list:
These lists should be considered neither exhaustive nor final—they are merely the starting points at which the Expert Groups for the Umbrella JSRs will begin their deliberations.
(M. Reinhold)

Thursday, October 7, 2010

Review "Java EE 6 with GlassFish 3 Application Server" by David Heffelfinger (PACKT Publishing)

09:16 Thursday, October 7, 2010 Posted by Markus Eisele
, ,
Packt Publishing was so kind, sending me their latest Java EE 6 with GlassFish 3 book for a detailed review.After a couple of weeks delay (work, J1 and more) I finally completed my review and here are the results from the German jury ;)

Book : Java EE 6 with GlassFish 3 Application Server
Language : English
Paperback : 488 pages [ 235mm x 191mm ]
Release Date : July 2010
ISBN : 1849510369
ISBN 13 : 978-1-849510-36-3
Author : David Heffelfinger Twitter | Website | Blog

Monday, October 4, 2010

Free Java? jcp.next? Here are the options!

09:06 Monday, October 4, 2010 Posted by Markus Eisele
, , ,
A lot has been written on this topic over the last few weeks. And it was one of those things that depressed me during JavaONE. Nobody spend an offical word on all those rumors, lawsuits and a possible jcp.next. But the voices calling for a change in the treatment of Java hasn't become silent.
Seems as if it is time to step back and order the thoughts. That is what I was trying to do this weekend. And here is a brief analysis about the "publicly known" facts and the options for the future in my eyes. Why? I guess, Eduardo was right with his response on my tweeted fears. He said:
my point: easy to say free it when not owned nor paid for; change places & well see
(Source: twitter)