My problem is : I execute an exe file from java using the runtime.getRuntime() , But my problem is that the exe is running in the background , and I want when I run my program it opens that exe so I can see what's happening anyone got any ideas? thanks in advance
I cant understand your question. Can you be little more specific? or PM me !! You can run .exe files using this piece of code Runtime rt = Runtime.getRuntime(); try { rt.exec(Path:\\TheFile.exe); } catch (IOException e) { e.printStackTrace(); } HTML:
You can't actually see the program running but you can capture any System.out's that it may have. Runtime systemShell = Runtime.getRuntime(); Process output = systemShell.exec("<PATH TO EXE>"); // open reader to get output from process BufferedReader br = new BufferedReader (new InputStreamReader(output.getInputStream())); String line = null; while((line = br.readLine()) != null ) { [INDENT]if(line.length()!=0)[/INDENT] [INDENT][INDENT]System.out.println(line); // display process output [/INDENT][/INDENT] } int exitVal = output.waitFor(); // get process exit value if(exitVal==0) [INDENT]System.out.println("GOOD STATUS");[/INDENT] else [INDENT]System.out.println("BAD STATUS");[/INDENT] Code (markup):