1

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 message from ale

error: package logic.list does not exist

Project overview

Output from tree (Overview of my project)

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

3
  • 1
    Welcome to Vi and Vim! I think the 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 (probably eclipselsp does)
    – D. Ben Knoble
    Nov 5, 2020 at 18:19
  • 1
    That was the problem. I had to get rid of 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.
    – Ayhon
    Nov 5, 2020 at 19:06
  • 1
    I'm happy for you too; nothing wrong with self-answering. You can copy/quote the text from my comment, if you like
    – D. Ben Knoble
    Nov 5, 2020 at 19:21

1 Answer 1

1

Welcome to Vi and Vim! I think the 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 (probably eclipselsp does)

This was the answer, from D. Ben Knoble. I had to get rid of the javac linter I had specified in my config.

let g:ale_linters = {
      \  'cs':['syntax', 'semantic', 'issues'],
      \  'python': ['pylint'],
      \  'java': ['eclipselsp']
      \ }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.