近期做一个测试的时候,在Domino 8中使用JDK 1.5中的方法时候系统报错"Cannot find symbol",但是始终没有查到代码的错误原因,因为在Eclipse中使用JDK1.5编译正常,后来才知道原来Domino 8虽然系统的JDK是1.5,但是为了兼容以前的版本,缺省仍然是用的是JDK1.3,需要增加notes.ini参数JavaCompilerTarget=1.6才能正常编译。
Agent with Java 6 syntax does not compile in Domino 8.5
Product:
Lotus Domino > Lotus Domino Designer > Version 8.5
Platform(s):
Windows
Doc Number:
1320401
Date:
10-11-2008
Problem
You create an agent using the Java™ 6 syntax in the Lotus® Domino Designer® 8.5 client. (Java 6 is supported in Lotus Notes®/Domino 8.5). However, you are unable to compile the agent and receive one of the following error messages:
"xxxxx are not supported in -source 1.3"
Or
"Cannot find symbol"
Cause
Notes/Domino 8.5 Java compiler flags are set to "-source 1.3 -target 1.2" by default for backward compatibility.
Content
To activate Java 6 compiling, add the following parameter to your notes.ini file:
JavaCompilerTarget=1.6
You can set this variable to any value between 1.1 - 1.6, and then restart the client or server for this change to take effect.
Supporting information
Developers must override the default behavior if they want to use features specific to different Java Development Kits (JDKs). The default behavior is equivalent to a JavaCompilerTarget=1.2 setting.
In Notes/Domino 8.5, the developer can specify any JavaCompilerTarget from 1.1 - 1.6. In each case, the "-source" flag is the latest source that can be specified with a particular "-target" flag.
The developer can also specify the following parameter: JavaCompilerTarget=CurrentJavaVersion. In this case, the target flag would be synched to the Java version included in future Notes/Domino releases. For example, if a future Notes/Domino version were to include JDK 1.9, then values from 1.1 - 1.9 would be supported and the parameter, JavaCompilerTarget=CurrentJavaVersion, would create "-target 1.9".
If the developer uses a value not shown below, then the Java Debug console displays the usage guideline, "Warning: Invalid use of notes.ini variable JavaCompilerTarget ..." and substitutes the default value, JavaCompilerTarget=1.2.
If JavaCompilerTarget=
The resulting compiler flags are...
...And the agent would run on
Notes/Domino releases...
1.1
-source 1.3 -target 1.1
N/D 5.0 or later
1.2
-source 1.3 -target 1.2
N/D 6.0 or later
1.3
-source 1.3 -target 1.3
N/D 6.0 or later
1.4
-source 1.4 -target 1.4
N/D 7.0 or later
1.5
-source 1.5 -target 1.5
N/D 8.0 or later
1.6
-source 1.6 -target 1.6
N/D 8.5 or later
CurrentJavaVersion
-source 1.6 -target 1.6
N/D 8.5 or later
These settings might prevent compiled agents from running on some earlier Notes/Domino installations (and with any Java Virtual Machine [JVM] version earlier than the target flag), regardless of whether the new language features are actually used in the agent's code.
For example, setting the 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 notes.ini file setting. Therefore, it is suggested that organizations use a consistent setting across machines.
Developers who will not be using language features specific to later JDKs are encouraged to keep the default Notes/Domino behavior to maximize backward compatibility.
阅读(2573) | 评论(1) | 转发(0) |