ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
328
328
EMPFEHLEN
-
12.12.08 22:23 #1
- Registriert seit
- Dec 2008
- Beiträge
- 17
Hi,
ich möchte nach Betätigung eines Buttons (Bild oben) eine Konsole öffnen und einen Server und mehrere Clients starten.
Leider starten die Clients erst, wenn ich meine SWT Anwendung komplett schliesse.
Im mittleren Bild sieht man den Server bei dem 2 Clients angemeldet sind, aber rechts neben den Clients sollte nicht Processing Map, sondern Ready to Play stehen (wie im Bild 3 zu sehen).
Muss ich irgendeinen Outputstream flushen oder wie?
BRAUCHE DRINGEND HILFE.
Hier der Link zu den Bildern:
http://www.250kb.de/u/081212/j/4f2b114f.jpg
Hier mein Code wie ich den Server und die Clients aufrufe + SWT-Applikation:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
package snippets; import java.io.*; import org.eclipse.jface.*; import org.eclipse.swt.*; public class WidgetWindow extends ApplicationWindow { private String[] serverCommand = {"cmd.exe", "/C", "AiServer.exe -start -var=STANDARD -lvl=20 -port=16713"}; private String[] clientCommand = {"cmd.exe", "/C", "java -jar NICE.jar localhost 16713 Client"}; public WidgetWindow(Shell shell) { super(shell); } protected Control createContents(Composite parent) { getShell().setText("Widget Window"); parent.setSize(400, 250); FormLayout fl = new FormLayout(); parent.setLayout(fl); Button bt = new Button(parent, SWT.PUSH); bt.setText("Starte Server und Clients"); FormData fd = new FormData(); fd.bottom = new FormAttachment(100, -5); fd.right = new FormAttachment(100, -5); bt.setLayoutData(fd); bt.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { Runtime.getRuntime().exec(serverCommand, null, new File("C:\\Dokumente und Einstellungen\\Administrator\\Desktop\\Diplomacy\\Server\\aiserver\\")); Runtime.getRuntime().exec(clientCommand, null, new File("C:\\Dokumente und Einstellungen\\Administrator\\Desktop\\")); Runtime.getRuntime().exec(clientCommand, null, new File("C:\\Dokumente und Einstellungen\\Administrator\\Desktop\\")); } catch (IOException e) { e.printStackTrace(); } } }); } }); return parent; } public static void main(String[] args) { WidgetWindow wwin = new WidgetWindow(null); wwin.setBlockOnOpen(true); wwin.open(); Display.getCurrent().dispose(); } }
Ähnliche Themen
-
Runtime.getRuntime().exec
Von zoulgami im Forum JavaAntworten: 10Letzter Beitrag: 08.06.09, 15:05 -
Runtime.getRuntime().exec prüfen
Von MikaM im Forum Java GrundlagenAntworten: 0Letzter Beitrag: 23.02.09, 23:31 -
Runtime.getRuntime.Exec() und SWT
Von schwarzenegger im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 0Letzter Beitrag: 11.12.08, 23:08 -
Runtime.getRuntime().exec( email )
Von MikaM im Forum Java GrundlagenAntworten: 7Letzter Beitrag: 24.11.08, 07:50 -
Runtime.getRuntime().exec()
Von RolandOfGilead im Forum JavaAntworten: 0Letzter Beitrag: 30.06.06, 21:07





Zitieren
Login





