How to create a java progam to compile and run a list of java programs -
instead of using .bat file, how code can built java program compiling , executing list of java programs.
on runtime.exec
though perhaps not ideal solution, execute shell command separate process
using runtime.getruntime().exec(somecommand)
. there overloads takes parameters string[]
.
this not easy solution. managing concurrent process
, preventing deadlock etc not trivial.
related questions
- is java runtime.exec(string[]) platform independent?
- what purpose of process class in java?
- how can compile , deploy java class @ runtime?
- compiling class using java code using process
- java: executing java application in separate process
- running program within java code..
on draining process
streams
generally can't waitfor()
process
terminate; must drain i/o streams prevent deadlock.
from the api:
because native platforms provide limited buffer size standard input , output streams, failure promptly write input stream or read output stream of subprocess may cause subprocess block, , deadlock.
related questions
on java 6 compiler api
one option compiling java source code within java use java 6 compiler api. requires jdk installed (not jre).
Comments
Post a Comment