1

Hi I have the following directory structure...

enter image description here

I enter this at terminal: javac -d bin src/com/elharo/math/Fraction.java

and the Fraction.class file gets placed in bin/com/elharo/math instead of bin/

screenshot

I just wondered why the compiler placed the file there. Is it that the point of having source and bin, so that when you compile a source file it goes in the parallel/mirror bin directory?

jimbo123
  • 289
  • 3
  • 7
  • 13

2 Answers2

0

The output path will be computed from package and class name of the public class that must be defined in the java source file (which must, incidentally, match the file name minus ".java"). And it will be relative to the directory in the -d option, or relative to the current directory.

Ingo
  • 36,037
  • 5
  • 53
  • 100
0

This is as expected. /com/elharo/math is the package the class exists in. If you took the class out of this directory an just put it in bin you would like get a noclassdeferror.

David
  • 19,577
  • 28
  • 108
  • 128