Created
June 11, 2011 08:07
-
-
Save afriza/1020358 to your computer and use it in GitHub Desktop.
Batch file wrapper to call JGit.Pgm JAR in Microsoft Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@REM Author: Afriza N. Arief <afriza.na@gmail.com> | |
@REM ### automatically search for common JRE/JDK folder path ### | |
@echo off | |
set JAVA_CMD= | |
set JGIT_JAR= | |
set JGIT_EXT=.JAR;.SH | |
set JGIT_FILE_PATTERN=*jgit.pgm* | |
if not defined JAVA_HOME for /d %%d in ("C:\Program Files\Java\jre*") do set JAVA_HOME="%%d" | |
if not defined JAVA_HOME for /d %%d in ("C:\Program Files (x86)\Java\jre*") do set JAVA_HOME="%%d" | |
if not defined JAVA_HOME for /d %%d in ("C:\Program Files\Java\jdk*") do set JAVA_HOME="%%d" | |
if not defined JAVA_HOME for /d %%d in ("C:\Program Files (x86)\Java\jdk*") do set JAVA_HOME="%%d" | |
REM alternatively, hardcode the path here | |
REM set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_24" | |
if defined JAVA_HOME set JAVA_CMD=%JAVA_HOME%\bin\java.exe | |
REM echo JAVA_CMD is set to %JAVA_CMD% | |
if not defined JAVA_HOME echo Java Run-time is not found please set JAVA_HOME to JRE or JDK root directory | |
if not defined JAVA_HOME goto END | |
if not exist %JAVA_CMD% echo java.exe is not found please set JAVA_HOME to correct JRE or JDK root directory | |
if not exist %JAVA_CMD% goto END | |
REM echo PATH is set to %PATH% | |
REM Find JGit-Pgm JAR | |
@if not defined JGIT_JAR for %%e in (%JGIT_EXT%) do for %%i in (%JGIT_FILE_PATTERN%%%e) do if NOT "%%~fi"=="" set JGIT_JAR="%%~fi" | |
@if not defined JGIT_JAR for %%e in (%JGIT_EXT%) do for %%i in (%JGIT_FILE_PATTERN%%%e) do if NOT "%%~$PATH:i"=="" set JGIT_JAR="%%~$PATH:i" | |
REM java -jar org.eclipse.jgit.pgm-0.12.1.sh %* | |
if not defined JGIT_JAR echo No .JAR/.SH file matches *jgit.pgm* Make sure JAR/SH file is in the path. | |
if defined JGIT_JAR %JAVA_CMD% -jar %JGIT_JAR% %* | |
:END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment