Reputation: 1309
I am compiling a java source file named MyPeogram.java. Now I want to use javac to compile the file and save the class file in the name MyCompileCode.class. Is it possible to give such custom class names to compiled files?
Please let me know how to do this. I searched online a lot but could not find anything.
Upvotes: 0
Views: 1473
Reputation: 224
AFAIK, I think it is not possible, because Java is compiled and interpreted both. Even though you compiled the program and changed, it's name, the interpreter gets confused in class file name and the data in that class file.
Correct me, If I am wrong.
Upvotes: 1
Reputation: 79818
No. The name of the source file must match the name of the compiled file.
Upvotes: 3