• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiling a package

 
Zylias Kestravale
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51332
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a package name in your .java files?
 
Zylias Kestravale
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51332
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic