How to install jdk for offline compile?
If your project only uses Command Line Interface, and only uses sub-packages from java.lang , then you can try "TERMUX" android app, it's a terminal emulator, so you should be familiar with linux terminals.

As of now , it doesn't have the entire JDK, but I can provide you a package that has basic tools like javac and jar, 
that you could use with termux.
BUT if your project uses AWT classes, this method won't help.