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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:39:37+00:00 2026-05-21T02:39:37+00:00

I thought I new this, but when I create an object out of an

  • 0

I thought I new this, but when I create an object out of an class in a seperate file, it only compiles if that class is defined in the same directory, or if I import it from the library. I assumed it used classpath to search for the included class files, but when I add a random directory to classpath(and only place that file there), it still complains that the class is not defined and won’t compile. Where does it know to look for classes at compile time?

Example

public class SomeClass {

public SomeOtherClass SoC; // If this class is not in library or same directory -- won't compile.

}
  • 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-21T02:39:38+00:00Added an answer on May 21, 2026 at 2:39 am
    // If this class is not in library or same directory -- won't compile
    

    Correct. Your classes need to be in the classpath, or in a .jar that you specify.

    When compiling you would use

    javac -classpath .:/some/other:/another:/some/foo.jar
    

    You then import whatever you need in your .java files (your code)

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

Sidebar

Related Questions

Trying to create an object from an HQL query, but just can't figure out
Im new on this project and am going to write, what i thought was
a = Array.new(3,[]) a[1][0] = 5 a => [[5], [5], [5]] I thought this
Starting a new rails project and we have a well-thought-out color palette, and want
I'm new to boost, and thought I'd try it out with some realistic deployment
I'm new to Java and I have to create a value object, (maybe it's
maybe its late or something, but this is freaking me out. Basicly im writing
I'm using the class listed below to create a UserControl wrapping a ComboBox that
I wanted to create a Dictionary-like object and thought the correct way would be
First, I am an objective-c newbie. Just thought I would get that out of

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.