java - How to read console output from Grails -


this question has answer here:

my grails app has external java library developed. want grails app able display java library system.out statements (console output). how go doing that?

i rather not have write out file read in grails. there must better way of doing this.

**i want grails display these text box happen(in browser while running(so user can see))


afer trying several of own ways have settle way post here. @shaunak , understanding.

**how solved it.

in java library created global class system.outs wrote to

writesouts(string sout){          //store here in global string , keep appending needs           } 

then in grails call java library method. , using ajax write out browser window.

hope helps in future encounters same problem.

also not testing integral part of web app user of web app can java library doing in background.

without details on how invoking java library, assume here code writes console, , want invoke , read inside grails controller , send html. here's suggest. instead of including java code library, create command line utility out of it.

so java program invoked testing so,

java mylib -arg1 -arg2 

this should out put on command line:

> nice output 

now to invoke , read grails, can use groovy's external process management , invoke , read output:

def process = "java mylib -arg1 -arg2".execute() def response = "found text ${process.text}" 

your response var should have value

found text nice output  

you can use ever in grails controller, send html..


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -