Android: Need JDK in a USB Drive

One thing I need is JDK in a portable format. Here at college, the school's admin made it impossible to install Java JDK. The solution is to install it in a usb be drive and I could use the JDK and any program that needs its. However, some programs needs the the path and the user needs to go to System Properties -->Environment Variables and change the Java JDK Path.

enter image description here

To make it worse, admin (wisely, I may add) locks the path and the user can't chose or add regular JDK or 64 bit version.

HERE Is my solution to bypass this problem: Download jdk portable and intall it in usb drive: enter image description here

However, the trick is to change the path of the JAVA_HOME @ environment variables with old simple cmd commands. I know i will have to reuse the code multiple times, so i will save the code in batch file (.bat) and just click on it and it will run in a cmd window.

Here is the code:

 @echo off
ECHO As a network admin, I’m getting tired of having to type these commands in! Hopefully, this saves me some time in the long run. 

cd ..
echo "%cd%"
echo Starting JAVA_HOME!
echo CLASSPATH:     %CLASSPATH%          (should be unset)
echo JAVA_HOME:     %JAVA_HOME%



PAUSE

setx JAVA_HOME "\PortableApps\CommonFiles\Java64"

setx PATH "%PATH%;%JAVA_HOME%\bin";
timeout 5

echo Starting Program!

echo CLASSPATH:     %CLASSPATH%          (should be unset)
echo JAVA_HOME:     %JAVA_HOME%
"Android Studio\bin\studio.exe"
PAUSE

as you can see the last line of code, it opens Android Studio in my usb drive.


Author: jesueRocha, Jesue Rocha

Oh, I'm the cutest!

Just another programmer/network/security person


Loves technology and retro video games. Likes to program on his spare time and rides a Kawasaki Ninja to the sunset 24/7.