redhat-developer / redhat-developer/vscode-java
java is not on the classpath message in a non-Android Gradle project
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.3k
- Forks
- 546
- Merge medio
- 20 h 1 min
- PR fusionados (30 d)
- 11
Descripción
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/'
}
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza reproduciendo la importación de Gradle del issue, abriendo un archivo .java en la extensión Java de VS Code y revisando el build.gradle del proyecto. Compara el error de classpath con la discrepancia de Java-home del daemon de Gradle indicada y las NullPointerExceptions del servidor de lenguaje. Se considera terminado cuando un proyecto Gradle no basado en Android se importa sin la advertencia de classpath y los archivos Java reciben soporte completo en lugar de solo soporte de sintaxis.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java, vscode
- Área
- build-system, developer-experience
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100