I am compiling a set of Java files using javac. With following command I save all Java files into a text file:
dir *.java /S /B > files.txt
Here a short extract of files.txt:
C:\Users\User\Desktop\source\org\apache\commons\lang3\AnnotationUtils.java
C:\Users\User\Desktop\source\org\apache\commons\lang3\ArchUtils.java
C:\Users\User\Desktop\source\org\apache\commons\lang3\ArrayUtils.java
C:\Users\User\Desktop\source\org\apache\commons\lang3\BitField.java
C:\Users\User\Desktop\source\org\apache\commons\lang3\BooleanUtils.java
C:\Users\User\Desktop\source\org\apache\commons\lang3\CharEncoding.java
...
Now that I have all my sources in one file I want to compile them with following command:
javac -encoding ISO-8859-1 -g -cp @files.txt
with the output...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
When I now switch to the sources folder I can see some of the compiled files but not all. For example the file AnnotationUtils.class
is missing.
I am expecting to see for each Java file a class file plus class files for inner classes or at least an error message during compilation.
What causes this and how can I solve it?
The problem is the -cp
argument. It is used to add additional files to the classpath like jar files. I thought it would not make any difference when I use it all the time even if I do not specify any other files. Now I use it only if I really need it and it solved my problem. All expected files are there.
Though I am not sure why this does not compile all files.