I'm trying to compile multiple .java programs from different directories either on Windows, Mac, or Linux... e.g. cmd or terminal. It doesn't matter.
However, I'm sure that many of you are familiar with how Netbeans stores files in different folders. I have been putting different concepts into different folders, and now I want to run all of them.
For example, a chess program that I have looks sort of like this:
/Chess
/build
/classes
/chess
/Chess.class
/color
/colorHelper.class
/game
/Board.class
/Game.class
/GameManager.class
/Player.class
... etc. (the rest of the directories with .class files)
/build.xml
/gameLog.txt
/manifest.mf
/nbproject
... (some xml and .properties files)
/src
/chess
/Chess.java
/color
/ColorHelper.java
/game
/Board.java
/Game.java
/GameManager.java
/Player.java
... etc. (the rest of the directories with .java files)
So, my question is, how can you use javac *.java
(in /src
probably) to compile all of the files (because otherwise I get a cannot find symbol
error. Since I get a file not found
when I run javac *.java
in src
, I am at a loss.
Thanks in advance,
Dylan
It won't compile in one go.Actually,your src
directory doesn't contain any .java file,SO it won't be done in that way!
I am afraid that you'll have to do it by changing your path under src
folder to do the same.
You'll have to perform for each chess
,color
,game
,etc. directories to achieve the same.
So,change path at each run or go as advised in the comments to achieve compilation of all the java files.
OR
As proposed by David Ehrmann in your comment,you can do it by compiling in one go using javac $(find . -name '*.java')
.
It will compile all .java files under your present directory(src(.)
).