This one costs me some headaches. To prevent others from suffering here are the details.
Let's start with an explanation of the option -jar calling java.exe. If in a project there are several classes needed, those classes could be packaged together with the ZIP file format. Normally the resulting file gets the extension JAR. To let the Java interpreter know which class to execute this JAR file contains a text file called Manifest with the main class specified. So with
java.exe -jar MyProject.jar
Java searches for the Manifest to execute the specified main class.
In Notes version prior to Notes 8 every time I couldn't realize a customer request with the built-in design elements I use Java. Normally I package the classes in a JAR file and put in the directory [Notes program path]\jvm\lib\ext. (In our framework we have a mechanism for deploying it to the users machine on opening a Notes database.) If the JAR file is in this directory I don't have to worry about the class path because this directory is automatically added to the class path.
At a customer site the user could not write to the directory [Notes program path]\jvm\lib\ext. So we had to store the JAR file in another directory. To start the Java application as a stand alone application instead of as an agent we called [Notes program path]\jvm\bin\java.exe directly. Which led to the nice error message
Exception in thread "main"
So the Java interpreter could not found a class from another JAR file within the same directory.
Our first guess was that we missed to specify the class path. So we changed the call to
java.exe -jar -classpath ".;c:\temp\MyProject.jar;
But that didn't worked neither. I tried some different sequences of the options but nothing worked.
After some search in Google I found the problem in the Java documentation.
When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.
The solution was quite simple. Just
add the line
to the Manifest to specify the class
path. The details for the writing a Manifest file could be found in a Sun Tutorial.