- 论坛徽章:
- 0
|
perl中如何执行java程序 现在有一个java源程序:
mport java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
public class Simple {
public static void main(String[] args){
String str = "Hello World!";
Date nowTime = new Date();
DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM);
String nowTimeStr = fmt.format(nowTime);
try {
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("IODemo.log",true)));
pw.println("Now the time is : "+nowTimeStr +" " + str);
pw.flush();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
如何在perl脚本中执行这段程序,并得到想要的结果 |
|