I'm trying to compile my java code using a bash script. I need to pass in arguments too, which I'm getting from another file in the same directory. My script looks like:
eval javac src/main/java/foo/bar.java "$MYID"
Class names, 'abc123', are only accepted if annotation processing is explicitly requested
You are going about this the wrong way. The
javac command compiles programs. That is it. It doesn't generate source code.
Based on your comments it sounds like you should be doing something like this:
javac foo/Bar.java java foo.Bar $(cat my.id) > foo/Baz.java javac foo/Baz.java
This assumes that
foo.Bar is some kind of generator program that knows how to generate java source code. In reality, I expect that what you are really trying to do is some kind of source-code template expansion. There could be simpler ways to do that that writing a bespoke Java program to do it. (For example, use the "m4" utility.)