FS#73773 - [josm] Unrecognized option with Java 8

Attached to Project: Community Packages
Opened by Giovanni Harting (IdleGandalf) - Sunday, 13 February 2022, 14:47 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:03 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Jaroslav Lichtblau (Dragonlord)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

JOSM does not start with Java 8. Works fine with 11.

Unrecognized option: --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED

Steps to reproduce: Try to start JOSM with Java 8.

josm 18360-2
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:03 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/josm/issues/2
Comment by Cj Malone (CjMalone) - Friday, 18 February 2022, 00:17 GMT
I've just encountered this too after upgraded josm from 18360-1 to 18360-2.

18360-2 added `JOSM_ARGS="--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED"` to `/etc/conf.d/josm`, commenting out that line fixes it.

https://josm.openstreetmap.de/ticket/21649
https://bugs.archlinux.org/task/72953
Comment by Jaroslav Lichtblau (Dragonlord) - Saturday, 26 February 2022, 11:48 GMT
Fixed in josm 18360-3
Comment by NicoHood (NicoHood) - Sunday, 29 May 2022, 07:13 GMT
The issue still exists with 18427-1. I've verified that I am using the package config file:

```
#
# Parameters for JOSM editor
#
#JOSM_ARGS="-Xmx800M"

# FS#72953  https://bugs.archlinux.org/task/72953
JOSM_ARGS="--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED"
```

This is my java version:
```
$ java -version
openjdk version "1.8.0_332"
OpenJDK Runtime Environment (build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode)
```

And this is the error:
```
$ josm
Unrecognized option: --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
```

I also want to note, that the package is **sourcing** the config file. This can be a security issue, I am very uncomfortable with this in the PKGBUILD:
`[ -f /etc/conf.d/josm ] && . /etc/conf.d/josm`
Comment by Nick (nickoe) - Sunday, 19 June 2022, 21:37 GMT
Any news about this issue? I am still seeing this on josm 18463-1 as well.
Comment by Cj Malone (CjMalone) - Monday, 04 July 2022, 07:34 GMT
I think the fix by @Dragonlord was to deprecate this package working with Java 8, this package only works with 11 and up.

Seems weird that pacman didn't update it for us though.
Comment by NicoHood (NicoHood) - Monday, 04 July 2022, 10:44 GMT
I have java 8 and jre-openjdk installed (currently 18). I think that pacman treated the dependency as satisfied, but my default jre is still java 8.

```
$ archlinux-java status
Available Java environments:
java-11-openjdk
java-18-openjdk
java-8-openjdk (default)
```

I think we need to prepend the other versions to the PATH variable when running josm:
https://wiki.archlinux.org/title/java#Launching_an_application_with_the_non-default_java_version

Maybe like this:
export PATH="/usr/lib/jvm/java-18-openjdk/bin/:/usr/lib/jvm/java-17-openjdk/bin/:/usr/lib/jvm/java-11-openjdk/bin/:$PATH"

For me this works. You can try it out in a simple bash and run `josm` afterwards.
Comment by Taylor S (vorpalblade) - Friday, 19 August 2022, 23:11 GMT
JOSM core dev here:
The problem is that JOSM maintains compatibility with Java 8+, and our official start script does a version check to figure out what options need to be passed to the launcher. I fairly recently did some work to make that script non-Debian specific, just so that other distributions (like Arch) could use it, instead of doing what happened here.

See my comment on #72953 for my suggested fix.

Loading...