0

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?


2
  • Why are you trying to compile a maven project with a manually constructed build batch script, instead of using maven? Commented Aug 19, 2019 at 16:14
  • @ElliottFrisch Basically I am trying to compile source code with different JDK's and compiler options so that I can compare the resulting bytecode. Commented Aug 19, 2019 at 16:17

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.