Converting a class object back to a .class file

Hi,
How can i convert a class object back to a .class file ? Thanks

any pointers on how to do it then ? i don't have
access to the native codeIf I have understood you correctly, you have native code that generates bytecode. Currently you load the class this bytecode represents right into the classloader, but you want to save it to disk as a .class file. Right?
If so, you just have to get hold of that bytecode before it "disappears" into the classloader, and save it to disk. How you can best do this depends on exactly how you communicate with that native code.
If I have misunderstood your problem (and that's not unlikely), please try to be clearer.

Similar Messages

  • Create Class objects from an Array of File Objects

    Hi There,
    I'm having extreme difficulty in trying to convert an array of file objects to Class objects. My problem is as follows: I'm using Jfilechooser to select a directory and get an array of files of which are all .class files. I want to create Class objects from these .class files. Therefore, i can extract all the constructor, method and field information. I eventually want this class information to display in a JTree. Very similar to the explorer used in Netbeans. I've already created some code below, but it seems to be throwing a NoSuchMethodError exception. Can anyone please help??
    Thanks in advance,
    Vikash
    /* the following is the class im using */
    class FileClassLoader extends ClassLoader {
    private File file;
    public FileClassLoader (File ff) {
    this.file = ff;
    protected synchronized Class loadClass() throws ClassNotFoundException {
    Class c = null;
    try {
    // Get size of class file
    int size = (int)file.length();
    // Reserve space to read
    byte buff[] = new byte[size];
    // Get stream to read from
    FileInputStream fis = new FileInputStream(file);
    DataInputStream dis = new DataInputStream (fis);
    // Read in data
    dis.readFully (buff);
    // close stream
    dis.close();
    // get class name and remove ".class"
    String classname = null;
    String filename = file.getName();
    int i = filename.lastIndexOf('.');
    if(i>0 && i<filename.length()-1) {
    classname = filename.substring(0,i);
    // create class object from bytes
    c = defineClass (classname, buff, 0, buff.length);
    resolveClass (c);
    } catch (java.io.IOException e) {
    e.printStackTrace();
    return c;
    } // end of method loadClass
    } // end of class FileClassLoader
    /* The above class is used in the following button action in my gui */
    /* At the moment im trying to output the data to standard output */
    private void SelectPackage_but2ActionPerformed(java.awt.event.ActionEvent evt) {
    final JFileChooser f = new JFileChooser();
    f.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int rVal = f.showOpenDialog(Remedy.this);
    // selects directory
    File dir = f.getSelectedFile();
    // gets a list of files within the directory
    File[] allfiles = dir.listFiles();
    // for loop to filter out all the .class files
    for (int k=0; k < allfiles.length; k++) {
    if (allfiles[k].getName().endsWith(".class")) {
    try {
    System.out.println("File name: " + allfiles[k].getName()); // used for debugging
    FileClassLoader loader = new FileClassLoader(allfiles[k]);
    Class cl = loader.loadClass();
    //Class cl = null;
    Class[] interfaces = cl.getInterfaces();
    java.lang.reflect.Method[] methods = cl.getDeclaredMethods();
    java.lang.reflect.Field[] fields = cl.getDeclaredFields();
    System.out.println("Class Name: " + cl.getName());
    //print out methods
    for (int m=0; m < methods.length; m++) {
    System.out.println("Method: " + methods[m].getName());
    // print out fields
    for (int fld=0; fld < fields.length; fld++) {
    System.out.println("Field: " + fields[fld].getName());
    } catch (Exception e) {
    e.printStackTrace();
    } // end of if loop
    } // end of for loop
    packageName2.setText(dir.getPath());
    }

    It's throwing the exeption on the line:
    FileClassLoader loader = new FileClassLoader(allfiles[k]);
    I'm sure its something to do with the extended class i've created. but i cant seem to figure it out..
    Thanks if you can figure it out

  • How to refer the parent class object from an inner class

    Hi,
    I have a class X, which contains an inner private class Y. Class X has a method getY which returns an object of class Y. Class Y has a method getParent. I want to return the object of parent class from this. The code is like this:
    public inerface IY;
    public class X {
    private class Y implements IY {
    public getParent {
    // ... return the object of parent class which created the object of this inner class
    public IY getY() {
    return new Y();
    Can somebody help me with this...

    interface IY {
    public class X {
        private class Y
            implements IY {
            private X parent;
            public Y(X x)
                parent = x;
            public X getParent()
                // ... return the object of parent class which created the object of this inner class
                return parent;
        public IY getY()
            return new Y(this);
    }Filip

  • Confused about creation of inner class object of a generic class

    Trying to compile to code below I get three different diagnostic messages using various compilers: javac 1.5, javac 1.6 and Eclipse compiler. (On Mac OS X).
    class A<T> {
        class Nested {}
    public class UsesA <P extends A<?>> {
        P pRef;
        A<?>.Nested  f() {
            return pRef.new Nested();  // warning/error here
    Javac 1.5 outputs "UsesA.java:11: warning: [unchecked] unchecked conversion" warning, which is quite understandable. Javac 1.6 outputs an error message "UsesA.java:11: cannot select from a type variable", which I don't really undestand, and finally the Eclipse compiler gives no warning or error message at all. My question is, which compiler is right? And what does the message "cannot select from a type variable" means? "pRef", in the above code, is of a bounded type; why is the creation of an inner object not allowed?
    Next, if I change the type of "pRef" to be A<?>, javac 1.6 accepts the code with no error or warning message, while javac 1.5 gives an error message "UsesA.java:11: incompatible types" (concerning the return from "f" above). Similarly to javac 1.6, the Eclipse compiler issues no error message. So, is there something that has changed about generics in Java between versions 5 and 6 of the language?
    Thanks very much for any help

    Checkings bugs.sun.com, it seems to be a bug:
    http://bugs.sun.com/view_bug.do?bug_id=6569404

  • How do I convert my smart object back into the layers I made it from?

    I was working with 100 layers or so and i converted it to a smart object to work with easier.  However some of the layers and layer modes don't interact properly with the background that is separate from the smart object.  There doesn't seem to be an option to release layers within the smart object.  I attempted to solve the problem by dragging the layers from the smart object editable file but it didn't line up within the original file...extremely frustrating.  Any solutions? PS6 BETA Lion OSX

    It was created inside the file.  They were differnt dimensions though because the layers selected to become a smart object had different bounds beyond the canvas.
    The issue was that once I dragged layers from the editable file that was the smart object I would attempt to realign them BUT I have so many adjustments with masks that we'ren't linked so they wouldn't move with my realignment move(even a control+t)...I ended up going back in and relinking them all(which took really long) in order to realign things. 
    But really it would be so much easier if i could have just clicked re-add layers to file or something.
    No problem Howard, thanks anyway.

  • Can you convert a 3D object back into a 2D layer?

    I am drawing out a map of a world and need to design the poles while the layer is in a 3D sphere to prevent distortion. In CS5, I would turn the layer into a 3D.sphere, draw on it to map out the land masses, then turn it back into a 2D layer and refine. However, I can't seem to do this on CS6. Is there a way for me to do that?
    Thank you.

    double click on the sub layer of the 3d layer in the layer panel.  This should open the diffuse layer that you're working on.

  • [b]How to convert a Socket object in a C socket file descriptor[/b]

    Hi all,
    I need to make a getsockopt() call using JNI, but I don't know how to convert a Java Socket object in the integer corresponding to the socket file descriptor.
    Thank you in advance!
    Fernando

    I was wrong in my previous post. FileDescriptor is used for PlainSocketImpl. This means I can give you a solution.
    The solution does involve rebuilding some built-in Java classes to make certain fields accessible.
    You have to modify access to three classes:
    1. You can either use my SocketGetImpl or just rebuild java.net.Socket and change from
    SocketImpl getImpl() throws SocketException {
    to
    public SocketImpl getImpl() throws SocketException {
    2. In java.net.SocketImpl change from
    protected FileDescriptor getFileDescriptor() {
    to
    public FileDescriptor getFileDescriptor() {
    3. In java.io.FileDescriptor I would add the method
    public int getFd(){ return fd; }
    Then my test program becomes:
    package myhack;
    import java.io.*;
    import java.net.*;
    public class DoSock {
            public static void main(String args[]) throws Exception{
                    Socket s= new Socket("mywebserver",80);
                    System.out.println("s="+s);
                    SocketImpl si = SocketGetImpl.getImpl(s);
                    System.out.println("si="+si);
                    FileDescriptor fd = si.getFileDescriptor();
                    System.out.println("fd="+fd);
                    System.out.println("fd int="+fd.getFd());
    }And you still have to invoke as:
    java -Xbootclasspath/p:. myhack.DoSock
    or boot path pointing at jar file, etc.

  • Can a derived class catch base class object

    can a derived class object catch a base class object
    e-g if i have a class
    class Test {
    // code
    }and
    class Test2 extends Test {
    }and lets say there is a method that return an object of Test (base class), so is it possible to write
    Test2 t=getTestObj(); // i-e subclass holding base class objectif its not.. how can we do so? so that derived class should hold base class object....

    sorry..
    here is how it goes
    i have a function a class
    public Test getObj() {
    // code
    }The constraint is that i cant change the implementation of this above function.
    Now when i call this function, it returns me a Test object. But i cant do
    Test t=getObj();because the Test class is written purely in java whereas i want to use write a new Test class that implements the same functionality [using the above given function] in JNI.
    so what i did, i created a new package [nativ] and created a class "Test" in that. But since i have to use the function that returns me Test and not "nativ.Test", so what i did, i inherited nativ.Test from "Test" so that the object might resolve the reference.
    So this is it.. that i cant modify the function and i need some way to do it.. plz reply

  • Dealing with functions not in class Object

    Hi,
    while i was working on GJ i faced the following problem, when i write a generic class i have to take into my consideration those functions that i want to define for the row type class and not included in class Object (toSting() is in class Object but print() is not). of course every time i want to call print() from the generic class the compiler gives me an error becuz it is not in class Object.. is there anyway to get rid of this problem in a simple way without having to deal with more than one row type ?
    thanks everyone

    I think I see what you're getting at...the GJ compiler substitues Object for all unconstrained type parameters, and therefore tries to call methods on parametized type objects as if they were simply of type Object.
    A solution would be to create a base class (or interface) AbstractRow that declares all the methods you need. Then constrain your parameters against AbstractRow. Eg:
    public interface AbstractRow
    public AbstractRow rowMethod();
    public class MyClass<RowType extends AbstractRow>
    public RowType doSomething(RowType rt) {
    rt.rowMethod();
    I think that should work. I'm not sure what you meant by "without having to deal with more than one row type." If you meant "without having to introduce an inheritance hierarchy," then no, this is not possible in GJ (as far as I can tell). If you meant "without having to write adapters for every single row type," then yes.
    shaun

  • OWB ERROR:  created with second class object failure

    I'm getting this error when I import a table into the repository. any ideas?
    created with second class object failure

    Hello!
    Second class objects are columns, indexes, constraints etc. Probably some of these contains reserved OWB keywords. You can check what went wrong by drilling down to these objects on the results screen.
    Regards,
    Robert

  • LOADJAVA이용시 JAVA CLASS OBJECT의 권한 문제

    제품 : SQL*NET
    작성날짜 : 2004-01-14
    LOADJAVA이용시 JAVA CLASS OBJECT의 권한 문제
    ====================================
    PURPOSE
    Java Stored Procedure를 이용하기 위해 java class를 DB로 load할 때 loadjava를
    이용할 수 있다. 이때 loadjava 수행시 권한 오류나, java stored procedure(JSP)의
    owner와 다른 owner로 java class를 load하고 JSP에서 사용하는 경우의 권한
    부여 방법 등을 확인해 본다.
    Explanation & Example
    1. loadjava와 dropjava의 간단한 실행 방법 및 관계된 objects들
    loadjava command는 가장 간단하게 다음과 같이 지정할 수 있다.
    -r option은 db에 load하고서 load된 java object를 compile하는 것이다.
    os> loadjava -user scott/tiger -r LJTeset.class
    이 문장을 수행하고 나면 다음과 같은 object가 생성된다.
    즉, load되는 java class외에도 2개의 테이블과 2개의 index, 그리고 한개의
    table이 생성된다.
    loadjava를 수행하는 user는 이러한 object를 생성할 수 있는 권한이 있어야한다.
    SQL> select object_name, object_type from user_objects;
    OBJECT_NAME OBJECT_TYPE
    CREATE$JAVA$LOB$TABLE TABLE
    LJTest JAVA CLASS
    JAVA$CLASS$MD5$TABLE TABLE
    SYS_C002172 INDEX
    SYS_C002173 INDEX
    SYS_LOB0000029869C00002$$ LOB
    loadjava후, 다시 dropjava문장을 다음과 같이 수행하는 경우, 이렇게 생성된
    6개의 object가 모두 사라지는 것이 아니고 LJTest만 지워지고 나머지는
    모두 그래도 남는다.
    os>dropjava -user scott/tiger LJTest.class
    즉, 일단 한번 loadjava를 수행하면 위에서 LJTest를 제외한 나머지 object는
    항상 존재하게 된다.
    2. loadjava시 다른 user가 java class이용할 수 있도록 하는 방법
    loadjava시 load된 java class를 이용하여 JSP를 생성한 owner에게 다음과 같은
    방법으로 권한을 부여할 수 있다.
    os>loadjava -user scott/tiger -g public -s -r LJTest.class
    os>loadjava -user scott/tiger -g eykim -s -r LJTest.class
    이때 -g option이 권한을 부여하기 위한 option이며, -s를 지정하면 동일한
    이름의 public synonym이 만들어져서 이 java class를 다른 schema에서도
    이용가능하게 된다.
    (NOTE) 이때, named PL/SQL에서 role을 통해 부여 받은 권한은 인식하지
    못하는 제약사항이 loadjava시에도 그대로 적용된다.
    즉, -g다음에 role명을 주는 경우 그 role을 가지고 있는 다른 user가
    해당 java class를 이용하여 JSP를 만드는 경우 해당 java class를
    인식하지 못하게 된다.
    loadjava외에 직접적으로 SQL문장을 통해 권한을 부여하여도 된다.
    SQL>grant execute on "LJTest" to scott;
    여기서 주의할 점은 반드시 LJTest java class를 지정할 때 큰 따옴표(" ")를
    표시하여야만 인식이 된다.
    이것은 grant뿐 아니고 sql문장에서 java class를 reference할 때 항상 적용된다.
    예를 들어 resolve시에 다음과 같이 하여야 한다.
    SQL>alter java class "DBTrigger" resolve;
    위의 loadjava 문장에서 -s option을 통해 public synonym을 생성하였는데,
    이것은 sql문장을 통해 synonym을 생성하여도 같은 결과이다.
    이때, user는 create public synonym권한을 가지고 있어야 한다.
    이후 dropjava 수행이 필요한 경우, dropjava시 -s option없이 public synonym도
    함께 drop되므로 drop public synonym도 필요하다.
    Reference Documents
    <Note:106753.1> ORA-29521 in Java Stored Procedure referencing Loaded Javax Classes
    Java Stored Procedures Developer's Guide Release 2 (8.1.6)", (A81358-01)

  • Convert javadoc output back to java class.

    Hi All,
    I have the javadoc for a certain specification and would like to convert that to the java interface definition class. The generated source code would be used to generate the implementation class later.
    Do you know of any utility that converts javadoc html back into java source code?
    Thanks in advance,
    Piyush.

    Just use your browser's copy and past functions to cut the text out of the documentation and then paste it into a programming editor.
    Delete the text and add a couple of semi-colons and you are all set.

  • Cannot convert type class java.lang.String to class oracle.jbo.domain.Clob

    Cannot convert type class java.lang.String to class oracle.jbo.domain.ClobDomain.
    Using ADF Business Components I have a JSFF page fragment with an ADF form based on a table with has a column of type CLOB. The data is retrieved from the database and displayed correctly but when any field is changed and submitted the above error occurs. I have just used the drag and drop technique to create the ADF form with a submit button, am I missing a step?
    I am using the production release of Jdeveloper11G

    Reproduced and filed bug# 7487124
    The workaround is to add a custom converter class to your ViewController project like this
    package oow2008.view;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    import oracle.jbo.domain.DataCreationException;
    public class ClobConverter implements Converter {
         public Object getAsObject(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   String string) {
           try {
             return string != null ? new ClobDomain(string) : null;
           } catch (DataCreationException dce) {
             dce.setAppendCodes(false);
             FacesMessage fm =
               new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                "Invalid Clob Value",
                                dce.getMessage());
             throw new ConverterException(fm);
         public String getAsString(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   Object object) {
           return object != null ?
                  object.toString() :
                  null;
    }then to register the converter in faces-config.xml like this
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
      <application>
        <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
      </application>
      <converter>
        <converter-id>clobConverter</converter-id>
        <converter-class>oow2008.view.ClobConverter</converter-class>
      </converter>
    </faces-config>then reference this converter in the field for the ClobDomain value like this
              <af:inputText value="#{bindings.Description.inputValue}"
                            label="#{bindings.Description.hints.label}"
                            required="#{bindings.Description.hints.mandatory}"
                            columns="40"
                            maximumLength="#{bindings.Description.hints.precision}"
                            shortDesc="#{bindings.Description.hints.tooltip}"
                            wrap="soft" rows="10">
                <f:validator binding="#{bindings.Description.validator}"/>
                <f:converter converterId="clobConverter"/>
              </af:inputText>

  • Problem with Dynamically accessing EJB Class objects in WL 7.0 SP1

    I am trying to build a component which has the ability to instantiate and execute
    an known EJB method on the fly.
    I have managed to build the component but when I try and execute it I get a ClassNotFoundException.
    I know that the EJB I am trying to invoke is deployed and available on the server,
    as I can see it in the console, I also seen to have been able to get the remote
    interface of the object, my problem occurs when I try and access the class object
    so I can perform a create on the object and then execute my method
    The code I have written is below:
    private Object getRemoteObject(Context pCtx, String pJNDIName, String pHomeBean)
    throws Exception {
         String homeCreate = "create";
         Class []homeCreateParam = { };
         Object []homeCreateParamValues = {};           
    try {  
    //This call seems to work and doesn't throw an exception     
    Object home = pCtx.lookup(pJNDIName);
    //However this call throws a java.lang.ClassNotFoundException
    Class homeBean = Class.forName(pHomeBean);
    Method homeCreateMethod = homeBean.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    } catch (NamingException ne) {             
    logStandardErrorMessage("The client was unable to lookup the EJBHome.
    Please make sure ");
    logStandardErrorMessage("that you have deployed the ejb with the JNDI
    name "+pJNDIName+" on the WebLogic server ");
    throw ne;
    } catch (Exception e) {
    logStandardErrorMessage(e.toString());
    throw e;     
    Any advice would be really appreciated, I'm fast running out of ideas, I suspect
    it has something to do with the class loader but I'm not sure how to resolve it
    Regards
    Jo Corless

    Hello Joanne,
    Congratulations! I'm very happy that you've managed to fix your problem. It's
    always essential to understand how to package applications when deploying on BEA
    WebLogic. Usually, by throwing everything into an EAR file solves just about all
    the class loader problems. :-) Let us know if you have any further problems that
    we can assist you with.
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Joanne Corless" <[email protected]> wrote:
    >
    >
    I've fixed it!!!!!!!!
    Thanks to everyone who gave me help!!!!
    The class loader was the culprit which is what I suspected all along.
    As soon
    as I put the 2 jar files I was using into an EAR file the problem went
    away!!!!!
    Thanks again
    Jo Corless
    "Ryan LeCompte" <[email protected]> wrote:
    Hello Joanne,
    As Mr. Woollen mentioned, I also believe it's a problem with the class
    loader.
    You need to be careful how you arrange your EJBs, because WebLogic has
    a specific
    method in which it loads classes in an EAR, JAR, and WAR file(s). Please
    refer
    to http://dev2dev.bea.com/articles/musser.jsp for more information about
    BEA WebLogic
    class loading mechanisms and caveats. Also, try printing out the various
    methods
    that are available on the object that was returned to you via reflection.
    For
    example, use the getMethods() method, which returns an array of Method
    objects
    that you can subsequently cycle through and print out the various method
    names.
    This way you can discover if the class found/returned to you is indeed
    the one
    you intend to locate.
    Hope this helps,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    Rob Woollen <[email protected]> wrote:
    I believe the issue is the home interface class for this EJB is not
    available in the class loader which is doing the reflection.
    If you do:
    getClass().getClassLoader().loadClass(homeInterfaceClassName)
    I suspect it will fail. Reflection still requires that the class be
    loadable.
    -- Rob
    Joanne Corless wrote:
    Hi Slava,
    If I make my code look like you describe below I get a compliationerror telling
    me that
    home.getMethod() is not recognised (no such method)
    If I change it slightly and use
    Method homeCreateMethod =
    home.getClass().getMethod(homeCreate,homeCreateParam);
    The code will compile OK but when executed it still throws a NoSuchMethodException
    Any ideas ?
    Thanks for your help so far
    Regards
    Jo Corless
    Your code should look like
    Object home = pCtx.lookup(pJNDIName);
    Method homeCreateMethod =
    home.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    Regards,
    Slava Imeshev
    "Joanne Corless" <[email protected]> wrote in message
    news:[email protected]...
    Hi Ryan,
    I also wanted to mention that if you do a "header search" in this
    particular
    newsgroup
    with the search query as "reflection", you will see many previousmessages
    regarding
    reflection and EJBs. I believe you could learn a lot from thedifficulties
    that
    others have faced and solved.I tried that and although there was a number of similar cases noneof them
    actually
    seem to fix my issue. Thanks for the suggestion though
    Are the EJBs that you are trying to access accessible via your
    system
    classpath?
    Try to avoid having them accessible via the main system classpath,and
    only bundle
    them in your appropriate EJB jar files (contained in an EAR file,for
    example).Maybe I should have laid the problem out a little clearer.
    I have a number of EJB's bundled up in a JAR file which is hot deployedto
    the
    server. Within this first JAR file is an EJB (SSB) component that
    needs
    to
    be
    able to invoke a known method on another EJB. This second EJB may
    or
    may
    not be
    within the first JAR file but it also will be hot deployed.
    The component trying to invoke the method on the 2nd EJB has to
    be
    able to
    create
    an instance of the 2nd EJB without actually knowing anything bar
    a
    JNDI
    Name which
    is passed in at runtime.
    I can get as far as doing the
    Object home = pCtx.lookup(pJNDIName);
    This returned a class with the name
    "com.csc.edc.projects.allders.httppostoffice.postman.PostmanBean_mp8qy2_Home
    Impl_WLStub"
    My problem seems to occur when I try and invoke the create method
    Method homeCreate = home.getClass().getMethod("create", new Class[0]);
    My code throws a java.lang.NoSuchMethodException at this point so
    I
    am
    unable
    to progress to the next step of :
    Object bean = homeCreate.invoke(home, null);
    So I can return the instantiated bean back to the calling client.
    Why am I getting the NoSuchMethodException, is is because I am gettinga
    stub
    back rather than the home interface and if so how do I get the truehome
    interface
    from the bean
    Thanks in advance
    Jo Corless

  • What is the advantage of using IB to create XIBs/Class Objects over coding?

    Hi all,
    I hoping someone can provide me some pros and cons as to when I should use IB to create XIBs and/or class objects as opposed to directly coding them.
    For example, if I choose Apple's Template for creating a Navigation Based Application (cocoa touch), the project creates two NIB files - MainMenu and RootViewController.
    However looking at one of demo apps SimpleDrillDown, it does not have a RootViewController XIB and instead creates it via code.
    Another example from the same two apps is that the template generates a "Navigation Controller" class object in the Mainmenu.xib. SimpleDrillDown does not bother with this in the XIB, but uses code to generate the controller:
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Create the navigation and view controllers
    RootViewController *rootViewController = [[RootViewController alloc] init];
    UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
    self.navigationController = aNavigationController;
    [aNavigationController release];
    [rootViewController release];
    // Configure and show the window
    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
    as opposed to the template which only needs this:
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Configure and show the window
    // Navigation Controller is defined in MainWindow.xib
    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
    So what are the advantages of each approach. Why does apple suggest one approach and yet all its demos use another.
    Any thoughts, answers gratefully received.
    TIA, Michael.

    You can do whatever you're comfortable with, but most of the best Cocoa programmers--the ones on the Mac, I mean--recommend putting everything you can into Interface Builder.
    It's a little like the difference between writing a program to do a bunch of financial calculations and using a spreadsheet. Yeah, the program can do everything the spreadsheet can--and more besides--but you'll find it far easier to create, use and modify the spreadsheet.
    Interface Builder takes away a lot of completely meaningless choices ("What order should I create the objects in? How should I name the variables? How should I create their frames? What order should I set the attributes in?"), leaving you with an interface optimized for creating and arranging objects, and allowing your code to focus on what you really do need to think about--your application's logic.
    (By the way--part of the reason Apple's demos don't all use Interface Builder is that the very first SDK releases didn't have it. Back then, you had to create all your views programatically. Believe me, I have no wish to go back to setting autoresize masks manually. Now get off my lawn, whippersnapper.)

Maybe you are looking for

  • Invoice Verification for IMPORT PO(ASSET)

    Hi All, User has created Purchase order against Import Material for asset with Account Assignment category as A.While invoice verification for basic customs duty,ECS and HSES, system debiting the GL account for Asset instead of CenVat clearing. In ca

  • Error when create listener - thespecified IP Address 'IP' is not valid in the cluster-allowed IP range.

    Hi... I'm able to configure AlwaysOn and all things are great. I have a problem only when create a listener , I have two node in same data center (SQLP1,SQLP2) and one in DR data center (SQLD1)  SQLP1 + SQLP2 > Sync SQLD1 > Async The error I face is 

  • Spry Photo Gallery - How to add links to images

    I was wondering if any one knew how I could add individual links to images on the spry Photo Gallery-An XML-based photo gallery. I need each image to have its own individual link when clicked on. Any assistance would be most helpful.

  • PO Validity Date

    Hello The requirment is once the PO validity date is over, then system should not allow any GR or IV against the PO. Is their any std SAP message which can control this. Regards Niti Narayan

  • Tables in one Scrollpane?

    I have two tables with same no. of columns.They Should not have a different scroll pane. Table 1columns should be tightly cupoled with Table 2 columns. If we drag Table 1columns, Table2 column should also follow. Can we have one scroll bar for both t