Sunspawn
Sunspawn

Reputation: 837

javac creates an unexpected directory for compiled classes

The case is like this - I have a folder, say ass1, in which I have the src folder with the .java files and an empty bin folder. I then use the following command:

javac -cp src -d bin src/*

to compile all (there are 3) of the .java files. The files are compiled and work...

but, instead of placing them in the bin folder, the compiler creates an unnecessary ass1 folder in the bin folder and puts the .class files there.

Why? What could be causing this and how do I resolve it?

Lutz, you're a hero. Thanks.

Upvotes: 0

Views: 58

Answers (1)

user1907906
user1907906

Reputation:

A class with

package ass1;

must be in the folder

src/ass1

javac will but the .class file in

bin/ass1

because the package structure must be the same as in src.

Upvotes: 2

Related Questions