• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compiling classes

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you compile a Java class, does it compile all classes that have a reference in that class, all references in those classes, and so forth; both instances and static methods from other classes? Are library classes compiled when called from a class?
Thanks

 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It compiles all classes that need to be compiled; that is, if there is no .class file or if the .java file (if found) is more recent than the .class file. As such, the library classes are not compiled, as they are already compiled.
 
Jim Thompson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what is the point of make files like Ant?
 
Jim Thompson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what is the point of make files like Ant?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Say that class A uses class B, and B uses C.
If no class files exist, then compiling A would create all 3.
Now, let's say you drastically change C, so that both A and B really need to be compiled. Then compile A. The compiler looks at B, sees that its B.class file is up to date with respect to its B.java file, and does nothing. C gets compiled, as does A, but B isn't touched. You may now get a runtime error.
A good build tool can (among other things) keep track of this kind of dependency; you can tell it that B depends on C, so that modifying C will force B to be recompiled.
Of course, build tools do a lot of other things too: automate version control, packaging, installation, testing, and other parts of development.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic