


I hope this Java compile shell script will come in handy on those times when you don't want or need to use Ant to compile your Java programs. Note that you will want to change the value of the variable PROGRAM_NAME to the name of your Java class file that contains the main method for your app. You are in a directory above a directory named " lib", and any Jar files that your program needs are in that directory.īecause this fits my standard build directory structure, this works for me all the time.You are in a directory above a directory named " src", and src contains your ".So, if your Jar files are all where they should be, compiling from the command line is a breeze. The really nice thing this script does for you is to dynamically include all of the Jar files you need into your classpath. I thought I'd share this "java compile" shell script here today. On those occasions (which are very rare these days), I typically use a Linux shell script to compile my Java classes.
#Unix batch script example java program code#
Using an ad blocker? just a $2 donation at will help keep this site runningĬan you share an example of a Unix/Linux shell script that I can use to dynamically create a CLASSPATH so I can compile my Java source code files, where those files depend on JAR files? Introduction to the solutionįrom time to time circumstances come up where I don't have Ant or an Ant-based project to compile my Java programs.
