Created
June 13, 2015 17:02
-
-
Save Youka/2a6c4b82c007e7c528e5 to your computer and use it in GitHub Desktop.
Small java environment setup in console
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
@echo off | |
rem Set console appearance | |
title Java environment (%cd%) | |
color 0C | |
rem Set console environment | |
if "%~1"=="" ( | |
set JAVA_BIN=C:\Program Files\Java\jdk1.8.0_45\bin | |
) else ( | |
set JAVA_BIN=%~1 | |
) | |
set Path=%Path%;%JAVA_BIN% | |
rem Check for Java binaries | |
where "javac.exe" 1>NUL 2>NUL | |
if ERRORLEVEL 1 ( | |
echo "Java compiler not found!" | |
goto JAVA_BIN_NOTFOUND | |
) | |
where "java.exe" 1>NUL 2>NUL | |
if ERRORLEVEL 1 ( | |
echo "Java interpreter not found!" | |
goto JAVA_BIN_NOTFOUND | |
) | |
goto JAVA_BIN_FOUND | |
:JAVA_BIN_NOTFOUND | |
pause | |
exit 1 | |
:JAVA_BIN_FOUND | |
rem Some user informations | |
echo Welcome to this Java environment console. | |
echo Binaries path: "%JAVA_BIN%" | |
echo Use "javac" for compiling and "java" for execution. | |
echo. | |
rem Keep console open | |
cmd /K |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment