Link


USAGE OF JAVA COMPONENT IN VISUAL BASIC APPLICATION

In Java,
******
• Microsoft Visual J++-> Microsoft Visual J++->Components->ComDLL.Specify project name and location.Click ok
• Click the project icon in the project explorer window and rename the class to bean.java(say) also change the name of the class in the class file. Type the following code
Project: javacom
***************
ClassName: bean.java
*******************
public class bean
{
public String getIA() throws Exception
{
String str;
java.net.InetAddress a=java.net.InetAddress.getLocalHost();
str=a.getHostAddress();
return str;
}
public String getName() throws Exception
{
java.net.InetAddress a=java.net.InetAddress.getLocalHost();
return (a.getHostName());
}
public String getDate()
{
String s;
java.util.Date d=new java.util.Date();
s=d.toString();
return s;
}
}
• Save the project.Build->Build.Tools->Publish component->ProjectFiles->next->local database->next->visual J++->next->projects->next->Type (Java Source)->next->finish.
• Close the application

In Visual Basic,
*************
Vb->std exe->ok
Place 3 cmd buttons and type the follwing for each of the buttons respectively
Option Explicit
Dim a As New javacom.bean

Private Sub Command1_Click()
MsgBox a.getIA
End Sub

Private Sub Command2_Click()
MsgBox a.getDate
End Sub

Private Sub Command3_Click()
MsgBox a.getName
End Sub

FORM DESIGN:

Comments