Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java not found on Linux #91

Open
Lucatir opened this issue Jan 28, 2021 · 4 comments
Open

Java not found on Linux #91

Lucatir opened this issue Jan 28, 2021 · 4 comments
Labels

Comments

@Lucatir
Copy link

Lucatir commented Jan 28, 2021

So after having my output spammed by Java related errors, I used the PR #87 and had my woes confirmed that indeed, Java was not found. I set the directory to my $PATH, set it in VSC settings (made available by said PR), but I still get the error of Java not found. I do not have this issue on senfo's build of the extension, but there, none of the prefix settings seem to work so is there something funny going on with Linux paths? Maybe related to using / instead of ?

My distribution of choice is Manjaro (Archlinux based) if that is of any importance and I tried both with JDK 15 and 11 and both Oracle and OpenJDK.

@SkaceKamen
Copy link
Owner

That's weird, it has probably something to do with the way nodejs does the exec. If you open terminal in the vscode and type java, what happens?

@Lucatir
Copy link
Author

Lucatir commented Jan 28, 2021

/run/.../armadev/overthrow_main >>> java
Usage: java [options] [args...]
(to execute a class)
or java [options] -jar [args...]
(to execute a jar file)
or java [options] -m [/] [args...]
java [options] --module [/] [args...]
(to execute the main class in a module)
or java [options] [args]
(to execute a single source-file program)

Etc. Pretty much what you'd expect.

@Lucatir
Copy link
Author

Lucatir commented Jan 29, 2021

Ok, this was a partial user error. The problem is not locating Java at all. I didn't notice that when you can set the Java path, it asks you to point it directly to the java executable, not the bin folder like most other extensions expect you to do that utilize Java (that I have used). Lo and behold, after pointing the setting to the java executable, I get the same error spam I got the first time which is:

10:41:03] [Info] [sqflint] Starting background server...
[10:41:03] [Info] [sqflint] Background server started
[Error - 10:41:03 AM] [10:41:03] [Error] [sqflint] SQFLint: Error message Error: Unable to initialize main class cz.zipek.sqflint.SQFLint
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
[Error - 10:41:03 AM] [10:41:03] [Error] [sqflint] SQFLint: Process crashed with code 1

Which keeps looping. Apologies for that brainfart of mine which undoubtedly delayed resolving the issue. I did a repeat test with Oracle Java 15 and 11 and the error remains the same.

@SkaceKamen
Copy link
Owner

No worries, maybe expecting the path to be directly to java is not a good idea, I'll think about changing that.

Anyway, this happened before, my implementation relies on java having ./lib/* in its classpath, which is probably not the case for the java you're running. This should be fixed on our end by specifying this classpath when running the extension. I'll look into it and possibly publish a patch. In the meanwhile, maybe try to set global CLASSPATH evn variable to have lib/* in it? Maybe you already have that env variable set to something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants