Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: How can I compile an entire directory structure of code ?

The use case is simple. I got the source files that were created using Eclipse. So, there is a deep directory structure, where any Java class could be referring to another Java class in the same, child, sibling or parent folder.

How do I compile this whole thing from the terminal using javac ?

like image 823
euphoria83 Avatar asked Jan 21 '11 23:01

euphoria83


People also ask

How do I compile an entire Java project?

Open a command prompt and navigate to the compile-packages-in-java directory. Then type in the command to compile the Person source and hit Enter . Notice that you provided the path of the Java file. This path corresponds to the package name.

How Java compiles its code?

Java source code is compiled into bytecode when we use the javac compiler. The bytecode gets saved on the disk with the file extension . class . When the program is to be run, the bytecode is converted, using the just-in-time (JIT) compiler.


1 Answers

You have to know all the directories, or be able to use wildcard ..

javac dir1/*.java dir2/*.java dir3/dir4/*.java dir3/dir5/*.java dir6/*src/*.java 
like image 109
Manidip Sengupta Avatar answered Sep 20 '22 17:09

Manidip Sengupta