我编写了这段代码,它给出了以下 3 个错误!我需要帮助来解决附加图像中存在的这些错误。出现的 3 个错误不会消失,因为我没有太多关于如何包含系统命令的信息。
import java.applet.*;
import java.awt.event.*;
import java.awt.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class EventListeners extends Applet
implements ActionListener{
public void init(){
Button b = new Button("Ping");
b.addActionListener(this);
add(b);
}
public void actionPerformed(ActionEvent e){
runSystemCommand(String command)
{try {
Process p = Runtime.getRuntime().exec(command);
BufferedReader inputStream = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String s = "";
// reading output stream of the command
while ((s = inputStream.readLine()) != null) {
System.out.println(s);
}}
catch (Exception e) {
e.printStackTrace();
}}
public static void main(String[] args) {
String ip = "google.com";
runSystemCommand("ping " + ip);
}
}
![Errors][1]