Search code examples
javafiledirectoryjavacjava-package

Java error: package 'x' does not exist


So I have a file tree in Linux that looks like this:

  • ~/keyboard_warriors/
    • test/
      • ConfigTest.java
    • ConfigParser.class
    • ConfigParser.java

The problem is that when I try to type in Terminal:
javac ConfigTest.java

I get the error:

ConfigTest.java:2: error: package keyboard_warriors does not exist  
import keyboard_warriors.*;  
^

This is really bugging me and I could not find any answers anywhere. If you could solve my problem, I would be a very happy person.


Solution

  • I figured out the answer a long time ago but forgot to post it. sorry :). It is actually quite simple. I was trying to compile the classes from inside the test/ folder. What I did was go up to where all the classes were accessible without having to use a absolute path and without using ../ in the path (AKA the keyboard_warriors/ folder. I just compile from there and everything was A-OK. Thanks for the input though, it did help some ;).