Re: JavaCompiler can output in a different folder?
"Jean-S?Wbastien Goupil" <jsgoupil@gmail.com> wrote
I'm currently using Java6 and I'm compiling my class with the
JavaCompiler.
When I compile my class with a specific file, the output .class is
copied just aside the java file.
When I compile my class without specifiying a folder (with the
following code)
which you really, really should lay out for readability on Usenet.
boolean compilation = _compiler.getTask(
null, _fileManager, _diagnostic,
options, null, compilationUnits ).call();
According to
<http://java.sun.com/javase/6/docs/api/javax/tools/JavaCompiler.html#getTask(java.io.Writer,%20javax.tools.JavaFileManager,%20javax.tools.DiagnosticListener,%20java.lang.Iterable,%20java.lang.Iterable,%20java.lang.Iterable)>
it looks like your "options" are the key.
...
The output .class is copied in the folder where the program is
started.
I would like to output this class in a specific folder... is it
possible? I know that Eclipse has the property "Output Folder". I
don't know if I should simply move the file ? Is there any option i
can set in the compiler to output the .class file somewhere?
Richard Reynolds wrote:
yes, did you consider googling this? the very first hit for "javac options"
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html
He might've done, except that he's using Java 6, not the obsolescent Java 1.4.
That said, given the information in the JavaCompiler Javadocs, it looks like
the standard compiler options at
<http://java.sun.com/javase/6/docs/technotes/tools/solaris/javac.html>
<http://java.sun.com/javase/6/docs/technotes/tools/solaris/javac.html#options>
apply, specifically "-d directory".
--
Lew