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 / First Aid / April 2008

Tip: Looking for answers? Try searching our database.

Is there an option for auto-create output dirs when compiling with javac?

Thread view: 
Catherina Svensson - 29 Apr 2008 07:09 GMT
When I perform a compiling operation like:

javac -d build\WEB-INF\classes my.java

and the directory build\WEB-INF\classes does NOT exist then the javac command fails.

Is there really no auto-create-dir-when-necessary option for javac ?

Cat
Sabine Dinis Blochberger - 29 Apr 2008 09:33 GMT
> When I perform a compiling operation like:
>
[quoted text clipped - 5 lines]
>
> Cat

Is there a particular reason you don't want to use Ant[1]? It's like
Javas make and can do a multitude of tasks for you (compiling, creating
directories, packing into jars etc).

[1] <http://ant.apache.org/>
Signature

Sabine Dinis Blochberger

Op3racional
www.op3racional.eu

Sabine Dinis Blochberger - 29 Apr 2008 09:40 GMT
> > When I perform a compiling operation like:
> >
[quoted text clipped - 11 lines]
>
> [1] <http://ant.apache.org/>

Before someone says something, you could use make itself aswell, that
comparison wasn't the best.
Signature

Sabine Dinis Blochberger

Op3racional
www.op3racional.eu

Lew - 29 Apr 2008 12:39 GMT
>> [1] <http://ant.apache.org/>
>>
> Before someone says something, you could use make itself as well

But nobody in their right mind would.  You could also use shell scripts to
automate the construction of target directories and the like.  I've seen that
done at major Java EE installations.

Catherina Svensson wrote:
>> Is there really no auto-create-dir-when-necessary option for javac ?

Why should there be?  javac is a cross-platform compiler, not a file-system
manager.  Is there really a requirement that Sun anticipate one's failure to
set up one's own environment correctly?

Ant does everything.  If you are trying to automate builds, there is no better
choice.

Signature

Lew

Lew - 29 Apr 2008 13:03 GMT
> Is there really no auto-create-dir-when-necessary option for javac ?

You showed good use of "Follow-up" to contain a cross-post to a single
newsgroup, but actually the cross-post itself wasn't even needed.   Pretty
much the same population peruses both clj.help and clj.programmer.  You'll do
fine just picking one newsgroup in the first place.

Signature

Lew

Arved Sandstrom - 29 Apr 2008 16:32 GMT
> When I perform a compiling operation like:
>
[quoted text clipped - 6 lines]
>
> Cat

Not in the sense that you mean. The location pointed to by the -d option
must exist. Bear in mind that javac will certainly create directories as
required *in* the location you specify...for example:

javac -d targetdir dirA\dirB\*.java

will create

dirA\dirB\*.class

inside "targetDir".

Note that the explanation of the -d option in the javac documentation does
say that the destination directory will *not* be created.

AHS


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.