First off… the reason why… I’m a developer, ok a tinker of some sorts, and like to keep my ongoing projects upon a USB drive in my wallet. So wherever I go and I’ve got access to a PC, I just plug in the USB stick and start programming…
Right… let's get it on..
Hardware environments where upon I did my prim. testing
- PC A – Win7/64
- PC B – Win7/64 (no admin rights)
- USB Flashdrive LaCie key 16GB
Next… prepare before commit. Preparing the USB Flash drive. I formatted it with the Windows format (Quick) to FAT32. And made a root directory “ANDROID”.
Tip: When creating directories, don’t use spaces because Eclipse has issues…LOL.
Next… the gathering. I made a new sub directory “_DOWNLOADS” and started the gathering of the required software.
- Java JDK 7 -:- jdk-7-windows-x64.exe -:- from Oracle
- Eclipse -:- eclipse-jee-juno-win32-x86_64.zip -:- from Eclipse
- Android SDK -:- installer_r20-windows.exe -:- from Google
So why two PCs…
Java JDK and Android SDK have to be installed and require admin rights. Android SDK generates a directory upon your PC and doesn’t ask you for a location.
Next… Java. For Eclipse Juno, one needs the JEE/JDK version. With eclipse Indigo, one could just use the standard JRE and it will run. So… first make a new directory upon the USB stick, “JAVA”. Click upon the Java executable and let it run… Upon selection of a root directory, choose the newly created “JAVA” directory. And let the install do the rest. For that, I didn’t change a thing, that's it.
Issue 1: Because the Java JDK is upon a USB stick, it needs to be started manually/indirect. Again, this issue we handle later on..
Next… Android SDK. First make a new directory upon the USB stick, “ANDROID_SDK”. What to say about the SDK installer… I rather prefer a ZIP file that one just unpacks… When running the executable, the installer asks for a location which is fine and thus we direct it to our newly created directory.
Next…Android “.android” directory. As already mentioned, not all files are stored upon the USB stick. The directory “.android” can be found C:\Users\<user>\.android\ on Windows 7. So… copy the directory completely and paste it upon the USB stick.
<drive>\ANDROID\.android</drive>
Issue 2: This “.android” directory is one of the issues we must handle later on. Redirect the SDK and ADV manager in order to use this directory.
Next… Eclipse. First make a new directory upon the USB stick, “ECLIPSE_JEE_JUNO_WIN64?. And then upack the zip file and paste its contents within the newly created directory. Simple….But no…
Issue 3: Running eclipse from the USB stick requires Java and thus one must tell eclipse where to find the JDK files it requires.
Next… Eclipse.. Workplace. Make a new directory and call it “WORKPLACE” Ok…
Issue 4: Handling the constant relocation of the workspace directory. When inserting the USB stick into a PC, it is assigned a <drive> thus making it difficult for eclipse to keep track of the location of the WORKSPACE.
And that’s it! All we need to do now is handle the issues…
Issues… So to fix some of the issues, I created a “Batch” file that one must pre start before running Eclipse or the Android SDK / ADV managers. Place the “js.bat” file within the ANDROID directory.
1.: Running the Java JDK
To do so, we have to tell the PC where the Java file location is. So we edited the batch file and added an environment variable “JAVA_HOME
”. Also we have to modify the “PATH
” variable so that eclipse and the rest know where to look.
2.: Relocating/redirecting the “.android” file requires editing the “js.bat” file and adding a variable “ANDROID_SDK_HOME”
“js.bat” file
@echo off
setlocal enabledelayedexpansion
set JB=%~d0\ANDROID\JAVA\bin
setx Path "%Path%;%JB%"
setx JAVA_HOME %~d0\ANDROID\JAVA\jre
setx ANDROID_SDK_HOME %~d0\ANDROID
endlocal
pause
As one can see/read, the variables are installed as local which makes it easier to delete/clear at the end. So indeed there is a second “BATCH” file to clear the variables.
Tip: One cannot delete variables, only clear them and Windows does the rest.
“Remove_js.bat”
@echo off
setlocal enabledelayedexpansion
set JB=%~d0\ANDROID\JAVA\bin
set "Path="
set "JAVA_HOME="
set "ANDROID_SDK_HOME="
endlocal
pause
Next Issue….
3.: Editing the eclipse.ini file
When one runs Eclipse, it looks for the Java bin directory, so we’re going to tell it where to look. The ini file is found: “\ANDROID\ECLIPSE_JEE_JUNO_WIN64\eclipse.ini”.
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-VM
../JAVA/bin/javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m
4.: Editing the preference file
Finally when starting eclipse, it will ask you for the location of the WORKSPACE. Just look for it by clicking upon the browse button. BUT, do not activate the selection box.
OK….that is it….. BUT…..
To finish it all, I’ve added something else - a “SYSTEMTRAY MENU”. Unfortunately, the autorun doesn’t work in WIN7 so it doesn’t start automatically. And the software for the system tray menu is a third party software which does the trick.
- Pro – One can run your executables from the systemtray
- Pro – It handles the dismount issues in Win7
- Pro – Autostartup of applications (auto run the js.bat)
- Con – Doesn’t allow you to add directories to the menu
- Con – No auto-shutdown process of executables (auto run remove_js.bat)
Due to the modifications to the “Autoplay” app of Microsoft in Win7, the autorun.ini file is disabled which means we have to run it manually. Just click upon the “psmenu.exe”
Next… testing. I’ve been testing the hole enchalade on PC B a non admin rights PC. And it seems to work… If it works for you, please leave a post with your configuration…
Next… bugs… Yip… one without the other doesn’t exist. Let me know.
Next… download. I created a zip file (1.3GB) and then a torrent file. Just download the torrent, unpack the zip in the root of your freshly formatted USB drive. Good luck to all.