Is the java app a single class file, or multiple class files?
If multiple files, will they all be in a single directory? OR, are you willing to package them in a single .JAR file?
In general, you can define a "variable" in a bash script, with a statement such as:
so on my system for example, I'd have:
for the location of the JDK.
Then that could be followed by the command line for the java command, much as you'd type it, if you were manually trying to run the app from the command line.
But the specifics, such as mentioned towards the beginning of this message, can impact exactly what else might be needed in the script. Also, the exact situation/environment from which you intend to run the script, may affect what else might be needed in the script. Because in some situations, things which might be taken for granted in the environment which is present from the command line, might not normally be present, if the script is to be run from some automated facility in the "background". Additional details from you, could be quite helpful in order to answer your question as fully as possible.