suppose there is a file test.java .
Aim is to compile this file and if compile is successful(no errors ) then run this file i.e java test.
problem is i need to do all this i.e compilation and run of 'test' from a java program only.
this java program must able to compile any file and then run that file.:confused:

May 18th, 2010, 09:02 PM

copeg

Re: compiling a file

Not sure if I understand what you are asking so I'll post a link to the intro tutorial (Trail: Getting Started (The Java™ Tutorials)), and if you want to do what I think lead you towards calling Runtime.getRuntime().exec(); to compile and run from your app (will be platform dependent though)

May 18th, 2010, 11:03 PM

jkoracle23

Re: compiling a file

To clear the thing..
suppose there is a java program "runother".
now when you run this program this would ask for input filename.
and suppose the user input filename is "test".
now the "runother" should able to compile the "test" and then run the "test" if there is no error in compilation stage.:o