Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

How to make Compilation faster

Thread view: 
juergen - 15 Sep 2006 08:59 GMT
Hi,
I was using C/C++ and make files for many years (2 decades). It was
possible to compile large project with many source-files very quickly,
because only the updated file needed to be compiled and the rest only
linked.

$(BINARY):$(OBJFILES)
       $(CC) $(OBJFILES) $(LIBS) -o $(BINARY)
midev.o : $(CODIRmm)/midev.c
       $(CC) $(CFLAGS) -c $< -o $@
...

In Java it is also possible to use make. First compile the class-files,
then generate the *.jar.
I tried to write a makefile that compiles every *.java file
individually, but that wouldn't work.
It seems that javac only compiles when all source-files are given like
this:

notdis.jar: $(SRC) $(TSRC)
       javac -g -d build $(SRC) $(TSRC)
       jar cfm $@ manifest.mf -C build .

How do you handle big projects with many source-files?
Useful ideas are very welcome!
 Juergen
Thomas Kellerer - 15 Sep 2006 09:05 GMT
> In Java it is also possible to use make. First compile the class-files,
> then generate the *.jar.
[...]

> How do you handle big projects with many source-files?
> Useful ideas are very welcome!
>   Juergen

Use ant instead of make. It will only recompile the needed files and is
the de-facto standard in the Java environment.

http://ant.apache.org/

Thomas

Signature

It's not a RootKit - it's a Sony

jAnO! - 15 Sep 2006 16:20 GMT
>> In Java it is also possible to use make. First compile the class-files,
>> then generate the *.jar.
[quoted text clipped - 10 lines]
>
> Thomas

Last 2 years, maven is becomming even more popular and usefull btw.
Arne Vajhøj - 16 Sep 2006 00:19 GMT
>> Use ant instead of make. It will only recompile the needed files and is
>> the de-facto standard in the Java environment.
>
> Last 2 years, maven is becomming even more popular and usefull btw.

Maven is more popular now than it was 2 years ago.

Maven is not more popular than ant.

Some like Maven - some don't.

Arne
TechBookReport - 15 Sep 2006 09:48 GMT
> Hi,
> I was using C/C++ and make files for many years (2 decades). It was
[quoted text clipped - 22 lines]
> Useful ideas are very welcome!
>   Juergen

As Thomas has already said, in Java ant is pretty much standard. But
there are other tools, and plenty of ant extensions. Take a look at the
list here: http://www.java-source.net/open-source/build-systems

Signature

TechBookReport Java http://www.techbookreport.com/JavaIndex.html

cmmagid@gmail.com - 15 Sep 2006 19:27 GMT
> > Hi,
> > I was using C/C++ and make files for many years (2 decades). It was
[quoted text clipped - 29 lines]
> --
> TechBookReport Java http://www.techbookreport.com/JavaIndex.html

I have not done this since my company went over to using make with
java and I moved to using Eclipse.   I believe that, unless classes are
loaded in a non standard way,  i.e. by their string name and your class
path is correct,  'javac' does a reasonable job of locating the
dependant files to be compiled.  Javac does this with out any use of
'make', 'ant', 'maven or IDE..

Ex:  javac MyMain.java
      javac MyClassesLoadedDynamically*.java
.
Wibble - 18 Sep 2006 04:57 GMT
>>> Hi,
>>> I was using C/C++ and make files for many years (2 decades). It was
[quoted text clipped - 40 lines]
>        javac MyClassesLoadedDynamically*.java
> .

Javac is great if your not in a hurry.  Ant is much faster, but can
sometimes get compile time dependencies wrong.
bugbear - 18 Sep 2006 11:23 GMT
> Javac is great if your not in a hurry.  Ant is much faster, but can
> sometimes get compile time dependencies wrong.

Agreed. I use Ant, but if I have the SLIGHTEST
suspicion (experience is a good guide) that my build
my have "faulty" dependancies, I have (and use)
an Ant target that does a full unconditional build.

The result is that my normal compile-JUnit cycle is around
2-3 seconds.

  BugBear


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.