开发者

trying to compile after using eclipse and having import problems

开发者 https://www.devze.com 2023-02-18 03:21 出处:网络
hi i\'m using ubuntu and i have a little project with several packages i wrote in eclipse. when i am trying to compile (run javac) from the terminal i get numerous errors like:

hi i'm using ubuntu and i have a little project with several packages i wrote in eclipse. when i am trying to compile (run javac) from the terminal i get numerous errors like:

Writeable开发者_高级运维.java:14: cannot find symbol
symbol  : class IllegalFilterArgumentException
location: class oop.ex1.filters.Writeable
        throw new IllegalFilterArgumentException();

now in eclipse everything was fine. i was told its because i need to run javac from a directory that can see all java files in my project, but it didn't work. any ideas? thanks


If you are using packages (as you are, from the error message), you must arrange your source files in package structure, and then call javac from the root of this structure. For example this way:

  • root directory
    • oop
      • ex1
        • filters
          • Writeable.java
          • IllegalFilterArgumentException.java

Then you'll call it this way:

javac oop/ex1/filters/Writable.java

Alternatively to "calling from the root directory" you could pass this root directory as an option to javac:

javac -sourcepath "root directory" oop/ex1/filters/Writable.java

(You may also want to give other options to javac, look at its help page.)

0

精彩评论

暂无评论...
验证码 换一张
取 消