public static void main(String[] args) throws InterunpedException{
Thread t=Thread.currentThread();
System.out.println("1");
t.sleep(1000); System.out.println("2");
t.sleep(1000); System.out.println("3");
}一运行就会跳出对话框,说 javaw.exe遇到问题需要关闭,不知道哪里有问题,大家帮帮忙啊
Thread t=Thread.currentThread();
System.out.println("1");
t.sleep(1000); System.out.println("2");
t.sleep(1000); System.out.println("3");
}一运行就会跳出对话框,说 javaw.exe遇到问题需要关闭,不知道哪里有问题,大家帮帮忙啊
import java.io.InterruptedIOException;public class TestThread { public static void main(String[] args) throws InterruptedIOException, Exception{
Thread t=Thread.currentThread();
while(true){
System.out.println("1");
t.sleep(1000); System.out.println("2");
t.sleep(1000); System.out.println("3");
}
}
}
public class TestAmzi {
public void test() throws InterruptedException{
Thread t=Thread.currentThread();
Thread pc=new Thread(new PrologCompiler());
pc.start();
System.out.println(1);
t.sleep(1000);
System.out.println(2);
Thread pl=new Thread(new PrologLinker());
pl.start();
t.sleep(1000); LogicServer ls=null;
try {
ls=new LogicServer();
ls.Init("");
ls.Load("test");
long res=ls.CallStr("ura(user(lisi),role(g))");
System.out.println(res);
} catch(LSException e){
e.printStackTrace();
}finally{
if(ls!=null){
try{
ls.Close();
}catch(LSException e){
e.printStackTrace();
}
}
}
}
public static void main(String[] args) throws InterruptedException{
TestAmzi ta=new TestAmzi();
ta.test();
}
}PrologCompiler和PrologCompiler都是继承自Thread,只是运行了一个命令行程序而已。
public class PrologCompiler extends Thread { public void run(){
try {
Runtime.getRuntime().exec("acmp test");
} catch (IOException e) {
e.printStackTrace();
}
}
}上面程序打印1和2后就会跳出对话框,说 javaw.exe遇到问题需要关闭,不知道哪里有问题,大家帮帮忙啊
public class TestAmzi {
public void test() throws InterruptedException,IOException{
Thread t=Thread.currentThread();
System.out.println(1);
Runtime.getRuntime().exec("acmp test");
System.out.println(2);
t.sleep(1000);
System.out.println(3);
Runtime.getRuntime().exec("alnk test test");
System.out.println(4);
t.sleep(1000); System.out.println(5);
LogicServer ls=null;
try {
ls=new LogicServer();
ls.Init("");
ls.Load("test");
long res=ls.CallStr("ura(user(lisi),role(g))");
System.out.println(res);
} catch(LSException e){
e.printStackTrace();
}finally{
if(ls!=null){
try{
ls.Close();
}catch(LSException e){
e.printStackTrace();
}
}
}
}
public static void main(String[] args) throws InterruptedException,IOException{
TestAmzi ta=new TestAmzi();
ta.test();
}
}