[PATCH] Add support for Java 11

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Add support for Java 11

Roger Leigh-2
Hello,

In order to get support in place before its release in a few months, the
attached patch adds support for Java 11 (Oracle and OpenJDK).

By the way, the current download at
http://wsr.imagej.net/distros/cross-platform/ij152.zip is 1.52a while
the current patch version is 1.52c.  1.52a won't work with Bio-Formats
on Ubuntu 18.04 and other systems where Java 10 is the default JRE (the
IJ.isJava17() function returns false incorrectly).  If it would be
possible to update it to 1.52c at some point, it might save some
confusing bug reports!


  From e55f819082edab1267a633c9070bfcc14100268b Mon Sep 17 00:00:00 2001
From: Roger Leigh <[hidden email]>
Date: Mon, 11 Jun 2018 11:36:03 +0100
Subject: [PATCH] IJ: Support Java 11

---
   ij/IJ.java | 14 +++++++++++++-
   1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/ij/IJ.java b/ij/IJ.java
index 203dd32..f14f92e 100644
--- a/ij/IJ.java
+++ b/ij/IJ.java
@@ -77,7 +77,9 @@ public class IJ {
                isMac = !isWin && osname.startsWith("Mac");
                isLinux = osname.startsWith("Linux");
                String version = System.getProperty("java.version");
-               if (version.startsWith("10"))
+               if (version.startsWith("11"))
+                        javaVersion = 11;
+               else if (version.startsWith("10"))
                        javaVersion = 10;
                else if (version.startsWith("1.9")||version.startsWith("9"))
                        javaVersion = 9;
@@ -997,6 +999,16 @@ public class IJ {
                return javaVersion >= 9;
        }

+       /** Returns true if ImageJ is running on a Java 1.10 or greater JVM. */
+       public static boolean isJava110() {
+               return javaVersion >= 10;
+       }
+
+       /** Returns true if ImageJ is running on a Java 1.11 or greater JVM. */
+       public static boolean isJava111() {
+               return javaVersion >= 11;
+       }
+
        /** Returns true if ImageJ is running on Linux. */
        public static boolean isLinux() {
                return isLinux;
--
2.17.0




Thanks,
Roger



The University of Dundee is a registered Scottish Charity, No: SC015096

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Add support for Java 11

Wayne Rasband-2
> On Jun 11, 2018, at 12:19 PM, Roger Leigh <[hidden email]> wrote:
>
> Hello,
>
> In order to get support in place before its release in a few months, the
> attached patch adds support for Java 11 (Oracle and OpenJDK).

The IJ.javaVersion() method in the latest build works with Java 11. The daily build does not have a isJava11() method. Instead, use IJ.javaVersion()>=11.

> By the way, the current download at
> http://wsr.imagej.net/distros/cross-platform/ij152.zip is 1.52a while
> the current patch version is 1.52c.

I updated the cross-platform distribution to 1.52d.

-wayne


> 1.52a won't work with Bio-Formats
> on Ubuntu 18.04 and other systems where Java 10 is the default JRE (the
> IJ.isJava17() function returns false incorrectly).  If it would be
> possible to update it to 1.52c at some point, it might save some
> confusing bug reports!
>
>
> From e55f819082edab1267a633c9070bfcc14100268b Mon Sep 17 00:00:00 2001
> From: Roger Leigh <[hidden email]>
> Date: Mon, 11 Jun 2018 11:36:03 +0100
> Subject: [PATCH] IJ: Support Java 11
>
> ---
>  ij/IJ.java | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/ij/IJ.java b/ij/IJ.java
> index 203dd32..f14f92e 100644
> --- a/ij/IJ.java
> +++ b/ij/IJ.java
> @@ -77,7 +77,9 @@ public class IJ {
>               isMac = !isWin && osname.startsWith("Mac");
>               isLinux = osname.startsWith("Linux");
>               String version = System.getProperty("java.version");
> -               if (version.startsWith("10"))
> +               if (version.startsWith("11"))
> +                        javaVersion = 11;
> +               else if (version.startsWith("10"))
>                       javaVersion = 10;
>               else if (version.startsWith("1.9")||version.startsWith("9"))
>                       javaVersion = 9;
> @@ -997,6 +999,16 @@ public class IJ {
>               return javaVersion >= 9;
>       }
>
> +       /** Returns true if ImageJ is running on a Java 1.10 or greater JVM. */
> +       public static boolean isJava110() {
> +               return javaVersion >= 10;
> +       }
> +
> +       /** Returns true if ImageJ is running on a Java 1.11 or greater JVM. */
> +       public static boolean isJava111() {
> +               return javaVersion >= 11;
> +       }
> +
>       /** Returns true if ImageJ is running on Linux. */
>       public static boolean isLinux() {
>               return isLinux;
> --
> 2.17.0
>
>
>
>
> Thanks,
> Roger
>
>
>
> The University of Dundee is a registered Scottish Charity, No: SC015096

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Add support for Java 11

Roger Leigh-2
On 11/06/18 21:05, Wayne Rasband wrote:

>> On Jun 11, 2018, at 12:19 PM, Roger Leigh <[hidden email]> wrote:
>>
>> Hello,
>>
>> In order to get support in place before its release in a few months, the
>> attached patch adds support for Java 11 (Oracle and OpenJDK).
>
> The IJ.javaVersion() method in the latest build works with Java 11. The daily build does not have a isJava11() method. Instead, use IJ.javaVersion()>=11.
>
>> By the way, the current download at
>> http://wsr.imagej.net/distros/cross-platform/ij152.zip is 1.52a while
>> the current patch version is 1.52c.
>
> I updated the cross-platform distribution to 1.52d.

Thanks, much appreciated!


Roger

The University of Dundee is a registered Scottish Charity, No: SC015096

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html