How to call docker/javac within a bash file

This is my bash script ("compile_java.sh"):

#!/bin/bash
filename=$(basename -- "$1")
extension="${filename##*.}"
filename="${filename%.*}"
echo "$1"
echo "$filename"
echo "$extension"
docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp openjdk:15 javac $1

And that is my try to call the bash script (i’m using Ubuntu): . compile_java.sh TestJava.java

And that is the "error" message:

TestJava.java
TestJava
java
error: invalid flag: TestJava.java
Usage: javac <options> <source files>
use --help for a list of possible options

Can someone give me a hint please?

Source: Docker Questions