Reputation: 33
I have a class called fence.java
and after compilation with javac the .class file is named fence.class
, but I want it to be called p1
. When compiling C files with gcc I am able to do this by using the -o option but for javac I haven't been able to find something similar.
Upvotes: 1
Views: 1339
Reputation: 1661
In java the class file name are determined by the name of the source files and that is done automatically by the compiler, if you want to use the name p1
then change the name of the source file to that before compiling (When you do this remember to change the class name as well as the name of the file.)
Upvotes: 0
Reputation: 1038730
That's a convention used in Java that you cannot change. The file should be called the same way as the class it contains.
Upvotes: 1