• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java program invoking javac ??  RSS feed

 
Rich Sargent
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all.
I'm wanting to try my hand at writing a simple IDE. The ones I have looked at so far ( JCreator, Eclipse, Forte, etc) all seem to have the ability to invoke javac to compile code and then run compiled classes as well. I'd obviously like to include this in my IDE, but how would I go about approaching this? Is there a way of invoking javac on the text file in which the code is stored by the IDE?
Any ideas or hints greatly appreciated.

Rich
 
Charlie Goth
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime.getRuntime().exec("javac file.java");

java.lang.Runtime
 
Rich Sargent
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much... just what I was wanting.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There used to be some undocumented methods in a sun.tools package or something like that. I find it hard to believe Eclipse is using runtime exec. Is it?
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you import 'tools.jar', you find a compiler inside
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!