Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use JAVAC to compile a project with multiple files and directories?

I'm working on a very large project that has associated class files in multiple directories, all stemming from the root dir \src.

I'm trying to compile a file in src\solution\ (called Console.java) that uses imports from other directories in the src, which are still uncompiled.

So if I want to compile Console.java outside of an IDE, how do I go about doing that? Oh yeah, I also have some external JARs which need to be included in the build.

Thanks! I appreciate it!

like image 360
Monster Avatar asked May 14 '09 17:05

Monster


People also ask

What does javac compile to?

The javac command reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files. The javac command can also process annotations in Java source files and classes.

How do I compile all Java files in a package?

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.


1 Answers

I would look at using Ant to create a build script. It's a little bit of work now but it'll pay off over the lifetime of your project.

like image 77
mtpettyp Avatar answered Oct 15 '22 08:10

mtpettyp