by Michael Thomas
On the JAR Home page, you can download the whole JAR site (all content, tutorials & examples) !!!
Topic | Info |
Directory Structure | Directories
|
Main Example Files | tutorial_firststeps_jar - list of
files
|
tutorial_firststeps_jar tutorial_firststeps_jar\src tutorial_firststeps_jar\src\firststeps |
Filename: tutorial_firststeps_jar\_setpathjdk.bat |
rem Override the enrionment system variable here if needed. rem set JAVA_HOME="C:\Program Files\Java\jdk1.5.0\bin" if "%JAVA_HOME%" == "" goto error_no_java_home if exist "%JAVA_HOME%\bin\javac.exe" goto setPath goto error_invalid_java_home :error_no_java_home echo off echo ############################## echo Warning... echo ############################## echo The system environment variable JAVA_HOME has not been created. echo Alternate Option - Create the system variable at the top of this file ( _setpathjdk.bat ). pause exit :error_invalid_java_home echo off echo ############################## echo Warning... echo ############################## echo The JAVA_HOME environment system variable points to a missing directory. echo JAVA_HOME = %JAVA_HOME% pause exit goto end :SetPath set path="%JAVA_HOME%\bin";%path% :end |
Filename: tutorial_firststeps_jar\src\firststeps\HelloWorld1.java |
package firststeps; public class HelloWorld1 { public static void main(String[] args) { System.out.println("Hello World #1"); } } |
Filename: tutorial_firststeps_jar\src\firststeps\HelloWorld1.java |
package firststeps; public class HelloWorld2 { public static void main(String[] args) { System.out.println("Hello World #2"); } } |
Filename: tutorial_firststeps_jar\HelloWorld_build_1_compile.bat |
rd build /s /q md build md build\classes md build\classes\firststeps call _setpathjdk.bat rem javac -help javac -sourcepath src -d build\classes src\firststeps\*.java pause |
Filename: tutorial_firststeps_jar\HelloWorld_build_2_jar.bat |
rd build\jar /s /q md build\jar call _setpathjdk.bat jar cfmv build\jar\HelloWorld.jar HelloWorld_build_2_jar_manifest.txt -C build\classes . jar -ft build\jar\HelloWorld.jar pause |
META-INF/ META-INF/MANIFEST.MF firststeps/ firststeps/HelloWorld1.class firststeps/HelloWorld2.class
Filename: tutorial_firststeps_jar\HelloWorld_build_2_jar_manifest.txt |
Main-Class: firststeps.HelloWorld1 |
HelloWorld_build_3_run.bat |
call _setpathjdk.bat java -cp build\classes firststeps.HelloWorld1 java -cp build\classes firststeps.HelloWorld2 pause |
HelloWorld_build_4_run_jar.bat |
call _setpathjdk.bat rem Run the class defined in the manifest file created during the Jar build. java -jar build\jar\HelloWorld.jar pause |