Click here to Skip to main content
13,294,435 members (58,769 online)
Click here to Skip to main content
Add your own
alternative version


5 bookmarked
Posted 9 Jul 2012

Eclipse on a USB Flashdrive

, 10 Jul 2012
Rate this:
Please Sign up or sign in to vote.
Eclipse on a USB flashdrive

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 -:- -:- 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.


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%"

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.


@echo off
setlocal enabledelayedexpansion
set JB=%~d0\ANDROID\JAVA\bin
set "Path="
set "JAVA_HOME="

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”.




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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Belgium Belgium
Developer within C#, Dynamics NAV (Navision), Php environments.

You may also be interested in...

Comments and Discussions

QuestionMinimum USB Size Pin
Kelly Anderson13-May-13 7:54
memberKelly Anderson13-May-13 7:54 
AnswerRe: Minimum USB Size Pin
kribo10-Jun-13 9:24
memberkribo10-Jun-13 9:24 
QuestionTorrent link broken Pin
Kelly Anderson13-May-13 7:52
memberKelly Anderson13-May-13 7:52 
AnswerRe: Torrent link broken Pin
kove20-May-13 3:57
memberkove20-May-13 3:57 
GeneralRe: Torrent link broken Pin
kribo27-May-13 9:04
memberkribo27-May-13 9:04 
AnswerRe: Torrent link broken Pin
kribo10-Jun-13 9:19
memberkribo10-Jun-13 9:19 
SuggestionJava location and workspace Pin
jemerritt3-Oct-12 6:29
memberjemerritt3-Oct-12 6:29 
Questionformat? Pin
Leonardo Paneque6-Jul-12 13:05
memberLeonardo Paneque6-Jul-12 13:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 11 Jul 2012
Article Copyright 2012 by kribo
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid