java - How to get output from runnable jar on PHP -



java - How to get output from runnable jar on PHP -

i'm pupil learning computer engineering.

today, ran runnable jar file command line.

the runnable jar file contains 5 line code following.

public class main { public static void main(string[] args) { system.out.println("hello world!"); } }

and see "hello world" command line.

but when ran same runnable jar file php got empty output.

this code php

<?php echo shell_exec("java -jar /users/test/desktop/test.jar"); ?>

how can output after running jar file on php ?

thanks in advance reply , sorry poor english. if don't understand question please create comment.

you redirect output of jar textfile in post:

how can pipe java console output file without java web start?

so e.g.

java -jar /users/test/desktop/test.jar >file.txt 2>&1

then can utilize busy waiting, see whether file created or not, calling :

while (! file_exists ( "/users/test/desktop/file.txt" ) ){ //do nil } //now can access output of file

this should work utilize case, still should reconsider application design, because in productive environment not scale.

cheers

java php web-services

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -