Hello !
First, excuse my poor english... :C
I try to use my Java Class in Domino Lotuscript.
I do that : in my Global Form
Option Public
Uselsx "*javacon"
Use "libEssai"
and in my button on Clic :
Sub Click(Source As Button)
Dim mySession As JAVASESSION
Dim utilDate As JAVACLASS
Dim objUtilDate As JAVAOBJECT
Dim toto As String
Set mySession = New JAVASESSION
Set utilDate = mySession.GetClass("test/UtilDate")
Set objUtilDate = utilDate.CreateObject
toto = objUtilDate.essaiMethode
Messagebox (toto + "*******************************************************")
End Sub
I try to put this class in library java (Code /library/libEssai) and in a java package (Code/Java/ package test/UtilDAte.java)
i try the two way with the same result
it's a "hello word" class java to test.
package test;
public class UtilDate {
public String essaiMethode() {
String texte = null;
texte = "Bonjour";
return texte;
}
}
And the error i have is :
"Instance member ESSAIMETHODE does not exist"
I don't understand, could you help me ? Thanks for your help ! ;D
i found !!
Sub Click(Source As Button)
Dim mySession As JAVASESSION
Dim utilDate As JAVACLASS
Dim objUtilDate As JAVAOBJECT
Dim toto As String
Dim toto2 As String
Dim myMCollection As JavaMethodCollection
Dim myMethod As JavaMethod
Dim methodJava As JavaMethod
toto2 = "test"
Set mySession = New JAVASESSION
Set utilDate = mySession.GetClass("test/UtilEssai")
Set objUtilDate = utilDate.CreateObject
Messagebox (toto2)
Set myMCollection = utilDate.getClassMethods()
Set myMethod = myMCollection.getFirst()
Do
If myMCollection.count <> 0 Then
toto2 = myMethod.MethodName & " " & myMethod.signature
Messagebox (toto2)
If myMethod.MethodName = "essaiMethode" Then
Set methodJava = utilDate.GetMethod("essaiMethode","()Ljava/lang/String;")
toto = methodJava.Invoke(objUtilDate)
Messagebox (toto)
End If
End If
Set myMethod = myMCollection.getNext()
Loop While myMCollection.current <> 1
End Sub
i found , thanks a lot !
Sub Click(Source As Button)
Dim mySession As JAVASESSION
Dim utilDate As JAVACLASS
Dim objUtilDate As JAVAOBJECT
Dim toto As String
Dim toto2 As String
Dim myMCollection As JavaMethodCollection
Dim myMethod As JavaMethod
Dim methodJava As JavaMethod
toto2 = "test"
Set mySession = New JAVASESSION
Set utilDate = mySession.GetClass("test/UtilEssai")
Set objUtilDate = utilDate.CreateObject
Messagebox (toto2)
Set myMCollection = utilDate.getClassMethods()
Set myMethod = myMCollection.getFirst()
Do
If myMCollection.count <> 0 Then
toto2 = myMethod.MethodName & " " & myMethod.signature
Messagebox (toto2)
If myMethod.MethodName = "essaiMethode" Then
Set methodJava = utilDate.GetMethod("essaiMethode","()Ljava/lang/String;")
toto = methodJava.Invoke(objUtilDate)
Messagebox (toto)
End If
End If
Set myMethod = myMCollection.getNext()
Loop While myMCollection.current <> 1
End Sub