faustinoaq / vscode-javac-linter

A Java linter for Visual Studio Code
MIT License
10 stars 2 forks source link

Setting javac-linter classpath in Ubuntu #2

Closed bly15 closed 7 years ago

bly15 commented 7 years ago

How do I set the classpath for javac-linter in Ubuntu? I try to set it to "/usr/bin" but then it says "error writing the file blahblahblah to /usr/bin (Permission denied)."

faustinoaq commented 7 years ago

Hi @bly15

The first classpath is used as destination for .class files

Let me explain:

// settings.json
{
  "javac-linter.classpath": [
    ".", // This path is used as destination of ".class" files
    "/usr/bin" // You can put your classpath here
  ]
}

The classpath array is joined to java -cp ".;/usr/bin" -d "." ...

bly15 commented 7 years ago

Thanks for the help, Faustino! I appreciate the great work you're doing on this extension. Cheers!

jxsl13 commented 7 years ago

I simply cannot get this to work, what am I doing wrong? "Classpath is incomplete. Only syntax errors will be reported" Mac OS X

"javac-linter.classpath": [".", "/usr/bin/"]

instead of "/usr/bin/" I tried "$CLASSPATH", the java home folder, I kind of don't get it. If I'm not mistaken the class path should also contain at least all the basic JDK libraries? Where can I find those :?

faustinoaq commented 7 years ago

@jxsl13 You don't need "/usr/bin" even you don't need ".". You can set whatever path you want. All is joined down to java -cp "<your paths>" -d <first path used as destination> ... You can look at javac-linter output panel for more info.

If I'm not mistaken the class path should also contain at least all the basic JDK libraries?

I guess that javac uses JDK libs by default. However if you want you can include your own libs using "javac-linter.classpath": ["bin/classes/MyProject", "<your lib path>"] then "bin/classes/MyProject" is used as .class destination.