您好!
首先,请原谅我可怜的英语......:C
我尝试在Domino Lotuscript中使用我的Java类。
我这样做:在我的全球表格中
Option Public
Uselsx "*javacon"
Use "libEssai"
和我在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
我尝试将此类放在库java(Code / library / libEssai)和java包中(Code / Java / package test / UtilDAte.java)
我尝试使用相同结果的双向方式
它是一个"你好的词"要测试的java类。
package test;
public class UtilDate {
public String essaiMethode() {
String texte = null;
texte = "Bonjour";
return texte;
}
}
我遇到的错误是:
"Instance member ESSAIMETHODE does not exist"
我不明白,你能帮助我吗? 谢谢你的帮助 ! ; d
我找到了!!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
答案 0 :(得分:0)
我发现了,非常感谢!
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