hey ihr,
hab mal wieder das problem das ich en cmd befehl in java einbinden muss odr soll
habs so versucht wie ich es auch mit shutdoen oder net send machen würde nur mit tracert funktioniert der spaß nich ...
hier mien quelltext:
schonmal danke im vorraus
lg tameck
hab mal wieder das problem das ich en cmd befehl in java einbinden muss odr soll
habs so versucht wie ich es auch mit shutdoen oder net send machen würde nur mit tracert funktioniert der spaß nich ...
hier mien quelltext:
Code:
package konsole;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import javax.swing.*;
public class Konsole extends JFrame implements ActionListener {
String ipaddresse;
private JPanel gesamt = new JPanel();
private JPanel oben = new JPanel();
private JPanel unten = new JPanel();
private JTextField ipeingabe = new JTextField(10);
private JButton suche = new JButton("Suche");
private JTextArea konsole = new JTextArea(20,20);
public Konsole(String title){
super (title);
Container c = getContentPane();
gesamt.setLayout(new GridLayout(2,1));
gesamt.add(oben);
gesamt.add(unten);
oben.add(ipeingabe);
oben.add(suche);
unten.add(konsole);
c.add(gesamt);
suche.addActionListener(this);
addWindowListener (new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
setSize(500,250);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()== suche){
System.out.println("Suche");
try{
ipaddresse = ipeingabe.getText();
String cmdBefehl = "tracert "+ipaddresse;
Runtime.getRuntime().exec(""+cmdBefehl);
System.out.println(ipaddresse);
}catch (IOException e1){
e1.printStackTrace();
}
}
}
public static void main(String args[]){
new Konsole("Konsole");
}
}
schonmal danke im vorraus
lg tameck