OldSchool Windows Command Prompt question

  • Thread starter Thread starter Danger_Duck
  • Start date Start date
D

Danger_Duck

Guest
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!
 
Re: OldSchool Windows Command Prompt question

"Danger_Duck" <Danger_Duck@discussions.microsoft.com> wrote in message
news:F28A0389-DFEA-46FA-A567-F7B887AE55C5@microsoft.com...
> 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
 
Re: OldSchool Windows Command Prompt question

Danger_Duck <Danger_Duck@discussions.microsoft.com> wrote:

>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

--
Tim Slattery
MS MVP(Shell/User)
Slattery_T@bls.gov
http://members.cox.net/slatteryt
 
Back
Top