You are here

PortableJava -> a tool to set your default JRE reversible to your removeable drive

17 posts / 0 new
Last post
rory.slegtenhorst
Offline
Last seen: 14 years 9 months ago
Joined: 2008-02-04 11:53
PortableJava -> a tool to set your default JRE reversible to your removeable drive

Don't you just hate it when things don't work the way we want them to? I had this problem, trying to get Firefox or Chrome to play nice and be able to use Java. The same goes for my Eclipse.
As nobody has made a descent solution, I figured I'll give it a shot, so I created this for everyone.

What does it do?
It temporarily tells your machine to get Java from your stick. It will "register" the JRE in the registry, so every tool that uses the registry to find Java, will now point to your JRE.
When you shut the tool down, it will remove the registration, and restore original functionality without leaving a trace on your machine. The backup is saved in %APPDATA% under PortableJava. Whenever PortableJava is closed ungracefully, you can run the backup registry file to restore your original nodes.

Installation

  • Install your JRE in \PortableApps\CommonFiles\Java
    In case of doubt, follow the directions from OpenOffice
    You can also use the Java Portablizer 1.1
  • Create the file JavaPortable.ini in \PortableApps\CommonFiles\Java
    See below for the basic contents
  • Install the PortableJava.exe in \PortableApps\PortableJava

Files
Download PortableJava-1.0.zip (194.81 KB) from here or here.
JavaPortable.ini:

[JavaPortable]
Vendor=Sun Microsystems Inc.
Version=1.6.0_10
URL=http://java.sun.com/

Replace the "Version" string with the version of your JRE!
Important note: The version of the JRE needs to be 1.6.0_10 or higher!

Icon
I am very aware of the fact that Java itself isn't fully opensource *yet*. I used a resource editor to extract the 16*16*32bit icon of the JRE installer. If anyone has a "better" icon, please send it to me or post it.
Please note that any infringment is NOT deliberate, I am simply too lazy to search for another.

Testing

  • Windows XP Professional SP3 - No administrative rights (me)
  • Windows XP Professional SP3 - Administrative rights (wk)
  • Windows Vista Ultimate 64bit - Administrative rights (me)

I test the systems by running my PortableChrome, and openening about:plugins. After that, I load a test page that includes an applet.

I think that as long as you can at least write to the HKEY_LOCAL_MACHINE\Software node, and are allowed to create a folder in the %APPDATA% directory, you should be pretty safe.

Edits

  • Changed the title to be more precise (Thanks wk for the hint Smile
  • Added info on what to do when PortableJava terminates unexpectedly
  • Added a statement on the icon I used
  • Added tested platforms

I hope you find it usefull. I do...

Cheers,
Rory

wk
wk's picture
Offline
Last seen: 1 year 5 months ago
Joined: 2007-09-05 12:31
Intriguing..

works fine on XPSP3admin account..gonna test it on domain user next week.
Some questions though:
-where are the backups saved as long as PortableJava.exe is running
-what happens with the entries when PortableJava is closed ungracefully?
(->any chance to reset to default settings afterwards though?)
-wonder whether you should use Sun´s branded java icon, is it open source already?

"Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis .." Friday Next -
"May The Schwartz be with You!" Yogurt the Yoda

rory.slegtenhorst
Offline
Last seen: 14 years 9 months ago
Joined: 2008-02-04 11:53
Personal note on the icon

There can be a huge debate on the opensource status of Java. I do remember reading this though. And I also remember that they released OpenJDK. I usually don't get too much involved in the discussion. I would like to say this though:

A while ago I posted the Delphi source for Eclipse on a Stick. The compiled version I have on my USB stick, contains the Eclipse icon, so it would show up more clearly in my PortableApps Menu.

Many other programs that I have created in Delphi contains the little red helmet icon from Delphi 2005, just because of these two reasons:

  1. It is hard to think of and/or create an icon for someone with little graphic skills
  2. It is a very nice icon. It tells me it was written in Delphi

Much of the java stuff I have created usually contains a exe to use. Whenever possible I use the "java" icon inside the JRE installer. And always for the same two reasons.

Do I mean Eclipse or Sun or Embarcadero (previously CodeGear, previously Borland) any harm by nicking their Development Environment/Language identificial icon thingy?
Simple answer: no.

I am proud of the things I create as a programmer. I am also proud of the languages that I use. I only wish to inspire others by indicating what my software is written in or related to.

In the end... who am I trying to credit?

wk
wk's picture
Offline
Last seen: 1 year 5 months ago
Joined: 2007-09-05 12:31
thanx for the update..

well, you answered all my questions. Didn´t mean to be rude or picky on your icon choice. I myself can live with it very well. Nothing left behind. I really like your app.

EDIT:
test on WinXpSp3 domain user successful. Wink

"Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis .." Friday Next -
"May The Schwartz be with You!" Yogurt the Yoda

agdurrette
Offline
Last seen: 11 months 4 weeks ago
Developer
Joined: 2008-01-16 13:55
can i use...

can i use jdk1.6.0_10(Java SE Development Kit (JDK) 6 Update 10) with it

"It's just an online installer. It's not going to mug you.", JTH
"The shell is the key to unlock Linux's greatest advantages."

rory.slegtenhorst
Offline
Last seen: 14 years 9 months ago
Joined: 2008-02-04 11:53
aqdurette, Not yet no. This

aqdurette,

Not yet no.
This is because the JDK uses additional registry keys that I haven't implemented yet.

I am working on this though, as I also need JDK functionality (Eclipse).

Ph4n70m
Ph4n70m's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2007-01-12 19:22
.

If you're using the icon from the installer, why don't you use the icon from java.exe? Aren't the icon from installer and the icon from java.exe under the same "copyright"?

abushcrafter
abushcrafter's picture
Offline
Last seen: 14 years 2 months ago
Joined: 2008-05-12 13:39
Thanks muchly When I have

Thanks muchly
When I have more time. I can tell you how it works on windows 2000.

mielo
Offline
Last seen: 15 years 11 months ago
Joined: 2008-12-16 16:05
XP SP2 - Non admin - Not working

Unfortunately, it doesn't work on XP SP2 without admin rights + JRE 1.6.0_11

"Error when opening a registry key, the key doesn't exist:HKLM\SOFTWARE\JavaSoft\Java Runtime Environnment\1.6"

If I can help in troubleshooting, let me know

cheers

mielo
Offline
Last seen: 15 years 11 months ago
Joined: 2008-12-16 16:05
[BUG FOUND] OK I spotted the

[BUG FOUND]

OK I spotted the bug.
The application does not create the key "1.6" in the registry. It only creates the "1.6.0_11".

Java will work embedded in browser.
But Java won't work for independant applet.

After creating manually the 3 entry in the registry, it works. Actually I build a .reg to re-create easily the key after the key is mounted and portable Java launched.
The strange thing is that the key is correctly removed when the USB key is removed.

Hope you will correct this issue in next release

cheers

ottosykora
Offline
Last seen: 21 hours 1 min ago
Joined: 2007-10-11 17:48
did work on w2k

I have yesterday test it on w2k and all was OK.

The java installed on that machine is very old, some 1.5x version. I tried to run a java software and it refused to work with this java. I used then this java 'switch' and pointed thus to my portable java6, the latest version on my stick.

The application then worked fine with the portable java version. Then I switched the portable java off and all returned to the original state and the app again claimed the 1.5x java is too old...

so all seems to work somehow

Otto Sykora
Basel, Switzerland

ottosykora
Offline
Last seen: 21 hours 1 min ago
Joined: 2007-10-11 17:48
w98se

well did not in fact expect it to work there on w98, but tried, and yes it does not work. Problem is, that once run, I have no idea how to stop it there, since the icon does not listen to that 'quit'

Otto Sykora
Basel, Switzerland

ottosykora
Offline
Last seen: 21 hours 1 min ago
Joined: 2007-10-11 17:48
just curious

what keys are you in fact backing up or changing?
Where are they stored when in operation?
What happends when something crashes and leaves the keys in the 'portable' position?
can tehy be somehow returned to normal without reinstalling java?

Otto Sykora
Basel, Switzerland

aboerner
Offline
Last seen: 11 years 1 week ago
Joined: 2007-09-12 05:19
Regedit policy & relative paths

Hello Rory,

nice approach. I have two suggestions for a next version Smile

1. RegEdit.exe (and the reg.exe command line tool) may be blocked by the 'Prevent Access to Registry Editing Tools' policy by an administrator. PortableJava will not work on a system with this policy activated. To bypass this you have to use your own RegRead & RegWrite functions or a 3rd party registry editor.

I know, this policy is kind of silly (like hiding C: drive for limited users in windows explorer), as both can be bypassed with ease, but you should be aware of that, if you write a portable application, that modifies registry keys.

2. The current version of PortableJava modifies the registry with the 'hard coded' path '?:\PortableApps\CommonFiles\Java'. It would be nice, if PortableJava can be started with a command line option providing a custom path or if it uses the current path (i.e. it's own path) as the java home. Thus, PortableJava.exe could simply be copied to the java home directory on the thumb drive and started from there.

rab040ma
Offline
Last seen: 5 months 2 days ago
Joined: 2007-08-27 13:35
HKLM?

Is it the case that you are dealing with values in HKLM, so you need Admin rights by default to use it?

This portablizing is only for programs that read the Java settings from the registry, which is primarily browsers looking for the plugin. Things that start from javaw.exe don't need to do that. I'd maintain that the browsers don't either (they could just use an environment variable) but for some reason IE set the pattern and FF and Chrome have followed suit.

I don't suppose there would be any value in seeing if the FF and webkit/chromium developers would allow for an environment variable (or other setting) to override the need to look in the registry ...

How do browsers find the Java plugin in Linux, where there is no registry?

Sigh.

MC

ottosykora
Offline
Last seen: 21 hours 1 min ago
Joined: 2007-10-11 17:48
not work

on w2k , where no java was installed at any time.
On other PC where java was installed, then removed, the portable java does work for me fine, repointing to the commonfile java on the stick

apparently there is still something missing when there is simply no java at all on the host machine, but the latest on the stick.

Is there anything new abt this quite useful software?

Otto Sykora
Basel, Switzerland

mr.duck
Offline
Last seen: 14 years 9 months ago
Joined: 2010-02-23 07:49
"Invalid or Deleted File" Is

"Invalid or Deleted File"

Is there a mirror for this? Or just a list of reg entries that I can add manually would be fine.

Log in or register to post comments