OldSchool Windows Command Prompt question

D

Danger_Duck

In general, is there a way so I can configure command prompt to compile files
into a different directory than the one the file is in?

For instance, say Inside the folder "C:\JavaPrograms\Example" I have
example.java and I would like to place the compiled example.class into the
bin directory.

Instead of having to manually drag the .class files to and from the folder
"C:\JavaPrograms\Example\bin" so I can run 'java example' (when command
prompt is currently in C:\JavaPrograms\Example), is there a way to set
command prompt to compile from src (or root folder) and put the compiled
classes into the bin directory?

Or, for that matter, can anyone suggest an alternative (non-unix) to MS
command prompt that will compile and run java programs and the like just as
quickly? Eclipse is quite annoying when it comes to wanting to just redirect
or pipe (java example.java < sample.txt for instance)

Thanks!
 
P

Patrick Keenan

Danger_Duck said:
In general, is there a way so I can configure command prompt to compile
files
into a different directory than the one the file is in?

For instance, say Inside the folder "C:\JavaPrograms\Example" I have
example.java and I would like to place the compiled example.class into the
bin directory.

Instead of having to manually drag the .class files to and from the folder
"C:\JavaPrograms\Example\bin" so I can run 'java example' (when command
prompt is currently in C:\JavaPrograms\Example), is there a way to set
command prompt to compile from src (or root folder) and put the compiled
classes into the bin directory?

Or, for that matter, can anyone suggest an alternative (non-unix) to MS
command prompt that will compile and run java programs and the like just
as
quickly? Eclipse is quite annoying when it comes to wanting to just
redirect
or pipe (java example.java < sample.txt for instance)

Thanks!

Wouldn't the output directory be a command-line option of the compiler you
are using?

HTH
-pk
 
T

Tim Slattery

Danger_Duck said:
In general, is there a way so I can configure command prompt to compile files
into a different directory than the one the file is in?

For instance, say Inside the folder "C:\JavaPrograms\Example" I have
example.java and I would like to place the compiled example.class into the
bin directory.

The javac (java compiler) command on my machine has a -d flag:

-d <directory> Specify where to place generated class
files
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top