当前位置: 技术问答>java相关
如何在JAVA中调用VB程序
来源: 互联网 发布时间:2015-01-03
本文导语: | 调用应用程序如下: import java.awt.*; import java.awt.event.*; public class exec extends Frame { Button t =new Button("run program"); public exec() { setLayout(new GridLayout(5,2)); add(t); ...
|
调用应用程序如下:
import java.awt.*;
import java.awt.event.*;
public class exec extends Frame
{
Button t =new Button("run program");
public exec()
{
setLayout(new GridLayout(5,2));
add(t);
t.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try{
Runtime.getRuntime().exec("d:\Xdict\xdict.exe");
}
catch(Exception ee) {}
}
});
public boolean handleEvent(Event evt){
switch(evt.id) {
case Event.WINDOW_DESTROY:
System.exit(0);
default:
return false;
}
}
}
public static void main(String args[])
{
exec t=new exec();
t.setSize(200,200);
t.setVisible(true);
}
}
如果要调用方法的话就要用到jni技术,去查资料吧
import java.awt.*;
import java.awt.event.*;
public class exec extends Frame
{
Button t =new Button("run program");
public exec()
{
setLayout(new GridLayout(5,2));
add(t);
t.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try{
Runtime.getRuntime().exec("d:\Xdict\xdict.exe");
}
catch(Exception ee) {}
}
});
public boolean handleEvent(Event evt){
switch(evt.id) {
case Event.WINDOW_DESTROY:
System.exit(0);
default:
return false;
}
}
}
public static void main(String args[])
{
exec t=new exec();
t.setSize(200,200);
t.setVisible(true);
}
}
如果要调用方法的话就要用到jni技术,去查资料吧