Q:

compiling and executing java from bash script

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:
#! /usr/bin/env bash

MYID="$(cat $(pwd)/my.id)"
eval javac src/main/java/foo/bar.java "$MYID"

but it thinks of my argument as another java file for compilation and gives me the error:
Class names, 'abc123', are only accepted if annotation processing is explicitly requested

P.S. abc123 is the only id in the my.id file I need to pass. 
Please help me make this work, I have been looking for solutions the whole day. :( 
edit: This was a stupid question. 
I just realized I was passing in arguments at the wrong place.  I figured it out.  thankyou! 

A:

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 are simpler and / or more flexible ways to do that that writing a bespoke Java program to do it.   (For example, use the "m4" utility.)