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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:47:37+00:00 2026-06-02T16:47:37+00:00

For class, I was given a .class file (no .java) and I need to

  • 0

For class, I was given a .class file (no .java) and I need to create some JUnit tests of a method within that .class file. However, I’m not sure how to access the method. Incidentally, I’m using Eclipse.

I can import the file path, but it doesn’t see the .class file. Meaning . . . the file is /class/file/utility/StringUtility.class.

import class.file.utility.*; (works)
import class.file.utility.StringUtility; (gives error)

I tried using the first import, but I have a similar problem when I try to access the class file. Meaning . . .

StringUtility newUtil = new StringUtility(); (gives error – it doesn’t know what StringUtility is.

Any help would be appreciated.

SOLUTION BELOW SOLUTION BELOW SOLUTION BELOW

Since I am new to the forum I couldn’t answer my own question. However, here is the solution. . .

Thank you everyone for your help! You pointed me in the right direction and I was able to sort out my problem. In case someone else runs into the same issue, here is how I solved it. Again, I’m using Eclipse (Indigo).

1) File -> Import -> Archive File

Hit next

Then I browsed to the correct directory and selected the zip file with my .class file.

This added the archive to my project.

2) Right click on the project. Select Build Path -> Configure Build Path

Under the “Libraries” tab, I selected “Add Class Folder”. I then selected the folder I just added with the .class file.

I then entered StringUtil newUtil; and “Quick Fixed” the import to the code.

Hopefully, this will spare someone the four hours it took me to sort it out. 🙂

Again, thank you everyone for your comments. As I mentioned, they were helpful.

  • 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-02T16:47:39+00:00Added an answer on June 2, 2026 at 4:47 pm

    From a command line, you can run the javap command to see what’s inside the class file and get your bearings. For example, if the file you received is called Test.class type this in the command prompt in the directory where the file is actually located:

    javap Test
    

    The above will allow you to find out the correct package for importing the class, and to see the method signatures in the class file.

    Also, I suspect that the right import statement should be:

    import file.utility.StringUtility
    

    That is, assuming that your own classes are located in the correct package.

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

Sidebar

Related Questions

I need to generate SVG from given DXF file. I try to archive that
I have a data structure which is as given below: class File { public
How could I go about calling a method on a static class given the
Can I find out from which class a given method's implementation is inherited? e.g.
I understand that CoCreateInstance finds the COM server for the given class id, creates
Possible Duplicate: How do you find all subclasses of a given class in Java?
I need to write a Java client application which, when given the below URL,
I need to create a global Arraylist consisting Instances of my custom class 'Book'
I have several classes that need to load some properties files, and I was
I need to create a jar file using eclipse IDE. But I am facing

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.