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 8044705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:18:33+00:00 2026-06-05T05:18:33+00:00

Let’s say that I have two classes (Bob and Tom) such that Bob uses

  • 0

Let’s say that I have two classes (Bob and Tom) such that Bob uses Tom, but Tom does not require Bob. Both of these files are located in the same directory structure.

public class Bob {
  public static void main(String[] args) {
    System.out.println(Tom.MESSAGE);
  }
}

public class Tom {
  public static String MESSAGE = "Hello World";
}

If I attempt to compile Bob in the typical fashion, I can get it to implicitly compile Tom.java as well since it is recognized as a dependency of Bob.java. That works great.

But now let’s say that I want to place Tom in a JAR file. So I build Tom.java and place the results into a JAR file: libTom.jar. I now compile with the classpath pointing at libTom.jar. Unfortunately, the compiler sees the Tom.java file and causes it to be compiled rather than using the class in libTom.jar. Is there a way to get the compiler to skip the implicit construction of Tom.java if the class is found in the classpath?

I recognize that this example is fairly contrived. Rest assured that there is a more complicated, less contrived use-case that surrounds this issue. Thanks.

  • 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-06-05T05:18:34+00:00Added an answer on June 5, 2026 at 5:18 am

    It appears that this just isn’t possible, which is what I feared from the beginning.

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

Sidebar

Related Questions

Let's say I have two Entity classes: SocialApp and SocialAppType In SocialApp I have
Let's say we have a table that has 2 million rows. It has two
Let's say I have a base class 'A' and two classes 'B' and 'C',
Let's say I have the following classes : public class MyProductCode { private String
Let assume we have two activities. A - main activity, that is home launcher
Let's say you have a method that expects a numerical value as an argument.
Let's say I have a bunch of links that share a click event: <a
Let's say we have 3 classes: A, B and C. Each class has the
Let's say I have two tables orgs and states orgs is (o_ID, state_abbr) and
Let's say I have multiple requirements for a password. The first is that the

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.