redhat-developer / redhat-developer/vscode-java
java is not on the classpath message in a non-Android Gradle project
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 546
- Merge medio
- 20h 1m
- PR unite (30g)
- 11
Descrizione
The error is:
.java is not on the classpath of project xxxx, only syntax errors are reported
Environment
- Operating System: MacOs, Catalina 10.15.7
- JDK version:
openjdk version "11.0.9" 2020-10-20 LTS
OpenJDK Runtime Environment Zulu11.43+21-CA (build 11.0.9+11-LTS)
OpenJDK 64-Bit Server VM Zulu11.43+21-CA (build 11.0.9+11-LTS, mixed mode)
- Visual Studio Code version: 1.55.2
- Java extension version: 0.76.0
Steps To Reproduce
- Import Gradle project
- Open .java file
Here are some other messages that I get:
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-6.4.1-all.zip'.
The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/nix/store/g4lwpql3c2lyw7m04wxbrx72x9kh0w9j-zulu11.43.21-ca-jdk11.0.9,daemonRegistryDir=/Users/xxxxx/.gradle/daemon,pid=49638,idleTimeout=null,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=utf8,-Duser.country=GB,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=415ee891-9ddf-491a-a2cb-c7cee384bfab,javaHome=/nix/store/g4lwpql3c2lyw7m04wxbrx72x9kh0w9j-zulu11.43.21-ca-jdk11.0.9/zulu-11.jdk/Contents/Home,daemonRegistryDir=/Users/xxxxx/.gradle/daemon,pid=49652,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=utf8,-Duser.country=GB,-Duser.language=en,-Duser.variant]
Additional Informations
I am also trying to get Emacs work with this project. I have lots of NullPointerExceptions from the plugins in the lsp-log there.
I've read that Gradle projects for Android are not supported. Well, this one is not for Android.
Here is what I put in build.gradle:
plugins {
id 'java'
id 'eclipse'
id 'idea'
...
I also put this (to have the classes copied in bin and not only in the build directory:
task copyBuildToBin(type: Copy) {
from 'build/classes/java/'
from 'build/resources/'
into 'bin/'
}
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo l'importazione Gradle riportata nell'issue, aprendo un file .java nell'estensione Java di VS Code e analizzando il build.gradle del progetto. Confronta l'errore di classpath con la discrepanza di Java-home del daemon Gradle segnalata e con le NullPointerExceptions del language server. Il lavoro è completato quando un progetto Gradle non Android viene importato senza l'avviso di classpath e i file Java sono supportati completamente anziché solo a livello sintattico.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, vscode
- Ambito
- build-system, developer-experience
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100