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

  • SEARCH
  • Home
  • 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 4023020
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:32:51+00:00 2026-05-20T10:32:51+00:00

I want to compile some .java files into a JAR. I would like to

  • 0

I want to compile some .java files into a JAR. I would like to use this JAR file in another application.

Is this a good way to use functions from my first application in my second application? My goal is to not duplicate code.

How can I edit the build.xml file for the second application to include the JAR file I created? When I compile my project, functions from JAR files are not resolved :

[javac] C:\HelloWorld\src\com\example\helloworld\HelloWorld.java:7: 
        package TOOLS does not exist  
[javac] import TOOLS.Logs;

EDIT:
When I add the javac task in my build.xml, compilation fails because other packages are not found:

[javac] Compiling 1 source file
[javac] C:\HelloWorld\src\com\example\hellowolrd\HelloWorld.java:3: 
        package android.app does not exist
[javac] import android.app.Activity;
[javac]                   ^

Why are my original packages not found after I include the JAR file?

  • 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-20T10:32:52+00:00Added an answer on May 20, 2026 at 10:32 am

    Yes. It’s good practice generally to subdivide functionality into libraries for reuse, ease-of-development etc. It’ll speed development if they’re separately built, and you can easily distribute functionality to successive projects.

    You can reference your jar thus:

      <javac srcdir="${src}"
             destdir="${build}"
             classpath="xyz.jar"
             debug="on"
      />
    

    See the javac documentation for more information.

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

Sidebar

Related Questions

I have a line number of a Java source file and want to get
I use builder for my buildprocess. I have some java classes in my src
Here is what I would like to do, and I want to know how
I want to compile the following line of code from http://code.google.com/p/enhsim : enh::eout <<
I want to compile a project differently, according to a constant defined by #define,
If I want to compile my .NET applications for a 64 bit environment. Do
I want to create a compiled JavaScript file for my website. For development I
I want to loop over the contents of a text file and do a
I want to assign the decimal variable "trans" to the double variable "this.Opacity". decimal
I'm having trouble finding good advice and common practices for the use of namespaces

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.