Reputation: 121
I'm trying to compile my source code which divided into different packages. i wrote a sources text and list inside it all the paths of the java files. i also made a makefile and wrote the following lines:
compile: bin
javac -d bin -cp biuoop-1.4.jar @sources.txt
run:
java -cp biuoop-1.4.jar:bin Ass5Game 2 4
bin:
mkdir bin
the biupoop is a built jar file i'm using.
after i use the make commend the computer says:
javac -d bin -cp biuoop-1.4.jar @sources.txt
javac: file not found: animations\Animation.java
Usage: javac <options> <source files>
use -help for a list of possible options
make: *** [compile] Error 2.
how do i compile the files in packages?
Upvotes: 0
Views: 521
Reputation: 1075467
The key is in this error message:
javac: file not found: animations\Animation.java
Note the backslash. On *nix, paths are separated with slash (/
), not backslash (\
). If you change the \
in your sources.txt
to /
instead, it will work (assuming you're running this in the directory that animation
is a subdirectory of).
Example run:
$ cat animation/Animation.java package animation; public class Animation { public static final void main(String[] args) { System.out.println("Success"); } } $ cat sources.txt animation/Animation.java $ javac -d bin @sources.txt $ java -cp bin animation.Animation Success
Upvotes: 5