Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to launch and work within an external software using java

Status
Not open for further replies.

qwertyuiop415263

Full Member level 4
Joined
Mar 26, 2010
Messages
231
Helped
50
Reputation
102
Reaction score
39
Trophy points
1,308
Location
Pakistan
Activity points
2,414
hello. I am new to java and using eclipse IDE. i have a software known as QEMU which work only on command line i.e no gui and we have to work in this software from command line e.g i write this line "qemu-system-arm.exe -M realview-eb -kernel D:\test.out -serial file:test.out" on command line its works fine. now i have to lanch this command using java. here is my code import java.util.*; import java.io.*; public class Command{ public static void main(String args[]) { try { String fileName = "C:\\Documents and Settings\\Ali\\Desktop\\qemu-0.13.0-arm-win32\\qemu-system-arm.exe"; String[] commands = {"cmd.exe","/c","start","-M -realview-eb-kernal",fileName}; Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(fileName); BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream())); String line=null; while((line=input.readLine()) != null) { System.out.println(line); } int exitVal = pr.waitFor(); System.out.println("Exited with error code "+exitVal); } catch(Exception e) { System.out.println(e.toString()); e.printStackTrace(); } } } but it didn't work
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top