Intellij可以构建我的项目,但是Javac无法编译/查找符号

时间:2019-06-19 15:07:50

标签: java

我可以构建项目并使用intellij运行它,但是当我尝试使用find . -name "*.java" > sources.txt; javac -sourcepath @sources.txt在终端中对其进行编译时,它会给我intellij无法检测到的错误。

我尝试了重构(更改类名),但是显然没有帮助。

 location: package za.co.wethinkcode.avaj.simulator
src/za/co/wethinkcode/avaj/simulator/vehicle/Flyable.java:7: error: cannot find symbol
    public void registerTower(WeatherTower WeatherTower);
                              ^
  symbol:   class WeatherTower
  location: interface Flyable
src/za/co/wethinkcode/avaj/simulator/vehicle/Baloon.java:3: error: cannot find symbol
import za.co.wethinkcode.avaj.simulator.WeatherTower;
                                       ^
  symbol:   class WeatherTower
  location: package za.co.wethinkcode.avaj.simulator
src/za/co/wethinkcode/avaj/simulator/vehicle/Baloon.java:6: error: cannot find symbol
    private WeatherTower weatherTower;
            ^
  symbol:   class WeatherTower
  location: class Baloon
src/za/co/wethinkcode/avaj/simulator/vehicle/Baloon.java:57: error: cannot find symbol
    public void registerTower(WeatherTower WeatherTower) {
                              ^
  symbol:   class WeatherTower
  location: class Baloon
src/za/co/wethinkcode/avaj/simulator/vehicle/JetPlane.java:3: error: cannot find symbol
import za.co.wethinkcode.avaj.simulator.WeatherTower;
                                       ^
  symbol:   class WeatherTower
  location: package za.co.wethinkcode.avaj.simulator
src/za/co/wethinkcode/avaj/simulator/vehicle/JetPlane.java:6: error: cannot find symbol
   private WeatherTower weatherTower;
           ^
  symbol:   class WeatherTower
  location: class JetPlane
src/za/co/wethinkcode/avaj/simulator/vehicle/JetPlane.java:57: error: cannot find symbol
    public void registerTower(WeatherTower WeatherTower) {
                              ^
  symbol:   class WeatherTower
  location: class JetPlane
src/za/co/wethinkcode/avaj/simulator/vehicle/Helicopter.java:3: error: cannot find symbol
import za.co.wethinkcode.avaj.simulator.WeatherTower;
                                       ^
  symbol:   class WeatherTower
  location: package za.co.wethinkcode.avaj.simulator
src/za/co/wethinkcode/avaj/simulator/vehicle/Helicopter.java:6: error: cannot find symbol
    private WeatherTower weatherTower;
            ^
  symbol:   class WeatherTower
  location: class Helicopter
src/za/co/wethinkcode/avaj/simulator/vehicle/Helicopter.java:51: error: cannot find symbol
    public void registerTower(WeatherTower WeatherTower) {
                              ^
  symbol:   class WeatherTower
  location: class Helicopter
src/za/co/wethinkcode/avaj/simulator/Simulator.java:13: error: cannot find symbol
    private static  WeatherTower weatherTower;
                    ^
  symbol:   class WeatherTower
  location: class Simulator
src/za/co/wethinkcode/avaj/simulator/Simulator.java:26: error: cannot find symbol
                weatherTower =  new WeatherTower();
                                    ^
  symbol:   class WeatherTower
  location: class Simulator
13 errors

我希望它能够编译,因为它内置于intellij中,不会抱怨找不到该符号。

1 个答案:

答案 0 :(得分:0)

没关系,我知道了。我不应该使用-sourcepath标志。找 。 -名称“ * .java”> sources.txt; javac @ sources.txt可以正常工作。只需省略旗帜,您就可以走了。另外,如果您确实要使用sourcepath标志,请确保您位于src目录中。我认为-sourcepath只是在查找命令找到的每个路径前加上/ src。