How to call to javac from a class?

Hi folks

I need to compile a file .java from a program java written by my in java.

the first form that uses went calling to a process this way:

String cmd =new String[]{"javac","\\temJava\\*.java"};

p = Runtime.getRuntime().exec(cmd);

this works well but single for windows, and I need to work in linux too, or in another OS.

I somehow need to call to javac or to use some functionality of java that allows me to compile a class .java to .class.

can you help me? thanks for your time :P

In spanish

hola, tengo que escribir un programa en java que me permita compilar un .java a .class, lo primero que hice fue llamar un proceso, como aparece en el codigo de arriba, pero solo funcionaria en windows, y necesito que funcione por ejemplo en linux, podrian ayudarme?

[961 byte] By [DaleGroa] at [2007-11-27 6:56:40]
# 1
Check out http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html This is the standard reference on Runtime.exec() and discusses running the javac executable at length.(With 1.6 the javax.tools package became available - but that's another story.)
pbrockway2a at 2007-7-12 18:33:41 > top of Java-index,Java Essentials,Java Programming...
# 2
thanksss!!!!!!!
DaleGroa at 2007-7-12 18:33:41 > top of Java-index,Java Essentials,Java Programming...
# 3
You're welcome.
pbrockway2a at 2007-7-12 18:33:41 > top of Java-index,Java Essentials,Java Programming...
# 4
In Java 6 there is a Compiler class to do this programmatically: http://java.sun.com/javase/6/docs/api/javax/tools/JavaCompiler.html http://java.sun.com/javase/6/docs/api/javax/tools/package-summary.html
TuringPesta at 2007-7-12 18:33:41 > top of Java-index,Java Essentials,Java Programming...