OpenJFX on Apple M1 chip - macos

Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
Exception in thread "main" java.lang.RuntimeException: No toolkit found
I am trying to make OpenJFX to work on Apple MacOS Silicon M1 chip.
I use Gradle and it includes:
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.9'
}
javafx {
sdk = '/Users/eosantigen/Documents/javafx-sdk-16'
modules = ['javafx.controls']
}
but I get the error above when I do gradle run. I also use JDK11. I also get the same error on the official tutorial.
Anyone made it work with Gradle? Or Maven?
Thanks.

UPDATE:
Finally, I have tried OpenJDK 17 (installed through SDKman, as usual), with the following in build.gradle:
plugins {
id 'application'
id "org.javamodularity.moduleplugin" version "1.8.10"
id 'org.openjfx.javafxplugin' version '0.0.12'
}
javafx {
version = '17'
modules = ['javafx.controls']
}
And it runs perfectly. (didn't try jdk-11 again with it.)

Related

Getting error building a gradle project: An exception occurred applying plugin request [id: 'org.jetbrains.intellij', version: '1.5.2']

I am getting the next error message when I build a gradle project (gradle build):
An exception occurred applying plugin request [id: 'org.jetbrains.intellij', version: '1.5.2']
> Failed to apply plugin [id 'org.jetbrains.intellij']
> Could not create an instance of type org.jetbrains.intellij.utils.ArchiveUtils.
> Could not generate a decorated class for type ArchiveUtils.
> org/gradle/api/file/ArchiveOperations
My plugin section looks like this:
plugins {
id 'org.jetbrains.intellij' version '1.5.2'
id 'jacoco'
id 'groovy'
id 'signing'
id 'maven-publish'
}
I am using java version 11 and gradle 7.6. Not sure at this moment what is happening. I didn't find enough info regarding this error.
Any ideas?
Thanks!

Updating Gradle docker plugin failing with latest version 6.7.0

How to fix this error while updating gradle docker plugin:
Error:
Caused by: groovy.lang.MissingPropertyException: No such property: parentFile for class: org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultRegularFileVar
Gradle: 7.5
Java: 1.8
application: spring-boot
Instead of
createDockerfile.destFile.parentFile
You should use
createDockerfile.getDestDir()

Failed to apply plugin 'no.nils.wsdl2java'. Configuration with name 'compile' not found

when migrating to gradle 7.x getting below error
* What went wrong:
An exception occurred applying plugin request [id: 'no.nils.wsdl2java', version: '0.12']
> Failed to apply plugin 'no.nils.wsdl2java'.
> Configuration with name 'compile' not found.
Below is wsdl2java added in build.gradle
plugins {
id("no.nils.wsdl2java") version "0.12"
`java-library`
}
buildscript {
dependencies {
classpath("no.nils:wsdl2java:0.12")
}
}
how to fix this?
no.nils.wsdl2java is not compatible with Gradle 7 and is no longer maintained. See the README in the project. The compile configuration has long been deprecated and was finally removed in Gradle 7.
You can use io.mateo.cxf-codegen in place of no.nils.wsdl2java. It is a Gradle port of the Maven CXF codegen plugin.
plugins {
id "io.mateo.cxf-codegen" version "1.0.1"
}
https://github.com/ciscoo/cxf-codegen-gradle
https://ciscoo.github.io/cxf-codegen-gradle/docs/current/user-guide/
Note, I am the author of the plugin.

Firebase admin sdk dependency on gradle causing boot layer error

I'm trying to build a desktop app using javafx for extracting data from pdf and save the content as json in firebase. Adding the firebase admin sdk dependency on gradle causes build error. But it is working with maven projects.
I've created the gradle project using this guide- https://openjfx.io/openjfx-docs/#IDE-Intellij and for firebase admin sdk I've followed the official docs.But it keeps creating ResolutionException and mentions some modules.Adding dependencies or jars for those modules causes more module exceptions. I'm trying to avoid maven as it causes some conflicts with javafx which I also couldn't solve.
This is my current build.gradle file:
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
}
group 'com.tiptoptips'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.google.firebase:firebase-admin:6.7.0'
}
javafx {
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
mainClassName = 'com.tiptoptips.MainApp'
and here is the error I get while running or building this project-
> Task :run FAILED
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules proto.google.common.protos
and gax.grpc export package com.google.longrunning to module
javafx.graphicsEmpty
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Is there anything I'm doing wrong?
After about 4 days research, I found a way to solve it. I had to download the javafx-11 libs manually and add it to the project using vm options. I had to add javafx.controls and javafx.fxml manually. Then re-adding the firebase admin sdk into the gradle worked fine. I still couldn't get why intellij was showing firebase is missing module instead of locating the javafx files. Complete details can be found here- https://openjfx.io/openjfx-docs/#install-javafx

gradle: could not find method apply<>

I am trying to create a build script using gradle to build a android project and using plugins from eclipse and android but it doesnt seem to work and failes with the following error when I run gradle eclipse:
* What went wrong:
A problem occurred evaluating root project 'RssUnified'.
Cause: Could not find method apply() for arguments [{plugin=eclipse}] on root project 'RssUnified'.
Here is my build script:
//apply eclipse plugin
apply plugin: 'eclipse'
//apply android plugin
apply plugin: 'android'
task hello << {
String value = 'wagwan'
println 'Hello world!' + value.toUpperCase()
}
//setup external dependancy plugins we will use to build a android application
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.1'
}
Gradle exception thrown below:
Exception in thread "main" java.lang.NoClassDefFoundError: org/gradle/BootstrapMain
Caused by: java.lang.ClassNotFoundException: org.gradle.BootstrapMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.gradle.BootstrapMain. Program will exit.
I downloaded full gradle version from this link: http://www.gradle.org/downloads
Version 0.8 did not support the apply syntax for plugins yet. Starting with version 0.9 the apply method was introduced. A similar issue is described in this post.
Version 0.8 is pretty old. I'd highly recommend upgrading to the latest version of Gradle. That should definitely fix your problem.

Resources