Elite Kid Productions
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Elite Kid Productions

Your place, your needs, your time.
 
HomePortalGalleryLatest imagesSearchRegisterLog in

 

 JDK Find/Configure Code

Go down 
AuthorMessage
gotoel
Admin's Bitch



Posts : 2
Reputation : 0
Join date : 2009-12-23

JDK Find/Configure Code Empty
PostSubject: JDK Find/Configure Code   JDK Find/Configure Code I_icon_minitimeWed Dec 23, 2009 4:29 pm

Code:
@ECHO OFF
title JDK Config by GoToEl


ECHO Looking for JDK

SET KEY_NAME=HKLM\SOFTWARE\JavaSoft\Java Development Kit
FOR /F "tokens=3" %%A IN ('REG QUERY "%KEY_NAME%" /v CurrentVersion 2^>NUL') DO SET jdkv=%%A
SET jdk=

IF DEFINED jdkv (
   FOR /F "skip=2 tokens=3,4" %%A IN ('REG QUERY "%KEY_NAME%\%jdkv%" /v JavaHome 2^>NUL') DO SET jdk=%%A %%B
) ELSE (
   FOR /F "tokens=*" %%G IN ('DIR /B "%programfiles%"') DO SET jdk=%%G
)

SET jdk=%jdk%\bin
SET javac="%jdk%\javac.exe"

IF NOT EXIST %javac% (
   javac -version 2>NUL
   IF "%ERRORLEVEL%" NEQ "0" GOTO :notfound
) ELSE (
   GOTO :setpath
)
GOTO :eof

:notfound
ECHO JDK is not installed, please download and install it from:
ECHO http://java.sun.com/javase/downloads
ECHO.
PAUSE
EXIT

:setpath
SET PATH=%jdk%;%PATH%
GOTO :eof

Save as JDKfind.bat It will set your system classes and paths to where JDK is located so you will not have to reset it all the time.

All credit to me.
Back to top Go down
 
JDK Find/Configure Code
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Elite Kid Productions :: Programmers Palace-
Jump to: