Click here to Skip to main content
Click here to Skip to main content

Eclipse on a USB flashdrive

By , 10 Jul 2012
 

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 where ever I go and I’ve got access to a PC, 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. 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 PC’s…

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 wil 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 dirctory, 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 prefure 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. Like already mention 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. Redirecting the SDK and ADV manager in order to using 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 it’s 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 direktory and call it “WORKPLACE” Ok…

Issue 4: Handling the constant reloction of the workspace directory. When inserting the USB stick into a PC it is asigned 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 now is handle the issues…..

Issues… So to fix some the issue I created a “Batch” file that one must pre started 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 add a environment variable “JAVA_HOME”. Also we have to modify the “PATH” variable so that eclips 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 is 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 seletion 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. 

License

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

About the Author

kribo
Software Developer
Belgium Belgium
Developer within C#, Dynamics NAV (Navision), Php environments.
Follow on   Twitter

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionMinimum USB Size PinmemberKelly Anderson13-May-13 6:54 
AnswerRe: Minimum USB Size Pinmemberkribo10-Jun-13 8:24 
QuestionTorrent link broken PinmemberKelly Anderson13-May-13 6:52 
AnswerRe: Torrent link broken Pinmemberkove20-May-13 2:57 
GeneralRe: Torrent link broken [modified] Pinmemberkribo27-May-13 8:04 
AnswerRe: Torrent link broken Pinmemberkribo10-Jun-13 8:19 
SuggestionJava location and workspace Pinmemberjemerritt3-Oct-12 5:29 
Questionformat? PinmemberLeonardo Paneque6-Jul-12 12:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web04 | 2.6.130619.1 | Last Updated 11 Jul 2012
Article Copyright 2012 by kribo
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid