Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Class to run a java compiler and execute a java program

Status
Not open for further replies.

JoshPringle

Programmer
Sep 2, 2002
2
GB
I woulld like to add a class compiler and a java execution to my text editor I have made with java. could anybode point me in the right direction!!!
 
Hi Josh!

I shall assume that you plan to have a button in your editor that says "compile" or somthin like that.. ok? =)

you might wish to check out these few things:

1. the compile syntax (and how to dynamically change it, eg. modifying the jdk path, classpath, sourcepath and output path, etc)

2. how to launch the compile command that you have prepared in step 1.
- you can use this:
Process p = Runtime.getRuntime().exec(..your compile string..);

3. how to display the compilation results
- you might wish to add another JTextArea for this

hope this gives you some leads,
shahid
 
hi

the option

Runtime.getRuntime().exec(..your compile string..);

should b fine.. also check out Compiler class in java.lang.

Ive not tried but i think it'll compile the classes u give.

luv
Karthik.

LOL A ship is safe in the harbour, but that's not what it is meant for!!! LOL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top