GateNLP / gate-core

The GATE Embedded core API and GATE Developer application
GNU Lesser General Public License v3.0
75 stars 29 forks source link

Can't uninstall #114

Closed Guiorgy closed 3 years ago

Guiorgy commented 4 years ago

Uninstalling from Apps & Features: error2 (Don't even know why it is searching for 211 when I have 241 installed)

Running gate-uninstaller.jar directly: error

log: izpack11894531965350300173.log

Guiorgy commented 4 years ago

I tried renaming C:\Program Files\Java\jre1.8.0_241 to jre1.8.0_211, and the uninstaller worked this time.

greenwoodma commented 4 years ago

Sounds like it's a bug in the installer that's hard coding the path to the java version used during install. Might need a fix in izpack itself rather than our configuration

greenwoodma commented 3 years ago

Having looked at this in more detail it would appear that the uninstaller registry entry is created pointing at the Java version used during the installation. That makes perfect sense as it's the only Java location the installer is aware of. The problem described here is that Java has since been upgraded and the old version removed. This leaves uninstaller link pointing at a directory which no longer exists. Unfortunately I can't see any sensible way around this, as we can't know about new Java versions in advance, and we can't assume there will be a version of Java on the path we can use.

johann-petrak commented 3 years ago

I am not sure I understand this: if Java gets upgraded or replaced with another Java, GATE cannot get uninstalled or do I misunderstand this? If Java gets upgraded or replaced, GATE itself will still continue to work though or not? (I think I just did that and it did in my case). How does gate.exe find the correct Java to run on Windows?

greenwoodma commented 3 years ago

The uninstaller works perfectly, it's just that the registry key that gets created when you install has a hard coded reference to the version of Java used during installation. So if you manually run the uninstaller jar (by double clicking or from the command line) it works fine, but if you use the add/remove application in control panel it will fail if you've removed the version of java used during installation. It's a pain but I can't see any solution that will work in all cases under windows, given we can't assume Java gets correctly added to the path.

This doesn't seem to affect gate.exe as far as I know so GATE will run even if you've upgraded Java.

Guiorgy commented 3 years ago

@greenwoodma, is using the %JAVA_HOME% environmental variable not an option? That one should always be pointing to a valid installation of java

greenwoodma commented 3 years ago

Is it always configured on Windows? I have a feeling adding the environment variables is an option in the installer (or was last time I used Windows) meaning it won't always be present. Even that's not guaranteed to point to either an existing or compatible java installation either, although I agree it might be a possible alternative.

Guiorgy commented 3 years ago

@greenwoodma, sorry, I have been using Liberica JDK for a long time now (which does update PATH & JAVA_HOME) and forgot it usually not updated. Is it possible to try testing JAVA_HOME and fallback to the previously known java if JAVA_HOME fails? Most who don't configure, probably won't bother updating java either, I think.

EDIT: Probably the most surefire solution would be, to not have the uninstaller java dependent, aka. write it natively? Or include a lightweight java runtime with GATE to be used by the uninstaller, and maybe GATE too as a fallback, incase java wasn't installed?

ianroberts commented 3 years ago

The code to register the uninstaller in the Windows registry to integrate with control panel is inside izpack (the toolkit that we use to build our installers), and it looks like the logic to use the Java that was used at install time is hard-coded in there (https://github.com/izpack/izpack/blob/master/izpack-event/src/main/java/com/izforge/izpack/event/RegistryInstallerListener.java#L600) so I suggest you open an issue on the izpack repo if you want this to change.