<< Blogging a retweet - too good to miss | Home | Bob Balfe: Problems enabling the Application/Install menu in Notes 8.5 beta >>

Doing Java in Notes? - make sure you know about JavaCompilerTarget

I blogged about the JavaCompilerTarget back in August last year when Notes 8 came out as you needed it to enable Java 5 in Domino Designer. Last week some nice new info on this notes.ini setting came my way in the Design Partner forum for Domino NEXT. If you're doing Java development in Notes you would want to read on.

And yes - I did check with IBM whether it was okay to blog it. Since this info is on its way out in technote (technote 1320401) it was fine that I blogged it.

JavaCompilerTarget

In Notes/Domino 8.5, you can set the JavaCompilerTarget INI variable to any value from 1.1 through 1.6. Here is a draft of the documentation (Note: In the following text, we refer to JDK 1.6, which is also known as JDK 1.6.0 and JDK 6.0.)

By default, Notes/Domino 8.5 utilizes JDK 1.6 to compile and run agents, but it limits language features to maintain backwards compatibility through JDK 1.2, to allow agents to run on earlier Notes/Domino installations (and, more generally, with any JVM version earlier than the target flag), regardless of whether the new language features are actually used in the agent's code (e.g., setting JavaCompilerTarget=1.6 could introduce the possibility of having an agent recompiled and replicated to a V8.0 server, and then failing to run). Additionally, problems could arise editing and saving agents compiled in Notes/Domino installations that are not using the same INI setting.

Developers must override the default behavior if they wish to use features specific to different JDKs. The default behavior is equivalent to the setting JavaCompilerTarget=1.2

In Notes/Domino V8.5, the developer may specify any JavaCompilerTarget from 1.1 to 1.6. (In each case, the -source flag is the latest source that can be specified with a particular -target flag.)

The developer may also specify JavaCompilerTarget=CurrentJavaVersion which means the target flag will be synced to the version in future Notes/Domino releases (e.g., if some future Notes/Domino version were to include JDK 1.9, then "JavaCompilerTarget=CurrentJavaVersion" would create "-target 1.9").

JavaCompilerTarget Resulting compiler flags Agent would run on Notes/Domino versions
1.1-source 1.3
-target 1.1
V5.0 or later
1.2-source 1.3
-target 1.2
V6.0 or later
1.3-source 1.3
-target 1.3
V6.0 or later
1.4-source 1.4
-target 1.4
V7.0 or later
1.5-source 1.5
-target 1.5
V8.0 or later
1.6-source 1.6
-target 1.6
V8.5 or later
CurrentJavaVersion-source 1.6
-target 1.6
V8.5 or later

Remember that these settings may prevent compiled agents from running on some earlier Notes/Domino installations. Therefore, it is suggested that organizations use a consistent setting across machines.

Developers who will not be using language features specific to recent JDKs are encouraged to keep the default Notes/Domino behavior to maximize backward compatibility.



Avatar: Axel

Re: Doing Java in Notes? - make sure you know about JavaCompilerTarget

it would be great, if one could choose JVM compiler versions based on a design-note by design note basis -> design note like Agent or Java Script Library  (has nothing to do with javaScript). 
Avatar: John Foldager

Re: Doing Java in Notes? - make sure you know about JavaCompilerTarget

Great post Mikkel! I didn't know this!

Maybe even make it possible to create multiple Java Script Libraries with the same name but with Java code compiled for different JVM versions.

Re: Doing Java in Notes? - make sure you know about JavaCompilerTarget

Mikkel, thank you.  I too am a member of the design partner team, but did not have an opportunity to make that call.  Your post is greatly appreciated.  It will save us hours of trouble shooting time!
Avatar: Lefi Lagebrand

Re: Doing Java in Notes? - make sure you know about JavaCompilerTarget

1. What does this parameter JavaCompilerTarget=1.6 do on the server?

2. What does JavaCompilerTarget=1.6 do in the client? I DD (Eclipse) you can set the Compiler Target per project/agent. Is this some sort of default in the client?

Avatar: Leif Lagebrand

Re: Doing Java in Notes? - make sure you know about JavaCompilerTarget


Add a comment Send a TrackBack