Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7058677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:08:28+00:00 2026-05-28T04:08:28+00:00

I am using the javac compiler to compile java files in my project. The

  • 0

I am using the javac compiler to compile java files in my project. The files are distributed over several packages like this: com.vistas.util, com.vistas.converter, com.vistas.LineHelper, com.current.mdcontect.

Each of these packages has several java files. I am using javac like this:

javac com/vistas/util/*.java com/vistas/converter/*.java
      com.vistas.LineHelper/*.java com/current/mdcontect/*.java

(in one line)

Instead of giving so many paths, how can I ask the compiler to compile recursively all the java files from the parent com directory?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:08:29+00:00Added an answer on May 28, 2026 at 4:08 am

    I would also suggest using some kind of build tool (Ant or Maven, Ant is already suggested and is easier to start with) or an IDE that handles the compilation (Eclipse uses incremental compilation with reconciling strategy, and you don’t even have to care to press any "Compile" buttons).

    Using Javac

    If you need to try something out for a larger project and don’t have any proper build tools nearby, you can always use a small trick that javac offers: the classnames to compile can be specified in a file. You simply have to pass the name of the file to javac with the @ prefix.

    If you can create a list of all the *.java files in your project, it’s easy:

    # Linux / MacOS
    $ find -name "*.java" > sources.txt
    $ javac @sources.txt
    
    :: Windows
    > dir /s /B *.java > sources.txt
    > javac @sources.txt
    
    • The advantage is that is is a quick and easy solution.
    • The drawback is that you have to regenerate the sources.txt file each time you create a new source or rename an existing one file which is an easy to forget (thus error-prone) and tiresome task.

    Using a build tool

    On the long run it is better to use a tool that was designed to build software.

    Using Ant

    If you create a simple build.xml file that describes how to build the software:

    <project default="compile">
        <target name="compile">
            <mkdir dir="bin"/>
            <javac srcdir="src" destdir="bin"/>
        </target>
    </project>
    

    you can compile the whole software by running the following command:

    $ ant
    
    • The advantage is that you are using a standard build tool that is easy to extend.
    • The drawback is that you have to download, set up and learn an additional tool. Note that most of the IDEs (like NetBeans and Eclipse) offer great support for writing build files so you don’t have to download anything in this case.

    Using Maven

    Maven is not that trivial to set up and work with, but learning it pays well. Here’s a great tutorial to start a project within 5 minutes.

    • It’s main advantage (for me) is that it handles dependencies too, so you won’t need to download any more Jar files and manage them by hand and I found it more useful for building, packaging and testing larger projects.
    • The drawback is that it has a steep learning curve, and if Maven plugins like to suppress errors 🙂 Another thing is that quite a lot of tools also operate with Maven repositories (like Sbt for Scala, Ivy for Ant, Graddle for Groovy).

    Using an IDE

    Now that what could boost your development productivity. There are a few open source alternatives (like Eclipse and NetBeans, I prefer the former) and even commercial ones (like IntelliJ) which are quite popular and powerful.

    They can manage the project building in the background so you don’t have to deal with all the command line stuff. However, it always comes handy if you know what actually happens in the background so you can hunt down occasional errors like a ClassNotFoundException.

    One additional note

    For larger projects, it is always advised to use an IDE and a build tool. The former boosts your productivity, while the latter makes it possible to use different IDEs with the project (e.g., Maven can generate Eclipse project descriptors with a simple mvn eclipse:eclipse command). Moreover, having a project that can be tested/built with a single line command is easy to introduce to new colleagues and into a continuous integration server for example. Piece of cake 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a compiler design project in Java. Lexical analysis is done (using
I am using Eclipse 3.5 for several different Java/JSP projects. All of our project
I try to compile a ( LWJGL ) Java project using NetBeans . I
I'm using Ant to compile Java.The project has to be compiled using JDK 1.5
hi i'm using ubuntu and i have a little project with several packages i
As an experiment we want to build our products using the Eclipse java compiler
I'm using Eclipse for Java development. All my sources compile fine and the resulting
How can you compile the code using javac in a terminal by using google-collections
as weSuppose that I am creating a Java project with the following classes com.bharani.ClassOne
Hallo, I cannot compile my project using an ant build script. The error message:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.