processing / processing/processing4

Building processing throws `UnsupportedClassVersionError` in `:core:examples:Basic.main()`

Ouverte
#1,428 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Java
Étoiles
494
Forks
183
Merge moyen
4 h 39 min
PR mergées (30 j)
3

Description

I try to build processing with a clean clone of the repository.

Following the build instructions:
https://github.com/processing/processing4/blob/main/BUILD.md

1

The run button doesn't work in IntelliJ:

13:23:05: Executing ':core:examples:Basic.main()'…

Task :plugins:library:checkKotlinGradlePluginConfigurationErrors SKIPPED
Task :plugins:library:compileKotlin UP-TO-DATE
Task :plugins:library:compileJava NO-SOURCE
Task :plugins:library:pluginDescriptors UP-TO-DATE
Task :plugins:library:processResources UP-TO-DATE
Task :plugins:library:classes UP-TO-DATE
Task :plugins:library:jar UP-TO-DATE
Task :core:checkKotlinGradlePluginConfigurationErrors SKIPPED
Task :core:compileKotlin NO-SOURCE

Task :core:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Task :core:processResources
Task :core:classes
Task :core:jar

Task :core:examples:compileJava

Task :core:examples:processResources NO-SOURCE
Task :core:examples:classes
Note: /Users/doeke/Documents/processing4-w_branches/core/examples/src/main/java/Basic.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Task :core:examples:Basic.main() FAILED
[Incubating] Problems report is available at: file:///Users/doeke/Documents/processing4-w_branches/.build/reports/problems/problems-report.html
9 actionable tasks: 5 executed, 4 up-to-date
Error: LinkageError occurred while loading main class Basic
java.lang.UnsupportedClassVersionError: Basic has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':core:examples:Basic.main()'.

Process 'command '/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 2s
13:23:08: Execution finished ':core:examples:Basic.main()'.

Which is triggered by: Runtime.getRuntime().exec("echo Hello World");

If I comment out those lines then I get:

17:06:15: Executing ':core:examples:Basic.main()'…

Task :plugins:library:checkKotlinGradlePluginConfigurationErrors SKIPPED
Task :plugins:library:compileKotlin UP-TO-DATE
Task :plugins:library:compileJava NO-SOURCE
Task :plugins:library:pluginDescriptors UP-TO-DATE
Task :plugins:library:processResources UP-TO-DATE
Task :plugins:library:classes UP-TO-DATE
Task :plugins:library:jar UP-TO-DATE
Task :core:checkKotlinGradlePluginConfigurationErrors SKIPPED
Task :core:compileKotlin NO-SOURCE
Task :core:compileJava UP-TO-DATE
Task :core:processResources UP-TO-DATE
Task :core:classes UP-TO-DATE
Task :core:jar UP-TO-DATE
Task :core:examples:compileJava
Task :core:examples:processResources NO-SOURCE
Task :core:examples:classes

Task :core:examples:Basic.main() FAILED
9 actionable tasks: 2 executed, 7 up-to-date
Error: LinkageError occurred while loading main class Basic
java.lang.UnsupportedClassVersionError: Basic has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':core:examples:Basic.main()'.

Process 'command '/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 872ms
17:06:16: Execution finished ':core:examples:Basic.main()'.

And so on...
Also if I check the module settings in IntelliJ then they default to 21 for me.
Upon checking the gradle files I see nowhere something among the lines of:

languageVersion = JavaLanguageVersion.of(17)

It seems like whoever made processing move away from maven to gradle had only JDK 17 installed.
I don't want to dig deeper cause I simply don't have the time but it would be nice if some housekeeping would take place.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par BUILD.md et les fichiers Gradle, puis reproduisez :core:examples:Basic.main() avec le runtime JDK 17 indiqué. Déterminez pourquoi Basic est compilé comme un fichier de classe de version 65 alors qu’il s’exécute sur un runtime qui ne prend en charge que la version 61 ; le travail est terminé lorsque le build documenté et l’exécution de l’exemple fonctionnent sans UnsupportedClassVersionError.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
build-system
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.