You are here

Java uses system path not CommonFiles\Java

7 posts / 0 new
Last post
adbennet
Offline
Last seen: 17 years 2 months ago
Joined: 2007-09-16 21:21
Java uses system path not CommonFiles\Java

Is portable Java supported yet? I followed the installation instructions and Java seems to be "working" but only from C:\Program Files\Java. The javasettings_Windows_x86.xml is created but OpenOfficePortable.exe doesn't seem to care about its contents. This situation is not truly portable if I use the USB drive on a computer with an older Java installed. Of course I can switch to \CommonFiles\Java but must I repeat this every time I start OpenOffice?

I also found the post by Cheffe at https://portableapps.com/node/3235 but couldn't quite follow what he meant by "Rebuild the modified OpenOfficePortable.nsi". I am thinking he means "rebuild with"?? But to make a new install.exe is a daunting step for someone like me who has never made even one. The .nsi is interesting, though, and Cheffe's post helped me figure out some of what is going on.

Anyway, what I would like is for OpenOfficePortable.exe to:

  1. PRESERVE the javasettings_Windows_x86.xml (not delete and generate).
  2. Prefer the CommonFiles\Java location over C:\Program Files\Java.

After that, I can make it completely portable with a .bat, like I have done with other apps. For example:

rem ... other code precedes
rem Lynx is a Windows executable
rem gawk is one line in the .bat

if %usb_tools_instance%==1 (

  echo Substitute references to current drive in lynx config file
  pushd "%HOME%\Lynx"
  if exist lynx_cfg_n (
    del lynx_cfg_n
  )
  gawk -- "{gsub(/localhost\/[a-zA-Z][:]\//,(\"localhost/\" mydrv \"/\"),$0) ;
              print $0}" mydrv=%USB_TOOLS_DRIVE% lynx.cfg > lynx_cfg_n
  if exist lynx_cfg_n (
    del lynx.cfg
    ren lynx_cfg_n lynx.cfg
    echo   OK Lynx config changed to %USB_TOOLS_DRIVE%
  ) else (
    echo Warning -- Lynx config not changed to %USB_TOOLS_DRIVE% 1>&2
    pause
  )
  popd

rem more code follows ...

I can adapt my existing USB_TOOLS.bat to modify the .xml, alongside all the other resources it already touches (pinerc, putty sessions, env variables, etc.). That is a one-time solution and much easier than fiddling with the Tools > Options every time.

TIA

John T. Haller
John T. Haller's picture
Offline
Last seen: 8 hours 44 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Few Things

1. Java Portablizer is to copy Java onto the USB drive for OpenOffice.org Portable to use. The ability for other apps to use it properly is coming soon.

2. OpenOfficePortable.exe will generate the appropriate XML file on each launch and use the Java Portable instance on your portable device. It will not preserve it. You have to be using the latest copy of OpenOffice.org Portable (version 2.2.1) in order for this to function as planned. Previous versions did not support Java on the portable device... only on the local PC.

3. You *MUST* install both OpenOffice.org Portable and Java to the correct locations. The following is the default and recommended:

X:\PortableApps\OpenOfficePortable (install OpenOffice.org Portable here)
X:\PortableApps\CommonFiles\Java (let Java Portablizer copy Java here)

4. That link to the other topic is from a *VERY* old post from before a portable java was supported by OpenOffice.org Portable and is no longer relevant.

Sometimes, the impossible can become possible, if you're awesome!

adbennet
Offline
Last seen: 17 years 2 months ago
Joined: 2007-09-16 21:21
Few Other Things

I presume most of your reply is just a clarification for someone else's benefit. Nothing wrong with that, but it doesn't much address my original post, the key point of which is that OpenOffice Portable doesn't properly remember its Java settings.

I tried again, following your instructions to the letter. ... Well, except for the drive letter. Smile

Fresh install to a blank USB drive, using 2.2.1 and Java Portablizer at recommended folders. Fired up OpenOffice. Changed some paths: My Documents to F:\MyData, Temporary Files to F:\Temp. (Risky, I know, but I want it all.) Created a test document and saved it. Ran the Fax Wizard. Changed the Java instance to F:\PortableApps\CommonFiles\Java and re-ran the Fax Wizard. Closed OpenOffice.

Fine so far, but we already know the next time I start OpenOffice it will have forgotten all about the Java selection. The generated .xml file has the local Java path in it, but OpenOffice doesn't pay any attention to that. Perhaps because `autoSelect="false"`? Anyhow, next I tested OpenOffice on my work PC. At the very first it too was fine; then it got progressively more ugly.

Created a test document as usual, but upon saving OpenOffice popped open the %userprofile%\My Documents folder instead of my preferred setting. Checking that, PortableApps had updated all the paths to E:\ *except* for the My Documents and Temporary Files. (That's with no drive F: at all. If drive F: is a CD-ROM drive, we get "Please insert a disk ..." instead.)

Next tried the Fax Wizard. I really didn't expect it to work, because this computer only reports Java version 1.3.1_01. (It actually has up to 1.4.2_11, but that's a different story.) "The wizard could not be run ...", etc. No problem, right? I have Java 1.6.0_02 here on USB, right? I went into Tools | Options, changed my Java to E:\PortableApps\CommonFiles\Java, clicked OK and ... drum roll ... "For the selected Java runtime environment to work properly, OpenOffice.org must be restarted. Please restart OpenOffice.org now. [OK]"

Yikes! There you have it. To change the Java RE requires a restart. But this being OOP, once restarted it won't remember the Java setting anyway. My original post was more about saving a few clicks. This is more serious. (Just to make 100% sure about the restart being necessary, I retried the Fax Wizard, but no luck.)

So it looks like I will be writing a script to update the drive letter on My Documents and Temporary Files. But Java is still out in the cold.

--
Alan

--
Alan

John T. Haller
John T. Haller's picture
Offline
Last seen: 8 hours 44 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Don't manually change things

I was addressing you... and you didn't follow my instructions... you're making it FAR more complex than you have to. Stop overthinking Blum

As I already explained, it will *automatically* set OpenOffice.org to use the portablized version of Java on launch. No manual changes at all should be made to the Java settings. Period. As long as things are in the right location, it'll just work. You're making it more complex than it is.

Also, OpenOffice.org Portable is configured to automatically use a portable X:\Documents directory and a portable TEMP directory within the OOP directory out of the box. If you manually change any paths, OpenOffice.org will break the relative path that was used to the Documents and Temp directory and fail to open your Documents directory when you switch PCs. The ability to manually change these paths is coming in the next release.

So, like I said, in both cases, you're messing with 3 things that work automatically out of the box and simply making it more complex than you need it to be. If you REALLY want to use a custom temp directory and a MyData directory, you can manually edit the paths file and add in relative paths. For an example, check out the OpenOfficePortable\App\DefaultData direcory. There are a couple files deep in there that will point you in the right direction. Or just wait for the 2.3 release which supports custom portable paths.

So, please, fire it up and test it WITHOUT mucking with the settings (and breaking it) first and you'll see that it just works. You can reset your settings by deleting the OpenOfficePortable\Data directory.

Sometimes, the impossible can become possible, if you're awesome!

adbennet
Offline
Last seen: 17 years 2 months ago
Joined: 2007-09-16 21:21
Okay okay

Thanks for the speedy response. You are not the first to say that I over-think things, so I will accept the criticism.

I am formatting and Portablizing a fresh USB drive now. I won't change any settings, and tomorrow at work, we shall see what we shall see.

By the way, before diving in I read as much as I could find here about OpenOffice Portable, and even some at OpenOffice.org. I didn't see anything about X:\Documents, nor about a portable TEMP directory. One would think that belongs on the support page (https://portableapps.com/support/openoffice_portable), no?

Bonsoir

--
Alan

--
Alan

adbennet
Offline
Last seen: 17 years 2 months ago
Joined: 2007-09-16 21:21
Java works - what about the TEMP directory?

You are right about Java -- it works if I don't make any changes.

You are right about My Documents -- creating the Documents folder at the same level as PortableApps, OpenOffice Portable switches to that. I don't care so much about the name and relative path, as long as it saves to the USB drive ... but of course I did monkey with the pointer. Wink

But I can't figure out how to change the TEMP folder. The default Paths.xcu relative path resolves to \PortableApps\OpenOfficePortable\Data\Temp. Well, the folder exists, but it's empty and apparently unused.

OpenOffice Portable, in Options, still reports %userprofile%\Local Settings\Temp as the Temporary files location. (I didn't touch, only looked.) And that is indeed where the startup temp files are being created. I didn't see any later temporary files, though, there or elsewhere. And OpenOffice deleted them on exit.

I *really* don't like using a temp folder on the C: drive -- it's a security thing. But how do I fix that? I also looked at the .nsi but couldn't see any references to the TEMP folder, except for RunDataLocally. So I am thinking that this is not a Portable setting, but an OpenOffice setting.

Finally, am I correct in guessing that Java, My Documents, and TEMP are the only three settings that have this fussy relative path behavior? Meaning, I can add ClassPaths without breaking anything, right?

--
Alan

--
Alan

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 2 months ago
Joined: 2006-01-06 21:27
RunDataLocally

RunDataLocally is for running from a CD drive, in which everything is copied to the TEMP directory first. Practically, the opposite of what you want Biggrin
----
Ryan McCue.
Blog.
So all that Airbus-delay trouble over here in Europe is because of YOU!
Simeon.

"If you're not part of the solution, you're part of the precipitate."

Log in or register to post comments