I'm having this problem with ale where in java
files, it sometimes gives an error message saying that some packages don't exist. However, I can run without any problems my projects once I compile them, and the files are there, so no idea why it's giving me this error.
ALE error message
error: package logic.list does not exist
Project overview
src/
├── BuffyVampireSlayer.java
├── control
│ └── Controller.java
├── logic
│ ├── Game.java
│ ├── GameObjectBoard.java
│ ├── gameObjects
│ │ ├── Player.java
│ │ ├── Slayer.java
│ │ └── Vampire.java
│ ├── Level.java
│ └── list
│ ├── SlayerList.java
│ └── VampireList.java
├── utils
│ ├── Log.java
│ └── MyStringUtils.java
└── view
└── GamePrinter.java
6 directories, 13 files
ALE config section
let g:ale_fixers = {
\ 'java': ['google_java_format'],
\ }
let g:ale_linters = {
\ 'cs':['syntax', 'semantic', 'issues'],
\ 'python': ['pylint'],
\ 'java': ['eclipselsp','javac']
\ }
whole config over here
Makefile I use to compile and run my project
run: compile printSep
java -cp bin $(shell rgrep -l "public static void main" --exclude=Makefile | head -n 1 | sed -n "s#[^/]*/\(.*\)#\1#p" | sed "s/\.java//g") $(shell cat args)
printSep:
@clear
@printf '\e[33m--------\e[m\n'
compile:
@clear
@printf '\e[34mCompiling . . .\e[m\n'
find . -regex ".*\.java" | xargs javac -d bin
I also used Eclipse to run it, which doesn't show any errors by the way.
Other info
OS: Linux, Ubuntu 20.10 Vim version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31) Included patches: 1-2269
javac
linter is like a single-file compile, so it doesn't work well for whole-projects. I would suggest either setting up one of the many java build tools (maven, gradle, ant, etc.?) or using a linter that works with projects (probablyeclipselsp
does)javac
as a linter, and everything was working again. Thanks for the answer. Do you want to put as a separate answer so that I can check it as the solution, or do I do it myself? Anyways, thanks for everything.