Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded to Gradle 8.4 JDK 21.0.1 & OpenJFX 21.0.1 #78

Conversation

carldea
Copy link

@carldea carldea commented Nov 16, 2023

Hello Jonathan,

Scenic View is now able to run on Java 21.0.1 & JavaFX 21.0.1.
I just bypassed Java 17 LTS.

Got rid of warnings and updated deprecated items.

Let me know what you think.

Thank you,
Carl

ReadMe.md Outdated
@@ -28,13 +28,13 @@ Scenic View has releases for JDK 8, JDK 9, and JDK 11:

For more information about JavaFX 11, see https://openjfx.io/openjfx-docs/.

## Scenic View for JDK 11+
## Scenic View for JDK 21+
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused - why are we increasing the baseline like this? What about people using earlier JDK versions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change it back to JDK 11. I'm assuming things will work successfully.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - let's do the minimum necessary to support JDK 21, without breaking anything for people on earlier versions?

@@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
java: [11.0.15]
java: [21.0.1]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to add JDK 21 to the matrix, which includes the latest 11 and 17 releases as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locally I switch to Java 11.0.21 and getting some build errors:
❯ gradle build

FAILURE: Build failed with an exception.

  • What went wrong:
    java.lang.UnsupportedClassVersionError: org/beryx/jlink/JlinkPlugin has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

org/beryx/jlink/JlinkPlugin has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Not sure if I bumped up the jlinkplugin. If so, i may need to back it down. Let me know what you think.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JonathanGiles

plugins {
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.1.0'
    id 'org.beryx.jlink' version '2.6.5'
}

I backed down the jlink plugin version to 2.6.5 and now i'm getting the following:

scenic-view on  feature/upgrade-gradle-8.4-jdk-21.0.1-jfx-21.0.1 [!] via 🅶 v8.4 via ☕ v11.0.15 
❯ gradle build

> Task :compileJava FAILED
error: cannot access module-info
  bad class file: /Users/cardea/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-fxml/21.0.1/df5bbec9970f5efa2756b87da69c8f89529f4b56/javafx-fxml-21.0.1-mac-aarch64.jar(/module-info.class)
    class file has wrong version 61.0, should be 55.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
/Users/cardea/projects/scenic-view/src/main/java/module-info.java:18: error: module not found: javafx.fxml
module org.scenicview.scenicview {
^
2 errors

FAILURE: Build failed with an exception.

Any ideas why?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to add JDK 21 to the matrix, which includes the latest 11 and 17 releases as well.

Will do, but once i am able to build with 11. Maybe 17 too. LTS.

Copy link
Author

@carldea carldea Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To build successfully I used JDK 17.0.9.
Since the following settings makes the target version at 11, should this be sufficient?

java {
   sourceCompatibility = '11'
   targetCompatibility = '11'
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jonathan,
After building and running I'm getting a runtime exception regarding a java.instrument module but the application still runs fine.

❯ java --module-path ~/Tools/javafx-sdk-21.0.1/lib --add-modules javafx.web,javafx.fxml,javafx.swing,java.instrument -jar build/libs/scenicview.jar
Platform running
Launching ScenicView v21.0.1
Startup done
Creating server
Server done
Number of running Java applications found: 13
Obtaining properties for Java application with PID:12450
Obtaining properties for Java application with PID:10917
Obtaining properties for Java application with PID:3429
Obtaining properties for Java application with PID:3308
Obtaining properties for Java application with PID:3343
Obtaining properties for Java application with PID:9650
Obtaining properties for Java application with PID:10136
Obtaining properties for Java application with PID:14136
Obtaining properties for Java application with PID:14137
Obtaining properties for Java application with PID:2875
Obtaining properties for Java application with PID:14396
Obtaining properties for Java application with PID:2876
2 JavaFX applications found
Loading agent from: /Users/cardea/projects/scenic-view/build/libs/scenicview.jar
Loading agent for:sun.tools.attach.AttachProviderImpl@3efdde08: 2875 ID:2875 on port:7560 took:3ms using agent defined in /Users/cardea/projects/scenic-view/build/libs/scenicview.jar
Loading agent for:sun.tools.attach.AttachProviderImpl@3efdde08: 14137 ID:14137 on port:7562 took:7ms using agent defined in /Users/cardea/projects/scenic-view/build/libs/scenicview.jar
com.sun.tools.attach.AgentLoadException: Failed to load agent library: java.lang.module.FindException: Module java.instrument not found
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.processCompletionStatus(HotSpotVirtualMachine.java:409)
        at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(VirtualMachineImpl.java:183)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(HotSpotVirtualMachine.java:99)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(HotSpotVirtualMachine.java:124)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:152)
        at org.fxconnector.remote.RemoteConnectorImpl.loadAgent(RemoteConnectorImpl.java:350)
        at org.fxconnector.remote.RemoteConnectorImpl$3.run(RemoteConnectorImpl.java:284)
Remote agent started on port:7562
RemoteApp connected on:7558 stageID:StageID [appID=14137, stageID=1524442140, name=null]
com.sun.tools.attach.AgentLoadException: Failed to load agent library: java.lang.module.FindException: Module java.instrument not found
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.processCompletionStatus(HotSpotVirtualMachine.java:409)
        at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(VirtualMachineImpl.java:183)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(HotSpotVirtualMachine.java:99)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(HotSpotVirtualMachine.java:124)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:152)
        at org.fxconnector.remote.RemoteConnectorImpl.loadAgent(RemoteConnectorImpl.java:350)
        at org.fxconnector.remote.RemoteConnectorImpl$3.run(RemoteConnectorImpl.java:284)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot invoke "javafx.scene.control.TreeItem.getChildren()" because "this.apps" is null

Ready for review.
Build will target Java 11 compatibility.

Copy link
Owner

@JonathanGiles JonathanGiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you've tweaked these changes, I'll hook the build system back up in GitHub Actions and get it publishing builds again.

@JonathanGiles
Copy link
Owner

This PR will also replace #76 and #64

Copy link
Owner

@JonathanGiles JonathanGiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge it and see how it goes on my machine.

@JonathanGiles JonathanGiles merged commit 46d48dd into JonathanGiles:master Jan 16, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants