faustinoaq / vscode-javac-linter

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

javac: directory not found #4

Open nadouamanda opened 6 years ago

nadouamanda commented 6 years ago

Hi,

I tried to install the linter but the following errors pop up in the output console:

"javac" -Xlint:unchecked -g -d "undefined" -cp "" "/Users/xxx/Desktop/MyFile.java" javac: directory not found: undefined Usage: javac use -help for a list of possible options

directory not found

Any pointers?

faustinoaq commented 6 years ago

Hi @nadouamanda This extension uses the javac command, so you'll need to setup your "javac-linter.javac" in settings.json or make javac available on global path

nadouamanda commented 6 years ago

Hi, @faustinoaq thanx for the reply. When you say settings.json, do you refer to settings.json in client folder? I've been trying to build the linter from its source code and got the same error. Do I need the java language server extension installed for this library to work? I would really appreciate it if you could provide me the steps to build from source.

faustinoaq commented 6 years ago

When you say settings.json, do you refer to settings.json in client folder

Yeah, I forgot that. When you are using the version from marketplace you only need to setup your standard VSCode settings file (settings.json) opening it with Ctrl+. or Cmd+.

However, if you're trying to use this repository directly you'll need some guide

Do I need the java language server extension installed for this library to work?

No, this works stand alone

I would really appreciate it if you could provide me the steps to build from source.

Good advice, Take a look 👍

BTW,This was my first VSCode extension, I think I'll need to update some dependencies and refactor most code 😅

nadouamanda commented 6 years ago

Nice update on the README file but I don't think setting the javac path in settings.json will fix my problem since I've already had javac in my global path.

This "directory not found" error only appears when I opened a standalone java file. The error goes away after I opened the folder containing the java-linter source code. And I got the following output:

"javac" -Xlint:unchecked -g -d "/Users/xxx/vscode-javac-linter" -cp "/Users/xxx/vscode-javac-linter" "/Users/xxx/Desktop/MyFile.java" /Users/xxx/Desktop/MyFile.java:35: error: invalid method declaration; return type required public message(){ ^ 1 error

Any idea?

faustinoaq commented 6 years ago

@nadouamanda Oh, I updated my VSCode and this extension isn't working anymore, let me investigate and try to fix it. Thank you for reporting this issue!

nadouamanda commented 6 years ago

Could it be the settings for the "classpath"? I noticed that you have this line of code: var cmd = "${javac}" -Xlint:unchecked -g -d "${classpath[0]}" -cp "${cp}" "${filepath}" ; in server.ts and later output the cmd into console. Seems like classpath and cp is undefined in the error message I got.

faustinoaq commented 6 years ago

@nadouamanda Oh yeah, I found some pitfalls in my code, I coded it so bad. I'll be fixing it on my spare time. (just a couple of days)

faustinoaq commented 6 years ago

@nadouamanda I released 1.3.0, I made some changes to simplify code and update dependencies, my basic error parser still needs to be improved though.

Also you can try using tasks.json to detect java errors

nadouamanda commented 6 years ago

Hey @faustinoaq I really like the way how you simplify the logic of the language server, everything seems to be working for me. Do you know if there is any benefit of using the language server implementation? Thanks :)

P.S. I will try the task.json thing later today