Hatch can't find Java if it isn't in the system path

Bug #1743604 reported by Terran McCanna
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned

Bug Description

We are now live on 3.0.2:

Hatch is causing 'white screen of death' on Windows 7 32-bit machines (and one report of a Windows 8 32-bit machine). Windows 7 64-bit machines are okay.

I've verified in all cases that Java is up to date and the 0.1.4 version of Hatch program and Hatch Chrome extension are in place.

A typical console error is attached.

Revision history for this message
Terran McCanna (tmccanna) wrote :
Revision history for this message
Terran McCanna (tmccanna) wrote :

Follow up - this is not happening on ALL 32-bit machines, we were able to get one running on a new Win 7 32-bit install on a test machine.

Revision history for this message
Ben Dudley (pcdudley) wrote :

This problem occurs on both Windows 32-bit and 64-bit due to Hatch not being able to find java.exe. Batch file hatch.bat is expecting java.exe to be in the same directory with it (see lines 5-8 of hatch.bat).

Windows machines with a PATH system variable set (example: "C:\ProgramData\Oracle\Java\javapath") work without issues since hatch.bat is able to find java.exe from any working directory.

Moving java.exe to the same directory with hatch.bat or adding Java's path (C:\ProgramData\Oracle\Java\javapath) to PATH system variables enables Hatch to work.

Copying java.exe to the same directory with hatch.bat would create a potential security risk since java.exe would not be updated with future Java security patches.

The best fix would be for hatch.bat to look for java.exe in %programdata%\Oracle\Java\javapath if its path is not set in PATH system variables.

Revision history for this message
Jason Boyer (jboyer) wrote :

Here's a branch that does some very basic testing to see if it can find the correct Java path:
http://git.evergreen-ils.org/?p=working/Hatch.git;a=shortlog;h=refs/heads/user/jboyer/lp-1743604-java-path

This requires some care because you can't perturb stdin while trying things, but --dry-run comes to the rescue there.

To test:

Build and install version 0.1.5 from this branch.
Remove Java from your path
- Get to the PC Properties by opening a File Explorer window, right-click This PC, choose Properties
- Click Advanced system settings on the left side of the window
- Click the Environment Variables button
- In the System Variables box, click Path then click Edit...
- I'm not certain what you'll see next. Windows 10 offers a list of directories on single lines, other versions just offer a dialog box with a text box in it. Somehow remove %ProgramData%\Oracle\Java\javapath and save the new version.
Open Chrome, log in to a web client and try to configure the print settings
If you see any printers in the list, success!
Put that path back where it belongs and you're done.

Jason Boyer (jboyer)
summary: - Hatch not working on 32-bit Windows machines
+ Hatch can't find Java if it isn't in the system path
tags: added: pullrequest
Revision history for this message
Chris Sharp (chrissharp123) wrote :

Jason,

I just tested this and found that the --dry-run option was not working for me. I got "Unrecognized option: --dry-run". Changing that test to just "%JAVA% --version 2>nul" worked well and allowed the batch script to complete and Hatch to run successfully.

Revision history for this message
Chris Sharp (chrissharp123) wrote :
Revision history for this message
Jason Boyer (jboyer) wrote :

What version were you testing on? I didn't have a good idea of when --dry-run showed up.

Though you do raise a good point; we don't actually have to have it test load Hatch (That's what dry run does, set everything up as if it's going to run normally but never actually calls the Java equivalent of main()) just pulling the version should suffice (and may be slightly quicker!)

Revision history for this message
Chris Sharp (chrissharp123) wrote :

My test was on 32-bit Windows 7 running Java JRE 1.8.0_161.

Revision history for this message
Jason Boyer (jboyer) wrote :

Thanks Chris! I initially missed the difference between -version and --version. "Who would ever want to output normal output to stderr? Ohhhhh!"

Let's do that:

http://git.evergreen-ils.org/?p=working/Hatch.git;a=shortlog;h=refs/heads/user/jboyer/lp-1743604-java-path-signoff

tags: added: signedoff
Revision history for this message
Chris Sharp (chrissharp123) wrote :

Oops - I had a typo in comment #5 above ("--version") - sorry if that muddied the water!

Revision history for this message
Galen Charlton (gmc) wrote :

Looks good to me. Pushed to Hatch master. Thanks, Chris and Jason!

Changed in evergreen:
milestone: none → 3.0.4
milestone: 3.0.4 → none
status: New → Fix Committed
importance: Undecided → Medium
Revision history for this message
Bill Erickson (berick) wrote :

Hatch exe and chrome store updated based on this new code. Thanks, everyone.

Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.