Dharisi Suresh
Dharisi Suresh

Reputation: 150

How to create package folders with javac command

I am compiling java file with command prompt with some package name come.test. But while running with java command it gives no class definition error. If I compile with IDE it is running because folders are created like com\test

How can I get those folders if I compile with javac command.

Upvotes: 0

Views: 1160

Answers (1)

Joop Eggen
Joop Eggen

Reputation: 109547

For such questions, when an online search at oracle does yield immediate results, try

javac -help

javac -source 1.8
      -target 1.8
      -encoding UTF-8
javac -d target/classes         --> generated classes
      -s src/main/java          --> generated source files
      src/main/java/x/y/*.java  --> java files to be compiled

The directory target/classes should exist. Package folders are created under classes (x/y).

Upvotes: 2

Related Questions