Opened 9 years ago

Last modified 7 years ago

#11390 closed enhancement

Switch to Java 8 — at Version 19

Reported by: Don-vip Owned by: team
Priority: major Milestone: 16.07
Component: Core Version:
Keywords: java8 Cc: stoecker, bastiK, simon04, skyper, Klumbumbus

Description (last modified by Don-vip)

This ticket is the successor of #8465 :)

Like for Java 7 two years ago, Oracle released their final versions of Java 7 (7u79 and 7u80), and the same auto-update feature for Windows and OSX users. We already have a significant majority of users who run JOSM with Java 8:

All users:

Java Main Version --> 6 (598,  4.3%) 7 (5128, 37.3%) 8 (8009, 58.2%) 9 (22,  0.2%)

Recent versions (>=7001):

Java Main Version --> 6 (37,  0.3%) 7 (4370, 35.7%) 8 (7818, 63.8%) 9 (22,  0.2%)
OS:  FreeBSD (2,  0.0%) Linux (2749, 22.6%) Mac (911,  7.5%) OpenBSD (1,  0.0%) SunOS (3,  0.0%) Windows (8500, 69.9%)

Java 7 users:

OS:  FreeBSD (2,  0.0%) Linux (2394, 49.5%) Mac (129,  2.7%) OpenBSD (3,  0.1%) SunOS (3,  0.1%) Windows (2310, 47.7%)

Java 8 users:

OS:  Linux (567,  7.1%) Mac (786,  9.9%) Windows (6613, 83.0%)

Linux is clearly behind. Main distributions of Java 7 users are:

O        251 ( 5.2%) Linux Debian GNU/Linux 8.0 (jessie)
O        157 ( 3.2%) Linux Mint 17.1 Rebecca
O        102 ( 2.1%) Linux Ubuntu 14.04.1 LTS
O        809 (16.7%) Linux Ubuntu 14.04.2 LTS
O        154 ( 3.2%) Linux Ubuntu 14.10
O        222 ( 4.6%) Linux Ubuntu 15.04

Java 8 is not yet available in Debian Jessie or Ubuntu LTS, but it will be released soon in Jessie backports then Trusty backports.

The transition will be easier than Java 7:

So, what's new?

Other useful links:

Proposed plan:

  1. Restore informative message "JOSM will soon no longer work with this version of Java..." on server side
  2. Ask OSX and Windows users to switch (revert/update this and this)
  3. Wait for Debian Jessie backport: done
  4. Wait for Ubuntu Trusty backport
  5. Ask Linux users to switch (revert/update of this)
  6. Switch about two months after that

Change History (19)

comment:1 by stoecker, 9 years ago

I think it's too early now in my eyes. But we can already think about a time-frame. A possible target could be that first version 2016 is Java 8? Maybe start Windows nagging in summer and Linux in autumn. That sounds like enough time.

For the Linux version I hope you remember the openSUSE Java 8 issues until few weeks ago and our resulting suggestion to use Java 7 instead.

Regarding the need for a switch - Is there anything where we say: "We want this" like it was for Java 7, which had a lot of useful new stuff?

comment:2 by bastiK, 9 years ago

I agree that it is too early to nag if there is no viable option for a Java upgrade.

Interesting new stuff:

  • Parallel sort could be used in StyledMapRenderer to speed up painting a little.
  • New JavaScript engine "Nashorn":
    With the "Rhino" engine in Java 7, I don't feel comfortable putting scripts on the wiki like we do for map styles and presets and allow unmoderated changes. It would be too easy to add malicious code which gains access to the user's file system and basically takes over the computer.
    In contrast, the new engine has a switch to turn off Java classes in JavaScript code entirely, so it looks as if it can be sandboxed and made air-tight.
    This means we can think of new uses of JavaScript in other parts of JOSM (currently used in CustomConfigurator for automated preference fixes).

in reply to:  1 comment:3 by Don-vip, 9 years ago

Description: modified (diff)

Replying to stoecker:

For the Linux version I hope you remember the openSUSE Java 8 issues until few weeks ago and our resulting suggestion to use Java 7 instead.

I totally forgot that, but I see the bug is fixed, so that's not a problem anymore.

Regarding the need for a switch - Is there anything where we say: "We want this" like it was for Java 7, which had a lot of useful new stuff?

Java 8 is a major release, there are a lot of good new stuff we can use:

  • Lambdas, method references, default and static interface methods: powerful new syntaxes allowing to write more compact code
  • Stream API: more compact code for iterations
  • Paraller sorting: improve performance
  • Predicate, Function: may replace/simplify our own Predicate and Function classes
  • Base64: may replace our own Base64 class
  • new Date/Time API: simplify all date-related stuff. May replace our DateUtils class
  • String joining: may replace Utils.join()
  • Optional parameters: may simplify null-handling
  • HTTP URL Permissions: may be useful to enforce imagery blacklist

Java 8 also contains:

  • new javascript engine for better performance
  • lot of security/crypto enhancements
  • Unicode/CLDR improvements

I'm sure there are even more stuff I did not see yet :)

comment:4 by stoecker, 9 years ago

Last points ... don't argue with stuff which a user with Java 8 gets also in case we don't switch our code base. That's unfair :-)

comment:5 by mdk, 9 years ago

I install josm and josm-latest from repository http://josm.openstreetmap.de/apt/
The dependencies are:
Depends: openjdk-7-jre
So even if I have installed Java8, always Java7 is used. That may be the reason, why Linux normally use Java 7.

Isn't there a possibility to define a dependency like "use any Java >=1.7"?
I found something like
Depends: java-runtime-headless (>= 1.7),
but I couldn’t test it.

Edit: If we need an complete JRE, perhaps something like
Depends: java-runtime (>= 7)
would work.

Last edited 9 years ago by mdk (previous) (diff)

comment:6 by Don-vip, 9 years ago

In 8317/josm:

see #11390 - accept openjdk-8-jre in Debian control file, prefer Java 8 runtime over Java 7 in launch script

comment:7 by mdk, 9 years ago

I updated to 8319, but it still uses Java Version 1.7.0_79.
Also the Package dependency is still openjdk-7-jre, even after reinstalling JOSM. Has ​the package definition really changed on http://josm.openstreetmap.de/apt/?

The start scripts /usr/bin/josm and /usr/bin/josm-latest have in line 14 a list of possible Java installations. In this list openjdk-8 (and oracle-9) are missing. So add:
/usr/lib/jvm/java-8-openjdk/bin/java /usr/lib/jvm/java-8-openjdk-$ARCH/bin/java /usr/lib/jvm/java-9-oracle/bin/java

But as fare as I understand /etc/alternatives/java is always preferred. As long as we follow the preferred Java version, we have to wait until Debian or other distributions will change this default to openjdk-8.

comment:8 by bastiK, 9 years ago

Please try the next version, an update on the server was missing.

comment:9 by Don-vip, 9 years ago

I wasn't sure if a commit was enough :) concerning java 9 I won't add it yet because it's way too early for that :)

comment:10 by stoecker, 9 years ago

Shouldn't it at least start when java 9 is there only? The openSUSE version only requests a minimum version, no max.

comment:11 by Don-vip, 9 years ago

The point is Java 9 is still in very early development phase and not expected until 2016 at best. We can wait a few months before supporting it officially :)

in reply to:  7 ; comment:12 by Don-vip, 9 years ago

Replying to mdk:

I updated to 8319, but it still uses Java Version 1.7.0_79.

Can you please try again now? I have rebuilt a new version (r8327).

in reply to:  10 comment:13 by Don-vip, 9 years ago

Replying to stoecker:

The openSUSE version only requests a minimum version, no max.

By the way OpenSUSE is not really the example to follow regarding how they messed up their packaging of Java 8 and the time they needed to fix it.

in reply to:  12 comment:14 by mdk, 9 years ago

Replying to Don-vip:

Can you please try again now? I have rebuilt a new version (r8327).

On a default Ubuntu 15.04 installation r8327 is still running with Java Version 1.7.0_79
Package is now requiring openjdk-7-jre | openjdk-8-jre (fixed)
/usr/bin/josm-latest now also checks for java-8-openjdk and java-8-openjdk-$ARCH (fixed)

But as long as I would not change the default Java with sudo update-alternatives --config java from

* 0            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1071      automatischer Modus

to

  4            /usr/lib/jvm/java-8-openjdk-i386/jre/bin/java   1069      manueller Modus

I have to wait for Ubuntu to change the default or manually override.
When I change the default Java to option 4, JOSM runs with Java Version 1.8.0_45-internal.

As Java 7 is not longer supported with bug fixes, I hope the Linux distributions will change the default Java version recently.

But for all people which not want to tweak their installation, we have to wait ...

Last edited 9 years ago by mdk (previous) (diff)

comment:15 by Don-vip, 9 years ago

Ok thanks. Java 7 on Linux should still receive security updates backported from openjdk8.

comment:16 by Don-vip, 9 years ago

In 8333/josm:

see #11390 - prefer Java 8 runtime over Java 7 in launch script

comment:17 by mdk, 9 years ago

r8333: Now JOSM uses java 8 even if Debian alternatives is configured to openjdk-7.
I think this overruling is ok.

So the users of repository ​http://josm.openstreetmap.de/apt/ will now switch to openjdk-8, if installed.

Does anybody has influence on JOSM packages for Debian, Ubuntu or other distributions? They often use quite old versions.

Actual supported Ubuntu versions are:

  • 12.04 (LTS): JOSM 4878
  • 14.04 (LTS): JOSM 6502
  • 14.10: JOSM 6502
  • 15.04: JOSM 7995
  • 15.10 (planed): JOSM 7995

Debian uses:

  • squeeze (oldoldstable): JOSM 3376
  • wheezy (oldstable): JOSM 5267
  • jessie (stable): JOSM 7643
  • stretch (testing): JOSM 7643
  • sid (unstable): JOSM 7643
  • experimental (rc-buggy): JOSM 8159

Should we invite Ubuntu users (which use JOSM from universe) to add repository on openstreetmap.de instead of some manually update or installation?

Last edited 9 years ago by mdk (previous) (diff)

in reply to:  17 comment:18 by Don-vip, 9 years ago

Replying to mdk:

r8333: Now JOSM uses java 8 even if Debian alternatives is configured to openjdk-7.
I think this overruling is ok.

I think too.

Does anybody has influence on JOSM packages for Debian, Ubuntu or other distributions? They often use quite old versions.

There is no backport for old distribs but Sebastian does a great job to keep up to date the Debian package in the experimental branch, which can be reused by Ubuntu.

Should we invite Ubuntu users (which use JOSM from universe) to add repository on openstreetmap.de instead of some manually update or installation?

I don't think this is needed. There's still time to see if Ubuntu 15.10 switches to Java 8 by default. I hope Wheezy, Jessie and Trusty will have openjdk8 backported before that.

comment:19 by Don-vip, 9 years ago

Description: modified (diff)

Status update:

Good news is that it includes OpenJFX. So maybe we could try to give a look to JavaFX as well.

Note: See TracTickets for help on using tickets.