Hi, Just I have reminded the things when I was as Trainee.
I have tested the javaObject. But now I got an issue with script Library - java.
Each time when I change the Script Library I need to delete the cache.
Step 1: Create Script Library as Name as "Java"
Use the code as follow,
public class Test {
public int x;
public int add(int a, int b)
{
return a+b+x+100;
}
public Test(int c)
{
x=c;
}
}
Step 3: Create a new form and put one button there,
In Button option -> put Uselsx "*javacon" and use "Test"
Step 4: Use the code as follow in that button.,
On Error Goto e
Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myObject As JavaObject
Set mySession = New JavaSession()
' Get Java "java.lang.Integer" class
Set myClass = mySession.GetClass("Test")
' Create a "java.lang.Integer" object
Set myObject = myClass.CreateObject("(I)V",20)
Msgbox myObject.add(1,2)
Exit Sub
e:
Print "Error : " &Error &Erl()
Exit Sub
If you change the Script Library, You will get the problem as I mentioned in above.
I have tested the javaObject. But now I got an issue with script Library - java.
Each time when I change the Script Library I need to delete the cache.
Step 1: Create Script Library as Name as "Java"
Use the code as follow,
public class Test {
public int x;
public int add(int a, int b)
{
return a+b+x+100;
}
public Test(int c)
{
x=c;
}
}
Step 3: Create a new form and put one button there,
In Button option -> put Uselsx "*javacon" and use "Test"
Step 4: Use the code as follow in that button.,
On Error Goto e
Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myObject As JavaObject
Set mySession = New JavaSession()
' Get Java "java.lang.Integer" class
Set myClass = mySession.GetClass("Test")
' Create a "java.lang.Integer" object
Set myObject = myClass.CreateObject("(I)V",20)
Msgbox myObject.add(1,2)
Exit Sub
e:
Print "Error : " &Error &Erl()
Exit Sub
If you change the Script Library, You will get the problem as I mentioned in above.
Sorry I missed the Step2
ReplyDelete