I have come across a bash script that appears to be running a java main class without compiling it or producing a binary.
Namely I am looking at the final lines of this script:
MAIN_CLASS="com.amazon.kinesis.streaming.agent.Agent"
exec $JAVACMD $JVM_ARGS "$OOME_ARGS" \
-cp "$CLASSPATH" \
$MAIN_CLASS "$@"
on my machine, this translates to something like this:
exec /usr/lib/jvm/jre/bin/java <some args> -cp <paths to some jars> com.amazon.kinesis.streaming.agent.Agent
I am quite unfamiliar with the exec /usr/lib/jvm/jre/bin/java <main class>
format in bash. I thought java files would always need to be compiled first and then run as a .jar or class file, but this appears to be invoking the .java file directly.
How exactly does this run the file, and is there still a binary produced somewhere? I have been able to find next to nothing about this online, aside for one stack overflow answer suggesting it may be possible to run a java class from terminal.