my dog learned polymorphism
The moose likes Java in General and the fly likes Makefile in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Makefile in Java" Watch "Makefile in Java" New topic

Makefile in Java

Phil Lesh

Joined: Oct 16, 2002
Posts: 17
Can anyone please give me an example of a makefile for java. i.e. a makefile which compiles a couple of .java files. Thanks a lot!
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
It's been a long time since I wrote a makefile for Java. I ran into so many issues trying to build a make file that worked in Windows and in Linux (even with Cygwin on Windows) that when ANT came out I jumped ship and started using ANT exclusivly. ANT is available at and I can talk you through that.
The problem was that so much of a make file is actually shell programming (CShell, Bash, or DOS Batch file) and the bash shell on Linux was implemented slightly differently than the way that Cygwin implemented it in Windows. I just couldn't find enough common ground to make it compile in both.
Years ago I wrote a how-to about using makefiles with java on the JGuru site but that site ( ) seems to be down at the moment. If there's a reason that you need to use make files instead of ANT then I may be able to find some of my old code when I get home tonight and email it your way.

For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

Trust Greg! Save yourself from creating that flat spot on the side of your head from beating it against the wall and get ant running on your system. Your head will thank you.
[ December 03, 2002: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Makefile in Java
It's not a secret anymore!