Is there an option for javac, say --dry-run, that will instruct the compiler not to do the actual compilation, but to parse the source file(s) and list which .class files (including package path) will be generated?
Consider this example:
$ cat example.java
package whatever.example;
class First {}
class Second {}
$ javac -d . example.java
$ find .
.
./example.java
./whatever
./whatever/example
./whatever/example/First.class
./whatever/example/Second.class
The source file was compiled into two .class files and, as the -d option was specified, package structure was generated. I would like to know such information before compilation. Something like this:
$ javac --dry-run -d . example.java
./whatever/example/First.class
./whatever/example/Second.class
Alternatively, if there is no such an option for javac, is there any third-party utility that can do such a thing?
try
javac -verbose -d . javaclass.java
this actually lists all the actions that a compiler is working on. towards the end you can what all classes have been generated with package structure.
I have compiler via the above code. I get the below output towards the end of the list.
[wrote RegularFileObject[.\com\SC\JustTesting.class]]
[wrote RegularFileObject[.\com\SC\JustTestingSecond.class]]
There are lot of other options, just type javac on the command prompt to look at them.
I don't know if I one can know, prior to compiling, this information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With