Opened 9 years ago

Last modified 7 years ago

#11390 closed enhancement

Switch to Java 8 — at Version 33

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:

  • Java 8 is available and stable on all platforms
  • There's no need this time to build a new package for OSX
  • JOSM is built and tested daily with Java 8 for quite some time. It works fine and there's even a large performance gain in rendering: see Java 7 results vs Java 8 results

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): done in r8923
  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 (33)

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.

comment:20 by Don-vip, 9 years ago

For those interested, Oracle offers a free 3-week MOOC on Java 8 / Lambdas:

https://apexapps.oracle.com/pls/apex/f?p=44785:145:0::::P145_EVENT_ID,P145_PREV_PAGE:4887,143

comment:21 by shinigami, 9 years ago

So, is it time to move to jdk8?:)

comment:22 by bastiK, 9 years ago

Currently 62% of all JOSM users are running with Java 8.

I feel that the PPA for Ubuntu 14.04 is not really a great solution, but would be a measure of last resort. Personally, I'd rather install the Oracle package.

The conservative approach is to wait until openjdk8 is included in the official backport repository of Ubuntu 14.04 ( ticket) or until the next LTS version is released in April 2006 (whatever comes first). But I'm not sure you guys what to wait that long. ;)

comment:23 by Don-vip, 9 years ago

Agreed with bastiK, I don't want to force Ubuntu users to install a PPA. And I'd like to have some progress from Oracle on these bugs before switching:

comment:24 by Don-vip, 9 years ago

Milestone: 16.04

Java 8 is now used by 65% of all JOSM users.

It's however very unlikely to see Java 8 become available for Ubuntu 14.04 LTS. The ticket is starving for more than a year, clearly Canonical doesn't give a shit about Java.

So I target the code migration to April 2016, in coincidence with the availability of the next LTS.

To ensure a smooth migration, I'll however implement the migration suggestion for Windows and OSX users, like previously for Java 7. They really need to switch anyway because Oracle does not provide binaries anymore since April 2015, so they do not receive security fixes.

I have joined the Quality Outreach OpenJDK project and will use JavaBugs as a coordinating wiki page with Oracle. I hope it will have a benefic impact on the resolution of our bug reports.

comment:25 by Don-vip, 9 years ago

In 8923/josm:

see #11390 - invite Windows and OSX users to update to Java 8

in reply to:  25 comment:26 by rickmastfan67, 9 years ago

Replying to Don-vip:

In 8923/josm:

see #11390 - invite Windows and OSX users to update to Java 8

Is there any way to add an 'OK' button so that we can select an option in the dialog without having to hit the 'Update Java' button and have our browser open up to Java's website?

comment:27 by Don-vip, 9 years ago

of course :)

comment:28 by Don-vip, 9 years ago

In 8934/josm:

see #11390 - rework update dialog

comment:29 by mdk, 8 years ago

Is it correct, that actually JSOM starts by default again with Java 7 inseat of 8? I testet it with actually josm-latest (9062) and the stable version (9060).

comment:30 by Don-vip, 8 years ago

No. Did you set a JAVA_HOME? Can you please look if a path on your system would be missing from r8970?

in reply to:  30 comment:31 by mdk, 8 years ago

I din't change anything at JAVA_HOME. I just update Java 7 and JOSM on my Ubuntu system.

But I try to analyse the start script and I don't understad it compleatly:
ALTERNATIVE_JDK contains /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java
and JAVA_CMDS contains:

/bin/java 
/usr/lib/jvm/java-8-openjdk/bin/java 
/usr/lib/jvm/java-8-openjdk-i386/bin/java 
/usr/lib/jvm/java-8-oracle/bin/java 
/usr/lib/jvm/java-7-openjdk/bin/java 
/usr/lib/jvm/java-7-openjdk-i386/bin/java 
/usr/lib/jvm/java-7-oracle/bin/java 
/usr/lib/jvm/java-9-openjdk/bin/java 
/usr/lib/jvm/java-9-openjdk-i386/bin/java 
/usr/lib/jvm/java-9-oracle/bin/java

After the first loop (with if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then}) JAVACMD contains /usr/lib/jvm/java-7-openjdk-i386/bin/java, so the second loop is skipt and ends with
Using /usr/lib/jvm/java-7-openjdk-i386/bin/java to execute josm-latest.

But also /usr/lib/jvm/java-8-openjdk-i386/bin/java exists in my system but is not choosen (has to do with ALTERNATIVE_JDK?).

When I remove the first loop, the second one (with if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then) returns the correct
Using /usr/lib/jvm/java-8-openjdk-i386/bin/java to execute josm-latest.

comment:32 by Don-vip, 8 years ago

In 9066/josm:

see #11390 - drop support for ALTERNATIVE_JDK in Debian startup scripts

comment:33 by Don-vip, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.