Compiler will crash with -d if the argument is not a directory.
<code>
public class Foo {
}
</code>
<output>
E:\javatrails>javac Foo.java -d Foo.java
An exception has occurred in the compiler (1.6.0-auto). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) af
ter checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.IllegalArgumentException: not a directory
at com.sun.tools.javac.util.DefaultFileManager.getDirectory(DefaultFileManager.java:926)
at com.sun.tools.javac.util.DefaultFileManager.setLocation(DefaultFileManager.java:903)
at com.sun.tools.javac.util.DefaultFileManager.getClassOutDir(DefaultFileManager.java:941)
at com.sun.tools.javac.util.DefaultFileManager.getFileForOutput(DefaultFileManager.java:869)
at com.sun.tools.javac.util.DefaultFileManager.getJavaFileForOutput(DefaultFileManager.java:842)
at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1394)
at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:549)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1153)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:667)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:637)
at com.sun.tools.javac.main.Main.compile(Main.java:333)
at com.sun.tools.javac.main.Main.compile(Main.java:255)
at com.sun.tools.javac.main.Main.compile(Main.java:246)
at com.sun.tools.javac.Main.compile(Main.java:70)
at com.sun.tools.javac.Main.main(Main.java:55)
</output>
<java-version>
E:\javatrails>java -version
java version "1.6.0-auto"
Java(TM) SE Runtime Environment (build 1.6.0-auto-087)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b78, mixed mode)
</java-version>
The same with tiger :
<output-tiger>
/home/sa151881/javatrails/Foo.java:1: error while writing Foo: /home/sa151881/javatrails/Foo.java/Foo.class (Not a directory)
public class Foo {
^
</output-tiger>
<tiger-version>
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode)
</tiger-version>
Same the case with -sourcepath also.
<output>
E:\MustangTestDev\tools\jsr199\ToolTest\ToolTest02>javac -sourcepath Test.java ToolTest02.java
An exception has occurred in the compiler (1.6.0-auto). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) af
ter checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.util.DefaultFileManager.listAll(DefaultFileManager.java:293)
at com.sun.tools.javac.util.DefaultFileManager.list(DefaultFileManager.java:700)
at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:1954)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1703)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:380)
at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:259)
at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:445)
at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:223)
at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:237)
at com.sun.tools.javac.comp.Enter.complete(Enter.java:431)
at com.sun.tools.javac.comp.Enter.main(Enter.java:416)
at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:727)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:634)
at com.sun.tools.javac.main.Main.compile(Main.java:333)
at com.sun.tools.javac.main.Main.compile(Main.java:255)
at com.sun.tools.javac.main.Main.compile(Main.java:246)
at com.sun.tools.javac.Main.compile(Main.java:70)
at com.sun.tools.javac.Main.main(Main.java:55)
</output>