Install java in the eclipse directory (use jre / jdk instead of jre7), eclipse will pick it up (or it did this for me in windows).
Alternatively edit eclipse.ini (there is a -VM option to indicate where Java is located).
also see http://portableapps.com/node/929 or http://www.codeproject.com/Articles/417140/Eclipse-on-a-USB-flashdrive
Since there are some doubts about this method. I am using Windows Eclipse version (1.4.1.2), the jre7 directory has been copied to jre under eclipse. Where there is no change in eclipse.ini.
, Java , , Eclipse ( → → ), Eclipse , jre F (USB). jre, java .
-vm
F:\eclipse\jre\bin\client\jvm.dll
eclipse.home.location=file:/F:/eclipse/
eclipse.launcher=F:\eclipse\eclipse.exe
eclipse.launcher.name=Eclipse
eclipse.p2.data.area=@config.dir/../p2/
eclipse.p2.profile=epp.package.java
eclipse.product=org.eclipse.epp.package.java.product
eclipse.startTime=1365550480114
eclipse.vm=F:\eclipse\jre\bin\client\jvm.dll
eclipse.vmargs=-Dosgi.requiredJavaVersion=1.5
......
sun.boot.class.path=F:\eclipse\jre\lib\resources.jar;F:\eclipse\jre\lib\rt.jar;F:\eclipse\jre\lib\sunrsasign.jar;F:\eclipse\jre\lib\jsse.jar;F:\eclipse\jre\lib\jce.jar;F:\eclipse\jre\lib\charsets.jar;F:\eclipse\jre\classes
sun.boot.library.path=F:\eclipse\jre\bin
......
java.endorsed.dirs=F:\eclipse\jre\lib\endorsed
java.ext.dirs=F:\eclipse\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
java.home=F:\eclipse\jre
java.io.tmpdir=C:\Users\mum\AppData\Local\Temp\
java.library.path=F:\eclipse;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;F:/eclipse/jre/bin/client;F:/eclipse/jre/bin;F:/eclipse/jre/lib/i386;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Dell\DW WLAN Card;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Bruce\jEdit;C:\Program Files (x86)\QuickTime\QTSystem\;c:\Regina;C:\Program Files\TortoiseSVN\bin;;F:\eclipse;;.
jre-
-vm
C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll
eclipse.home.location=file:/F:/eclipse/
eclipse.launcher=F:\eclipse\eclipse.exe
eclipse.launcher.name=Eclipse
eclipse.p2.data.area=@config.dir/../p2/
eclipse.p2.profile=epp.package.java
eclipse.product=org.eclipse.epp.package.java.product
eclipse.startTime=1365550310914
eclipse.vm=C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll
eclipse.vmargs=-Dosgi.requiredJavaVersion=1.5