Using The Latest Java Versions in Domino Agents
The other week I figured out how to make Domino Designer let me code using more up-to-date versions of Java.
I was trying to use a third-party API. To use the API required coding with a version of Java, which, although I knew my version of Domino supported, was giving me compilation errors nonetheless.
As an example, create a new Domino "app" in Designer 8.5 and add a new Java Agent. Try to add a parameterized type, as below:
Hovering over the error it says:
"Syntax error, parameterized types are only available if source level is 1.5"
A quick Google confirms that Domino 8.5 supports Java 1.6. So why won't the above code work?
It turns out you need to change the Java compilation settings on a per-database basis.
If you go to the Project -> Properties menu from within the database in Domino Designer and find the Java Compiler tab, you'll see something like this:
Change both of the above settings so that all say "1.5" and then the code compiles without any errors:
Note: It's my assumption and I guess it goes without saying that this means any Java Agents written in the this database will only run on Domino server that support Java 1.5. I guess the reason it defaults to Java 1.2 for the .class files is to extend compatibility as far back as possible?
But version of Domino added support for Java 1.5? Glad you asked. Read on.
A Brief History
Here's a short history of Java versions released and which version of Domino added support for that version of Java.
Java Version | Domino Support | Notes | ||
Version | Date | Version | Date | |
JDK 1.0 | Jan 1996 | - | - | |
JDK 1.1 | Feb 1997 | 4.5 | Dec 1996 | |
J2SE 1.2 | Dec 1998 | - | - | |
J2SE 1.3 | May 2000 | 6.0, 6.5 | Sep 2002 | |
J2SE 1.4 | Feb 2002 | 7.0 | Aug 2005 | |
J2SE 5.0 (1.5) | Sep 2004 | 8.0 | Aug 2007 | Adds enumerations, better for-each looping as well as generics |
Java SE 6.0 (1.6) | Dec 2006 | 8.5 | Dec 2008 | |
Java SE 7 | July 2011 | - | - |
As you can see there's typically a 2 to 3 year delay between a new Java version coming out and a version of Domino adding support for it.
To me the most significant change in Java came in version 1.5 (Domino 8.0) when you could use not only generics but also enumerations and easier looping, like this:
All in it offers a more pleasant (C#-like) programming experience. Next time you write a Java agent consider switching to using Java 1.5!!
Most of the above will probably seem plainly obvious to most seasons Domino devs, but it was news to me. Hopefully this will help others in my shoes.
Is Java like C# coding or is C# more like Java coding?
Anyhow, it's great when they share (copy) ideas from each others :)
Reply
I've been trying to use Java instead of LotusScript to write agents for a few months now. It is such a better language and it has tons of great libraries for stuff like working with PDFs and Excel files. Getting experience in Java translates better when switching to different technologies in the future, while LotusScript looks like a dead end outside of Domino (it even seems like a dead end within Domino since they haven't been extending it and adding any new features). Have you tried the hack yet that allows you to use the Eclipse debugger within Designer?
Reply
Which hack is that?
Reply
Show the rest of this thread
Hi,
do you know if Java SE 7 is supported by 9.0?
Thanks
Reply
By default, you can only set it to compile up to Java 6. There may be a way to install Java 7. You'd need to have that on the server too. I haven't found a way to do it.
Reply