无法编译开源java游戏

时间:2016-02-06 11:37:59

标签: java compilation

我从https://github.com/SergeDavid/Advanced-Wars-Clone下载了这个开源游戏,想要编译它以查看它。但是,我仍然相对较新的java并且没有在这种布局中制作我自己的程序。我似乎无法找到我编译的单个文件来启动并运行整个程序。

我导航到" Advanced-Wars-Clone-master \ src \ engine"在cmd中,键入" javac Game.java"并按Enter键。收到的错误如下。 感谢。

Game.java:23: error: cannot find symbol
        public static Map map;
                  ^
  symbol:   class Map
  location: class Game
Game.java:24: error: cannot find symbol
        public static Gui gui;
                  ^
  symbol:   class Gui
  location: class Game
Game.java:25: error: cannot find symbol
        public static LoadImages load;
                  ^
  symbol:   class LoadImages
  location: class Game
Game.java:26: error: cannot find symbol
        public static InputHandler input;
                  ^
  symbol:   class InputHandler
  location: class Game
Game.java:27: error: cannot find symbol
        public static Editor edit = new Editor();
                  ^
  symbol:   class Editor
  location: class Game
Game.java:28: error: cannot find symbol
        public static Battle btl = new Battle();
                  ^
  symbol:   class Battle
  location: class Game
Game.java:29: error: cannot find symbol
        public static ErrorHandler error = new ErrorHandler();
                  ^
  symbol:   class ErrorHandler
  location: class Game
Game.java:30: error: cannot find symbol
        public static Pathfinding pathing = new Pathfinding();
                  ^
  symbol:   class Pathfinding
  location: class Game
Game.java:31: error: cannot find symbol
        public static ListData list;
                  ^
  symbol:   class ListData
  location: class Game
Game.java:32: error: cannot find symbol
        public static Save save = new Save();
                  ^
  symbol:   class Save
  location: class Game
Game.java:33: error: cannot find symbol
        public static ComputerBrain brain = new ComputerBrain();
                  ^
  symbol:   class ComputerBrain
  location: class Game
Game.java:34: error: cannot find symbol
        public static FileFinder finder = new FileFinder();
                  ^
  symbol:   class FileFinder
  location: class Game
Game.java:35: error: cannot find symbol
        public static ViewPoint view = new ViewPoint();
                  ^
  symbol:   class ViewPoint
  location: class Game
Game.java:49: error: package players does not exist
        public static List<players.Base> player = new        ArrayList<players.Base>();
                              ^
Game.java:50: error: package buildings does not exist
        public static List<buildings.Base> builds = new  ArrayList<buildings.Base>();
                                ^
Game.java:51: error: package units does not exist
        public static List<units.Base> units = new ArrayList<units.Base>();
                            ^
Game.java:53: error: package players does not exist
        public static List<players.Base> displayC = new ArrayList<players.Base>();
                              ^
Game.java:54: error: package buildings does not exist
        public static List<buildings.Base> displayB = new ArrayList<buildings.Base>();
                                ^
Game.java:55: error: package units does not exist
        public static List<units.Base> displayU = new ArrayList<units.Base>();
                            ^
Game.java:27: error: cannot find symbol
        public static Editor edit = new Editor();
                                    ^
  symbol:   class Editor
  location: class Game
Game.java:28: error: cannot find symbol
        public static Battle btl = new Battle();
                                   ^
  symbol:   class Battle
  location: class Game
Game.java:29: error: cannot find symbol
        public static ErrorHandler error = new ErrorHandler();
                                           ^
  symbol:   class ErrorHandler
  location: class Game
Game.java:30: error: cannot find symbol
        public static Pathfinding pathing = new Pathfinding();
                                            ^
  symbol:   class Pathfinding
  location: class Game
Game.java:32: error: cannot find symbol
        public static Save save = new Save();
                                  ^
  symbol:   class Save
  location: class Game
Game.java:33: error: cannot find symbol
        public static ComputerBrain brain = new ComputerBrain();
                                            ^
  symbol:   class ComputerBrain
  location: class Game
Game.java:34: error: cannot find symbol
        public static FileFinder finder = new FileFinder();
                                          ^
  symbol:   class FileFinder
  location: class Game
Game.java:35: error: cannot find symbol
        public static ViewPoint view = new ViewPoint();
                                       ^
  symbol:   class ViewPoint
  location: class Game
Game.java:49: error: package players does not exist
        public static List<players.Base> player = new ArrayList<players.Base>();
                                                                   ^
Game.java:50: error: package buildings does not exist
        public static List<buildings.Base> builds = new ArrayList<buildings.Base>();
                                                                       ^
Game.java:51: error: package units does not exist
        public static List<units.Base> units = new ArrayList<units.Base>();
                                                              ^
Game.java:53: error: package players does not exist
        public static List<players.Base> displayC = new ArrayList<players.Base>();
                                                                     ^
Game.java:54: error: package buildings does not exist
        public static List<buildings.Base> displayB = new     ArrayList<buildings.Base>();
                                                                         ^
Game.java:55: error: package units does not exist
        public static List<units.Base> displayU = new ArrayList<units.Base>();
                                                                 ^
Game.java:67: error: cannot find symbol
                gui = new Gui(this);
                      ^
  symbol:   class Gui
  location: class Game
Game.java:73: error: cannot find symbol
                load = new LoadImages();
                       ^
  symbol:   class LoadImages
  location: class Game
Game.java:74: error: cannot find symbol
                map = new Map();
                      ^
  symbol:   class Map
  location: class Game
Game.java:75: error: cannot find symbol
                input = new InputHandler();
                        ^
  symbol:   class InputHandler
  location: class Game
Game.java:76: error: cannot find symbol
                list = new ListData();
                       ^
  symbol:   class ListData
  location: class Game
38 errors

1 个答案:

答案 0 :(得分:0)

要从命令行编译项目,首先需要编译其他类所依赖的类。

例如,在大多数子包中,都有一个Base.java文件。首先编译该文件,然后编译其他文件。

最后,编译Engine子包中的类。

如果您无法确定首先编译哪个文件,请使用编辑器打开它,并检查它使用的类。然后首先编译这些类。

但是,我建议您在IDE中导入项目然后进行编译。大多数IDE首先自动编译所需的类。