Open andirady opened 1 year ago
Setting an explicit Java classpath is currently supported via the java.classPath JSON initialization parameter. I too use the language server with Java source code that is not compiled using Maven, Gradle, or Bazel. When I do, I configure my editor to supply the language server with a classpath and documentation path using java.classPath and java.docPath. By using JSON to make these settings, I can work on more than one project at a time in my editor, with each running language server receiving the right classpath for the project it is handling.
Setting an explicit Java classpath is currently supported via the java.classPath JSON initialization parameter. I too use the language server with Java source code that is not compiled using Maven, Gradle, or Bazel. When I do, I configure my editor to supply the language server with a classpath and documentation path using java.classPath and java.docPath. By using JSON to make these settings, I can work on more than one project at a time in my editor, with each running language server receiving the right classpath for the project it is handling.
Sometimes I just want to write a single file which is to be run using java source launcher. Or I can have the classpath stored in a file and I can use it like so:
export CLASSPATH=`cat classpath.txt`
vim hello.java
and in the hello.java
, I can have the following:
///usr/bin/env java -cp `cat classpath.txt` $0 $@; exit
class myScript {
/* ... */
}
If the lang server have support for CLASSPATH environment variable, I don't have to create a separate file.
Can you please add a test @andirady ?
Can you please add a test @andirady ?
Done.
The behavior is, when it's a simple project and CLASSPATH
is specified, it'll read from that environment variable,
if the project uses a build tool, it's up to the build tool to handle the CLASSPATH
.
Some workflows doesn't use maven, gradle or bazel. This PR allows the user to declare the CLASSPATH environment variable.