473,320 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Compiling -- Can I Control Where .java and .class Files Are Kept?

My first Java project has gotten to the point where there are so many .java
and .class files that I'd like to keep them separated so I can easily keep
files straight. I have my /home/me directory and I want to put my .java
files in /home/me/src and my class files in /home/me/bin. For now, I'm
keeping the .java files in /home/me/src and, after I compile a class, I do
"mv src/*class bin/" to transfer the newly generated .class files into the
bin directory.

Is there any way to tell javac that all .class files should be put in the
bin dir? I can deal with adding "src/" onto my javac commands, although it
would nice to have javac look in a "default" directory for .java files
first, but I'd really like to have the .class files moved over
automatically (it is also a problem when I'm compiling more than one class
at a time when the second class uses new methods in the first class).

Thanks!

Hal
Jul 17 '05 #1
3 3260
Hal Vaughan wrote:
Is there any way to tell javac that all .class files should be put in the
bin dir?


Use the -d switch

$ javac -help
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs
are used
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified
release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options

--
Jonas Kongslund
Jul 17 '05 #2
Jonas Kongslund wrote:
Hal Vaughan wrote:
Is there any way to tell javac that all .class files should be put in the
bin dir?


Use the -d switch

$ javac -help
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is
doing
-deprecation Output source locations where deprecated APIs
are used
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source
files
-source <release> Provide source compatibility with specified
release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options


Thought I did that, but when I tried it, I realized that I had read the help
for java, not javac. Thanks.

Hal
Jul 17 '05 #3
Get yourself a good easy to use Java IDE like JCreator LE (which is free!)
and let the IDE manage all these things. Download at:
http://www.jcreator.com/

Larry

"Hal Vaughan" <ha*@thresholddigital.com> wrote in message
news:ZYCwb.225814$275.860373@attbi_s53...
My first Java project has gotten to the point where there are so many ..java and .class files that I'd like to keep them separated so I can easily keep
files straight. I have my /home/me directory and I want to put my .java
files in /home/me/src and my class files in /home/me/bin. For now, I'm
keeping the .java files in /home/me/src and, after I compile a class, I do
"mv src/*class bin/" to transfer the newly generated .class files into the
bin directory.

Is there any way to tell javac that all .class files should be put in the
bin dir? I can deal with adding "src/" onto my javac commands, although it would nice to have javac look in a "default" directory for .java files
first, but I'd really like to have the .class files moved over
automatically (it is also a problem when I'm compiling more than one class
at a time when the second class uses new methods in the first class).

Thanks!

Hal

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Herman | last post by:
Hi everyone, I'm implementing Dijkstra's algorithm for a class project, and I'm having trouble compiling the class that runs the algorithm. All of the other files compile fine except for this one....
3
by: Isa | last post by:
Hi! I have a question about the package and Java class files. I hope someone can answar me. When I compile a java source file with a package statement I expect that the compiler should create the...
29
by: Maurice LING | last post by:
Hi, I remembered reading a MSc thesis about compiling Perl to Java bytecodes (as in java class files). At least, it seems that someone had compiled scheme to java class files quite successfully....
4
by: Brian B. | last post by:
Hi, I have an ASP.NET project written in VB.NET on a server. I have made a few changes to some files using notepad while remotely connected to the server. How can I compile the project on the...
1
by: C Downey | last post by:
Is there a way to access my .vb class files in my codebehind pages without pre-compiling them first. We are working with multiple developers, so each time I make a change to the class file the...
18
by: Al | last post by:
I'm still trying to do this but it never worked! In a .cpp file, I write the code, and at the beginning, I write: #ifndef MYLIST_H #define MYLIST_H ....to end: #endif What's wrong with it for...
7
by: maya | last post by:
hi, I'm following example 'Intro7.aspx' here, http://www.csharpfriends.com/quickstart/aspplus/doc/webformsintro.aspx#customctrls it says on top of Acme.cs "namespace Acme" I assume this means...
4
by: betalpha | last post by:
I'm having trouble compiling my program in Unix. I initially developed it on Windows in Eclipse. I have two files: Tokenizer.java and TokenizerMain.java. They are both in a directory called...
4
by: anon538 | last post by:
I have been interested in switching from Java to C# for a long time now. I typically write small, stand alone programs for contests. Each program is completely self contained. I am used to, in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.