# # Makefile for building jdraw jar files, including notes on executing # compiled Java programs. Also some notes at the bottom regarding debugging # compiled Java programs in Emacs. # # CSC 206 java lib directory LIB206 = /users/gfisher/classes/206/lib/JVM # # NOTES ABOUT EXECUTING COMPILED JAVA PROGRAMS. # # The compilation rule in the implementation/source/java/Makefile results in an # executable program that consists of .class files stored in this directory -- # implementation/executables/JVM. The program is invoked as follows from this # directory: # # java jdraw.Main # # where "jdraw" is the name of the top-level project package, and Main is the # name of the class that contains the definition of the program's main method. # Executing in this way assumes that the CLASSPATH environment variable # includes the path of the CSC 206 library directory, which on waldorf is # # /users/faculty/gfisher/classes/206/lib/JVM # # If CLASSPATH does not include this path, then the program can be invoked by # specifying the CLASSPATH as a command-line argument as follows: # # java -classpath /users/gfisher/classes/206/lib/JVM:. \ jdraw.Main # # Per standard Java invocation conventions, the preceding invocations assume # that the current working directory is the executables/JVM directory in which # the .class files reside. If this is not the case, then the classpath must be # extended with the directory in which the compiled package resides. # Specifically, to run jdraw.Main from some directory other than JVM, # invoke it as follows: # # java -classpath /users/gfisher/classes/206/lib/JVM:/users/gfisher/work/calendar/jdraw/implementation/executables/JVM jdraw.Main # # # The following make rules use the jar utility (the Java archiver) to build two # other forms of executable programs -- one a transportable version and another # that is a stand-alone executable version. These rules should be run after # the compilation has been performed in the implementation-Makefile in # ../../source/java/Makefile. # # The default make rule runs both the transportable and stand-alone executable # make rules. # all: jar exec # Run the Jar utility on all of the files to build a transportable program # archive file. # jar: $(FILES) jar cf jdraw.jar jdraw # This .jar file is primarily intended for file transfer purposes, not for # direct invocation. For convenient execution from a jar file, see instead the # exec rule below. The .jar can be invoked if desired as follows: # # java -classpath \ /users/gfisher/classes/206/lib/JVM:jdraw.jar \ jdraw.Main # Run the Jar utility on all of the files to build a stand-alone executable # .jar file that includes .class files, 206 library .class files, and a # MANIFEST file that defines the Main-Class attribute as the single-view Main # class. The MANIFEST contains the following single line: # # Main-Class: jdraw.Main # exec: rm -f mvp lib206 ln -s $(LIB206)/mvp . ln -s $(LIB206)/lib206 . jar cmf MANIFEST jdraw.jar jdraw mvp lib206 chmod a+x jdraw.jar rm mvp lib206 # The preceding rule builds a jar file that can be invoked stand-alone, without # unpacking it and without linking to the external 206 library. It is invoked # as follows: # # java -jar jdraw.jar # # This invocation can be performed in any working directory that contains a # copy of jdraw.jar, with no required settings of the CLASSPATH # environment variable. The stand-alone .jar file can also be invoked from any # other working directory simply by specifying the full path to the location of # the .jar file. #