wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Compiling a package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compiling a package" Watch "Compiling a package" New topic
Author

Compiling a package

Zylias Kestravale
Greenhorn

Joined: Nov 09, 2004
Posts: 4
Hi,

anyone know of any ways to compile recursively for a package of .javas?
i.e. My .java files are located at C:/src/*.../*.java

Thanks.


Regards,
Zylias
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
Do you have a package name in your .java files?
Zylias Kestravale
Greenhorn

Joined: Nov 09, 2004
Posts: 4
Campbell Ritchie wrote:Do you have a package name in your .java files?


yes.

csci.search.*.*

asterisks for all the subpackages that I have. Any idea how to compile the package without having to know/indicate all the package paths? Thanks.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
If you really want to compile the whole lot at once, navigate to a directory, and copy all the .java files into that same directory.

Then try

javac -d . *.java

You will find questions about compiling with package names quite frequently. Here is an old thread where I link to an older thread. Doing a search or following those links will (I hope) give you lots more information. If you have lots of files, using an IDE or "ant" may make life easier for you.

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

If you're using a real OS, something like

javac `find . -name '*.java'`

works great, of course. But really, learn to use Ant. If your project is complicated enough for you to ask this question, you need to be using a build tool of some kind to make sure the build is done correctly each time.


[Jess in Action][AskingGoodQuestions]
 
Consider Paul's rocket mass heater.
 
subject: Compiling a package