Class heirarchy question

This beginning of this post sounds similar to another of my recent posts. The end question is different. I'm just providing the atmosphere for the situation
I am coming from a c++ world into objective-c++/cocoa. I work for a company that sells static libraries to be used by other developers. Distributed with these libraries are, of course, the header files.
Currently, I am tasked with adding cocoa support to out library. I am using a subclass of NSOpenGL (we'll call it myNSGL) to render to. For proof of concept, I placed the rendering code in the instance methods of myNSGL, and called them from my controller class. This all works fine, able to render, and so on...
Now, I need to move this rendering code from the myNSGL class to inside our static library, abstracting it from the end user. This is where I have some questions.
In the class myNSGL, I am overriding the initWithFrame method. It creates an NSOpenGLPixelFormat then calls [super initWithFrame: pixelFormat:]. Fine, no problem. Here is the problem. I want to move all custom code (setup, rendering, etc...) inside the static library and only provide client developer with the h and mm files (In IB, they'll need to set the View's class to myNSGL). My question is, How can I initialize myNSGL's super class from inside my lib code? This call is vital, but I don't want it exposed to the client developer. Maybe this will help to visualize:
// Client Application code:
// client.h:
#include "myNSGL.h"
@interface ......{
myLib *_mylib;
IBOutlet myNSGL *_mynsgl;
// client.mm:
#import "client.h"
@implementation .......
- (id)init{
// use instance of my static lib.
_mylib->initializeNSGL();
// more calls to _mylib...
@end
// Static lib, lib.cpp:
#include "myNSGL.h"
class myLib{
private:
myNSGL* _mynsgl;
NSOpenGLContext* _context;
public:
void initializeNSGL()
GLuint attribs[] =
NSOpenGLPFAWindow,
NSOpenGLPFADoubleBuffer,
0
NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*) attribs];
// PROBLEM!!! can't call anything on myNSGL's super.
[_windowRef [super initWithFrame:[_windowRef frame] pixelFormat: [fmt autorelease]]];
//////////////////////////////////////////

Your client developers shouldn't need any .mm files. All you should distribute are the headers and the library.
What you need to do is separate the headers into a public interface and a private interface. The public interface should contain all a client should ever need to see, plus instance data. The private interface is implemented as an Objective-C category. Then, your .mm files will import both the public and the private interfaces.
If you want to hide your instance data, that will be more work. You would have to use protocols or maybe dummy header files. You could maybe have a build stage that strips the data out of the headers and exports them into your framework. I don't know if that would work or not - probably not.

Similar Messages

  • Inheritance in the java class heirarchy

    ok two questions.
    1. in the java class heirarchy, do the subclasses inherit all of the concrete methods from the superclass, that the subclass has not overridden. Or just some of them as Sun has deemed necessary?
    2. In the situation where you have a custom class that extends another class, can you invoke all of the constructors in the superclass using the super keyword, or just some of the constructors?
    Thanks.

    Fguy wrote:
    ok well the Java Tutorial is clear enough on inheritance I suppose. A subclass inherits all of the public and protected members of its parent so I suppose in as much as Sun probably wrote some private methods then that would answer that question.
    But it isn't quite so clear on invoking super class constructors. You mention "the usual access rules" which is fair enough, but the Tutorial isn't too clear on those rules that I can see. Al I can see is the constructor of the superclass can be invoked from the subclass. http://java.sun.com/docs/books/tutorial/java/IandI/super.html
    But you are implying that there are in fact access rules that can prevent a superclass constructor from being invoked from the subclass. Can you give an example? Would it be a situation where said superclass constructor is accessing one of it's private methods? or does that not matter?
    Thanks.If the superclass has an inaccessible constructor (for example, a private constructor which can only be invoked from the superclass itself), there you go.

  • Class architecture question

    I am coming from a c++ world into objective-c++/cocoa. I work for a company that sells static libraries to be used by other developers. Distributed with these libraries are, of course, the header files.
    Currently, I am tasked with adding cocoa support to out library. I am using a subclass of NSOpenGL (we'll call it myNSGL) to render to. For proof of concept, I placed the rendering code in the instance methods of myNSGL, and called them from my controller class. This all works fine, able to render, and so on...
    Now, I need to move this rendering code from the myNSGL class to inside our static library, abstracting it from the end user. This is where I have some questions.
    I am compiling myNSGL into the static library. I would hope that providing ONLY the h file to the client application developer would be enough. There is a problem however. The client application will compile with the header and static lib, but at runtime it complains that interface builder doesn't know what myNSGL is. In IB, I have the view's class set to myNSGL, but without the myNSGL.mm file, interface builder is lost. The question is: Is there a way to distribute ONLY the lib and h file to customers (not the lib, h, AND mm file)?
    Thanks for reading

    Hi Zakk - I think this thread is going to need Etresoft, but I have a few questions.. and on the odd chance that one of them is relevant, you'll be ahead of the game to have the answers already posted by the time you get some more help.
    ... adding cocoa support to our library
    This line scares me so I'd like to rule out my worst fears before continuing. Please tell me the Cocoa support will be a separate binary, ok?
    I would hope that providing ONLY the h file to the client application developer would be enough.
    Yes, the header certainly should be enough. Otherwise, I don't think anyone would claim that Cocoa is object oriented. AFAIK a header is all we get to see of any Cocoa framework.
    at runtime it complains that interface builder doesn't know what myNSGL is.
    Erm.. IB doesn't have anything to do with runtime. So could you clarify that? If you're getting a runtime message about IB, please post it, ok?
    In IB, I have the view's class set to myNSGL, but without the myNSGL.mm file, interface builder is lost.
    AFAIK IB only reads the @interface files. I've been confused about this in the past when it seemed like IB was in fact responding to a change in the @implementation, but each time it seemed that way further testing showed I'd reached the wrong conclusion. Of course, if someone who wasn't a team player snuck a @interface into your .mm, all bets are off.
    In general, I would be sure the .h's were correctly included into the project and I would review some of the docs on building a Cocoa library. The easiest way to make sure Xcode is set up correctly would be to start the project with the OS X Cocoa Static Library template. I had a couple ADC links to post for you, but suddenly all my dev site links are broken. Let me know if you have any shortage of library docs.
    \- Ray
    p.s.: Just saw you already have Et's attention.

  • Preloader and Document Class BIG question (yeap please help)

    Hy,
    I know that this its a question posted many, many times, but
    after searching the net, reading a lot of books and searching this
    forum too, I cant get out with a solution. If I'd say for sure
    there is no possibility to create something like this, I just go
    back to old methods but is not the scope of Adobe with AS3 to
    encourage the use of OOP principle or not?
    The problem:
    I have a single fla file (AS3) with a single frame on
    timeline, frame that its there when you will create the file with
    flash. In the library I have different symbols, that for simplicity
    are only jpg image, (BitmapData) checked for export for
    ActionScript and exported on frame one. An external .as file called
    DocumentClass its off course my Document Class
    This its all that I want to do with the fla, the goal its to
    create, animate etc. only with AS3 in external classes, no timeline
    script. I don't want to load external files, XML, or else in this
    movie. I just want a single swf after compilation, no additional
    files.
    Ok, how do I create a preloader that will take care of
    starting the logic after the whole swf its loaded and in the same
    time shows the user a percentage or a load bar or something that
    its not the blank screen when the swf its downloading. I want to do
    this without another swf that load this swf, or timeline scripts,
    or place all the content on second frame and then gotoAndStop to
    the third frame. All this are not solution but cheap tricks, that
    are against all this OOP principle that I just continue to read in
    books and here from guru programmers.
    The big question is:
    It is possible to create a preloader, when use a document
    class with your fla? And if yes, how?
    I know that the Document Class its not instantiated if its
    not fully loaded, if that's true when the document class will be
    fully loaded? maybe after the whole movie its loaded? And, if its
    true, it will never show a percentage bar "while" the movie its
    loaded. And if that's true WHY use a document class anyway?
    Thank you for reading this and I really wait to get some
    answer.

    I am pretty sure you cannot do self preloader with one frame
    and all the objects in the library. I guess the key here is
    one-frame design. Screen refreshes (renders) only when all the
    scripts in the frame are executed - this is a very important thing
    to understand about how Flash works. Yes, you can force screen
    refresh with updateAfterEvent() method but it is attached to a
    handful of events only (MouseEvent and TimerEvent) but, again, all
    this functionality is available only after first frame scripts are
    executed. Thus, it seems like the only way to create preloader from
    within SWF is to use multiple frames and set library objects to
    load in later (not first) frame.
    quote:
    And if that's true WHY use a document class anyway?
    Well, preloader is the last thing that would be on my mind in
    terms of using AS3 ability to link DocumentClass to the top movie.
    This feature allows for very sophisticated architectural
    approaches. It has no connection to preloader as to any other
    features developer wants to implement. Neither it depends on or
    negates timeline. As a matter of fact, although I love one-frame
    applications, I find on numerous occasions that my application
    would be more efficient if I used several (at least two) frames.
    gotoAndStop is not deprecated. It is a valid MovieClip class'
    method. After all, having only one frame doesn't mean not having
    frames at all - there is one already. Frames are fundament of
    Flash. AS3 did introduce frameless entities like Sprite, etc. but
    it doesn't mean that frames are going anywhere.
    I would agree that timeline code is inferior to
    classed/packaged (read: better organized) code but, still, how is
    it not OOP? Frame is an Object, right? Why using timeline is cheap
    and not a solution?
    On a side note, I see too many times how some authors (and
    managers) are pushing their agenda (or close mindedness) onto their
    audience with no real substantiation. Claiming that timeline in
    Flash is not valid architectural decision from OOP standpoint is
    totally wrong. As wrong as strict adherence to design patterns. I
    don't think there is sharply defined "right" or "wrong" in
    programming. One finds the best optimal solution. The goal is to
    create something that works fine. Unless, of course, the process is
    the goal - but very few of us can afford focusing on the process.

  • Document class import question

    I had wrote a previous post about output errors I was receiving when trying to load an xml photogallery. The error wer output errors only and ended up not effecting the swf (at least I didn't think so) after go ing nuts about a week I came across a post on another forum a few months back as someone else was asking the same question and it turns out someone else answered. It has to do with an external.as file, I know that the photogallery has other files that need to load besides the swf. the image, xml and a folder with 6 .as files.
    SO I know that I was not importing those files to the swf I was calling the photogallery to load into and I now understand this but here is my question.
    How do I import the 6 .as files as they sit in a folder called GS? Do I have to import each one separately thru the properties inspector?
    rder

    OK zip is here
    http://www.mediafire.com/?eqmiyit4yi5
    with the following files
    main.fla / swf
    folder swfs
    (inside)
    gallery1.fla,html,swf
    gallery2.fla,html,swf
    folder GS
    (inside)
    .as files various
    folder load1
    (inside)
    xml, images
    folder load2
    (inside)
    xml, images
    main.swf calls the loader
    problem:
    galleries open and function but with output errors
    I know it has something to do with importing the class paths .as files after each gallery is swapped out I should see an output message "gallery destroyed" but instead see null reference errors
    any help in resolving this would be great
    rdef

  • Classes intercommunication question

    hello folks,
    another newbie question:
    I have a JDialog with 3 components:
    pane with 2 JRadioButton's
    JButton,
    and JScrollPane with a JList in it
    elements of a Jlist are of my own class A and I am rewriting its toString() method, so elements of my class are correctly displayed in JList.
    Now here comes the question:
    this toString() method must depend on what JRadioButton is selected in a JDialog.
    how do I do it? should I send the JDialog reference to my Class constructor?
    thanks

    That's a pretty confusing question without any code to look at. My first reaction is to say to pass some argument (something unique about the JRadioButton that's selected) to your toString() method so it can choose what to return.

  • Class loader question

    Hi,
    I got NoClassDefFoundError and when I use ClasspathDebug jsp it shows that the class is loaded by "java.net.URLClassLoader". I put the jar file containing the class in <domain>/lib directory. According to docs the jar under <domain>/lib should be loaded by system class loader. what is "java.net.URLClassLoader"? why isn't system loader loading my class? I am using wls91. Thanks
    weblogic.servlet.jsp.TagFileClassLoader
    weblogic.utils.classloaders.ChangeAwareClassLoader
    weblogic.utils.classloaders.GenericClassLoader
    weblogic.utils.classloaders.GenericClassLoader
    java.net.URLClassLoader
    sun.misc.Launcher$AppClassLoader
    sun.misc.Launcher$ExtClassLoader
    Bootstrap classloader

    I'm not sure from reply 2 whether you figured out what's going on or not. It sounds like you did, but just in case...
    The null/primordial/bootstrap class loader loads classes in the core API--stuff it finds in the ext dir(s?) (e.g. rt.jar)--Object, String, java.util.*, java.sql.*, etc. It has no parent. It is the root of the normal delegating classloader tree.
    The system classloader is the one that uses classpath to load your classes and 3rd party classes. Everything not in the core API, as long as neither you nor those other classes explicitly specify a different classloader.
    The way the normal delegation mechanism works is that a request to load a class is first passed to the loader that loaded the current class. This loader first gives its parent a chance to load it, and so on up the tree to the primordial loader.
    Once it hits the root (null/primordial/bootstrap), that classloader tries to load it. If it can't (and the primordial loader can't, in fact, load your class, since it's not in the ext dir), then it hands it back to its child. This continues down the line, with the parent getting first shot at loading, then the child trying if the parent fails.
    The primordial loader (which loaded the JdbcOdbcDriver) can't load your class. It hands it back to its child--the system classloader--which can and does load it, using classpath.
    I hope that answers any lingering questions, if there were in fact such questions.

  • Deploying multiple beans & support classes, related questions

    I have an application that I'm trying to deploy to the latest JServer with Oracle 8i 8.1.6 on Windows 2000. We used JDeveloper to write the code and to deploy the EJBs. I have some questions and it'd be great if someone can answer them.
    All documentation seem to indicate that beans must be deployed one at a time. Is this the case? If not, how?
    If so, what is the "correct" way to deploy helper classes which are used by more than one bean?
    Is there always only one instance of a class in the database, even though I might deploy the same helper class with different beans? If not, is there any mechanism to ensure consistency?
    Can I just update a helper class in the database?
    How do I see what classes are in the database? How do I manipulate them (e.g. delete, change, add, view size) ?
    Is there an easy way to "clean out" the database of all classes, so as to start anew?
    null

    The Java-related documentation was that I was reading. I have a followup question. Is it possible for me to simply deploy some beans without regard for all the helper classes, then at a later point do a load java on all classes that I expect to use, and have it all work?
    Thanks. You've been great help.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDev Team (Laura):
    Hi Gerald,
    I will take a stab at answering your questions:
    1. Are you talking about the JDeveloper doc, or the Oracle8i EJB doc?
    2. When you create the Deployment Profile in JDeveloper using the Deployment Profile wizard, any classes your EJB depends on should get included in the deployment archive by the dependency analyzer. You can see the contents of what will be deployed by selecting the Preview button on the Sources page of the wizard.
    If you want to explictly EXCLUDE a helper class because it has already been deployed with another bean, you can choose the Advanced button. Select one of the Library, archive, class pages on the Advanced dialog, and add the class to the Exclude list. Select OK, then check the Preview button again to make sure it was excluded.
    If you are deploying a number of beans that user the same helper classes, the helper classes will get deployed with the first bean, and on subsequent deployments, the process will detect that the helper class has already been deployed and will check to see if it has changed since the last deployment. I believe it uses a timestamp comparison for this, but I'm not positive. If it detects the source and target are the same, it won't redeploy the class.
    If you just want to update a helper class for the EJB, you can use the Java Stored Procedure deployment in the Deployment Profile Wizard, include the helper class in the deployment archive, and do not publish anything.
    You can use the Database Browser in JDeveloper to see what deployed Java Classes, and EJBs are stored in your database. Double-click on the IIOP connection you used to deploy the EJBs (under the Connections node in the Navigator). This will display the Database Browser. Expand the appropriate nodes to view the deployed objects.
    To see deployed Java Classes, double-click on a JDBC connection and expand the Schema node and then the Deployed Java Classes node.
    Many operations are available from the context menus in the Database Browser, including Drop. Others you will have to perform from SQL*Plus or the command line. See the Oracle8i Java Developer's Guide for more information on SQL commands and command line syntax for altering Java objects in the database. This doc, and the EJB and CORBA Developer's Guide are available online from OTN on the Doc pages.
    You can use dropjava to drop all classes that were deployed in a given deployment archive by specifying the name of the jar file used during deployment. Again, see the Java Developer's Guide for the syntax.<HR></BLOCKQUOTE>
    null

  • Class design question: Can you have an enum of class objects?

    Hi, thank you for reading this post!
    We all know that an enum represents a set of constants, but sometimes a class has a restricted set of values as
    well. My question is can we have an enum of objects.
    Example:
    We have a class named Coin
       A coin with a monetary value.
    public class Coin implements Measurable
       private double value;
       private String name;
       public Coin(double aValue, String aName)
          value = aValue;
          name = aName;
       public double getValue()
          return value;
       public String getName()
          return name;
       public double getMeasure()
          return value;
    }We all know that a coin has a set of values "Dollar" = 1.00, "Quarter" = 0.25, "Dime" = 0.10, "Nickel" = 0.05, and
    "Penny" = 0.01.
    Can we have an enum of Coins with Coin as a class at the same time?
    If yes, how do we do this?
    Thank you in advance for your help!
    Eric

    Maybe you want something like this:
    public enum Coin implements Measurable {
         DOLLAR(1.00, "Dollar"),
         QUARTER(0.25, "Quarter"),
         DIME(0.10, "Dime"),
         NICKEL(0.05, "Nickel"),
         PENNY(0.01, "Penny")
         private double value;
         private String name;
         Coin(double aValue, String aName)
              value = aValue;
              name = aName;
         public double getValue()
              return value;
         public String getName()
              return name;
         public double getMeasure()
              return value;
    }

  • Voice-Class Codec question

    What is it meant by allowing g711 30ms and g729 60ms.. I know this has to do with the bytes per frames, but how would you put that in the voice-class codec command.. How do you come up with the the total of bytes to accomplish the task...?

    i didt get your question,do you mean this?
    voice class codec 101
    codec preference 1 g729r8 bytes 40
    codec preference 2 g723r63 bytes 48
    codec preference 3 g723ar63 bytes 48

  • Interfaces vs classes (performance question)

    I have three classes A, B and X.
    Both A and B use X but they use different methods so I defined two interfaces for X: XA and XB.
    This works fine but is not really necessary - so my question is does this affect performance in any way or is it just a compile time thing?
    Thank you

    TomsterG wrote:
    dcminter wrote:
    That's rarely a good design criterion - although if a class is difficult to work with, it indicates that there's probably something wrong with it.yes yes i know, all good points.
    I really only wanted to know about the performance issues though :)I think you might want to find another site. I can tell that so far you are really not going to like it here.
    You have a design that is broken. I suspected it in reply 1. Other said the same thing and when you said more about your problem it was confirmed. And now your response is "I really only wanted to know about the performance issues"?
    Seriously. You are not going to like the replies you get on this site. We don't give a flying whatsit about performance issues when it comes at the cost of having a horrible design with classes with 100 methods. Because nobody here wants to maintain applications built on that abortion of a design so we all do our best to discourage that sort of thinking.
    But your replies really suggest that you don't get it, you don't care and you think you are superior in your needs and ideas to anyone who might be interested in responding to your posts.
    It's a waste of your time.

  • Class extends question

    Hi Ive written a program in java3D and my class extends JFrame because i using swing for my GUI however i now want to use the mouse picking thing in java to click on shapes on my canvas which i see isnt 'too' hard but i cant now extend a second thing can i? is there a way around it? the code below is exactly what i want but it extends MouseAdapter which mine cant ?
    import com.sun.j3d.utils.picking.*;
    import com.sun.j3d.utils.universe.SimpleUniverse;
    import com.sun.j3d.utils.geometry.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Pick extends MouseAdapter
      private PickCanvas pickCanvas;
    public Pick()
        Frame frame = new Frame("Box and Sphere");
        GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
        Canvas3D canvas = new Canvas3D(config);
        canvas.setSize(400, 400);
        SimpleUniverse universe = new SimpleUniverse(canvas);
        BranchGroup group = new BranchGroup();
        // create a color cube
        Vector3f vector = new Vector3f(-0.3f, 0.0f, 0.0f);
        Transform3D transform = new Transform3D();
        transform.setTranslation(vector);
        TransformGroup transformGroup = new TransformGroup(transform);
        ColorCube cube = new ColorCube(0.3);
        transformGroup.addChild(cube);
        group.addChild(transformGroup);
        //create a sphere
        Vector3f vector2 = new Vector3f(+0.3f, 0.0f, 0.0f);
        Transform3D transform2 = new Transform3D();
        transform2.setTranslation(vector2);
        TransformGroup transformGroup2 = new TransformGroup(transform2);
        Appearance appearance = new Appearance();
        appearance.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_BACK,0.0f));
        Sphere sphere = new Sphere(0.3f,appearance);
        transformGroup2.addChild(sphere);
        group.addChild(transformGroup2);
        universe.getViewingPlatform().setNominalViewingTransform();
        universe.addBranchGraph(group);
        frame.addWindowListener(new WindowAdapter() {
           public void windowClosing(WindowEvent winEvent) {
              System.exit(0);
        frame.add(canvas);
        pickCanvas = new PickCanvas(canvas, group);
        pickCanvas.setMode(PickCanvas.BOUNDS);
        canvas.addMouseListener(this);
        frame.pack();
        frame.show();
    public static void main( String[] args )
        new Pick();
    public void mouseClicked(MouseEvent e)
        pickCanvas.setShapeLocation(e);
        PickResult result = pickCanvas.pickClosest();
        if (result == null)
           System.out.println("Nothing picked");
        else
           Primitive p = (Primitive)result.getNode(PickResult.PRIMITIVE);
           Shape3D s = (Shape3D)result.getNode(PickResult.SHAPE3D);
           if (p != null)
              System.out.println(p.getClass().getName());
           else if (s != null)
                 System.out.println(s.getClass().getName());
           else
              System.out.println("null");
    }

    hi,
    first, you don't have to extend JFrame (even it seems convenient), try to honor the composition over the inheritance. second, if you listen to key or mouse events, usually it's enough and perfectly ok to implement proper listener interface and then implement its methods (fulfill the contract).
    what you did (extnding some mouse listener) i would assume that you're trying to implement a new mouse listener with specific behavior. but what you actually want is just to use it.
    this question is "on the edge" since it involves some general design decisions (so it could be in java programming section) and at the same time it touches the j3d apis (so it can be here).
    hope it helped;)

  • Class Character question!

    when I was doing a small test for class Character, I got a problem, here is the code:
    String a="Apple,
    grape";
    String tempString="";
    for( int i=0; i<a.length(); i++){
    char ch = a.charAt(i);
    tempString += ch;
    It doesn't work, since compiler will complain that there is no ';' after 'Apple'. I wonder how I do some change so that program know to read the next line?

    J-Star:
    Yes, I think I didn't ask a good question. could you please go to the message I post( Reader.skip() not work in my code? ) to see a related question?

  • Classload.load and Class.forName question

    I know there are several threads about this, but I have a doubt.
    I'm getting a ClassNotFoundException running the JUnitSampler of JMeter.
    This test is run by maven (using a specific plugin for it). This plugin creates a new Thread to call JMeter with all the parameters that needs.
    The class that the JUnitSampler is trying to run is in the classpath (is not jar).
    I know this because I run maven with -X parameter and it shows this:
    [DEBUG] Test Classpath :
    [DEBUG]   /path/to/project/target/classes
    [DEBUG]   /path/to/project/target/test-classesLooking at JUnitSampler code I can see this
    theclazz = Thread.currentThread().getContextClassLoader().loadClass(className.trim());Is there any reason that the class couldn't be found?

    No idea - it is your code.It's JMeter code, not mine.You said it couldn't find your test classes.
    >
    My original question was about if there were any
    difference in using
    Class.forName
    or
    Thread.currentThread().getContextClassLoader().loadClass
    No idea. You can print the class loader though.
    That was because the JUnitSampler is using the second
    option to instantiate the test classes, and
    I was receiving a ClassNotFoundException. That
    problem is now solved, because it can find the class,
    but is unable to cast it to TestCase.
    I want to know if there is a way to put my test
    classes in the ClassLoader that JMeter is using.You have an instance of some class.
    To create that class it was loaded by a class loader.
    You can get that class loader via the methods of java.lang.Class.
    You can use that class loader to load your class.
    That might or might not solve your problem.
    Because there are any number of ways it can fail to solve you problem. Below is one, one of many, that might do it.
    It won't solve it if you have already loaded your class via the system loaders which will happen if you use absolutely any reference to it.

  • Variable class names,QUESTION

    how do I get information from a class using a String for the class name? (in an applet)

    whether you are in an applet or java application, just use Class.forName to retrieve a java.lang.Class instance for that class- then you can get field or method informaiton. There are additional security restrictions in applets, so you may not have access to the particular class, but, if it is accessible, java.lang.Class.forName("yourClassName") is the best choice.

Maybe you are looking for