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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:28:57+00:00 2026-05-20T22:28:57+00:00

Hi can anyone guide me in this problem ? I am reading a .class

  • 0

Hi can anyone guide me in this problem ?

I am reading a .class file using Java reflection and that class contain some other class Reference (External References).But when i try to access/read its information using Java reflection then it will gave

Cannot Find Symbol compile time error?

Is there any way of getting the Custom data Type(means Class A got ref of Class B) of a class using Java reflection in case of reading .class file?

  1. I am reading a .class file using ClassLoader
  2. then i am reading the file and then transfer it into byte array and using defineCalss() method i will get the Class Object.
  3. After i will get information i.e. all fields of the class i use getDeclaredFields() method.

When i try to compile a .java file having external reference then it gave “Symbol not found error”
& when i compile it using some IDE i.e eclipse And then try to open its .class file to read it then it gave these errors

Exception in thread “main” java.lang.NoClassDefFoundError: LTeacherClass;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at ClassExtractManager.classInfoExtracter(ClassExtractManager.java:158)
at MainClass.main(MainClass.java:36)
Caused by: java.lang.ClassNotFoundException: TeacherClass
at java.lang.ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 5 more

If there still problem then i will post the code.

  • 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-20T22:28:58+00:00Added an answer on May 20, 2026 at 10:28 pm

    Reflection is a run-time API and I don’t think it could give you a compile-time error. Most likely there is an issue with your code such as an undeclared/unimported class or variable.

    I see two possibilities.

    If you’re writing your own classloader or whatever other solution which indeed needs dynamic class loading at run time, you cannot mix it up with references to concrete classes or interfaces unknown (unimported) at compile time. You have to rely on reflection from the beginning to the end, or cast to known types (or, more likely, interfaces, but these have to be known to compiler at compile-time).

    Another possibility is that you’re misusing reflection or classloading completely. I suspect you may have code that reads a .class file, then try to use that class by name later, assuming it works as if everything was interpreted. That would mean you’re messing up compilation and linking with execution. Roughly speaking compiler only translates symbols such as TeacherClass to relevant code (and so it complains that it doesn’t know what TeacherClass is). Reflection is used after compilation when you actually execute the code. That’s why it doesn’t affect the compiler.

    Perhaps you don’t need any of this at all? Maybe you just need to learn the basics of classpath, compilation and linking in Java?

    It’s all just guesswork based on the scarce information provided.

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

Sidebar

Related Questions

Can anyone recommend some good resources that highlight the differences between Oracle and the
Can anyone point me in the right direction on this. From reading the FAQs
Can anyone guide me in the correct way to build a colored bubble/circle programmatically?
Can anyone recommend a good library for generating an audio file, such as mp3,
Can anyone recommend software or a .NET library that will check for bounced emails
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Can anyone tell me how I can display a status message like 12 seconds
Can anyone point me to a good resource (or throw me a clue) to
Can anyone recommend a good binary XML format? It's for a JavaME application, so
Can anyone suggest me a helpful programming language which can be used to create

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.