Overriding existing classes

Can you override existing Sun Java components ?
Is it possible say to have a 'javax.swing.plaf.basic.BasicButtonListener' class in your local jar file, and for this to override the normal class ?
I do not really intend to do this unless absolutely necessary, but would like to know if it works as a way of overriding "built in" classes ?

No, you can't.
(At least, you can't do it that way. But I understand there's a thing called the "boot classpath" where you can put classes to do that -- haven't ever done that myself, but you could look it up.)

Similar Messages

  • How to Modify Override Handler class in jsse.jar

    Hi,
    Is there a way to change port number in Handler class in jsse.jar and recompile the Java file, or override the class?
    The Handler class seems to be using port number 443, whereas the the Webserver of PS Application is using a different port number (7004).
    Any ideas.
    Thanks
    Jay

    You're over-thinking this. The Handler class uses whatever port it is told to use by the person that constructs it. 443 is just the default.
    All you have to do is put the required port number into the https URL, e.g. https://www.myhost.com:7004.

  • Is it possible to override super class constructor?

    Is it possible to override super class constructor form subclass?

    However, you can achieve do something that looks similar to overriding.
    class Parent {
      Parent(int i, String s) {
        // do stuff
    class Child extends Parent {
      Child(int i, String s) {
        super(i, s);
        // do Child stuff here
    new Parent(1, "abc");
    new Child(2, "xyz");Although that's not overriding, it sort of looks similar. Is this what you were talking about?

  • Classloading a class that depends on non-existent classes..

    hi,
    an application i am working on needs to be run in an environment where it will dynamically load existing classes (which i have no control over) that might depend on API that we no longer ship. I don't want to reimplement the API so instead would like to detect and ignore the class completely.
    it would be possible to just ignore all classes, but this throws the baby out with the bathwater - its better to be able to do as much as possible and just ignore those classes we can't load at all
    is there a way of detecting whether a class you are loading depends on classes that aren't currently loaded using the standard library API? (using jreversepro you can get access to the entire constant pool but i'd prefer to avoid this if possible)
    the language. spec. says that a ClassNotFoundException can be thrown lazily (i think this is also how the sun vms work?) - ie not until the reference is actually used
    ClassLoader.loadClass(String fqn, boolean resolveBindings) looks the most promising but the lang. spec. implies it won't actually moan about this?
    any help appreciated,
    thanks,
    asjf

    Try loading the class with the java.lang.Class object. This way you can catch the noClassDefFound error.
    I've used this to determine that they aren't using Microsofts VM. I'm not certain that it will work in your case, but here is my VM example....
    try
                   Class SystemVersionManager;
                   Object VMVersion;
                   Method getVMVersion;
                   Method getProperty;
                   Object[] inc = {"BuildIncrement"};
                   String a = "";
                   Class[] arg = {a.getClass()};
                   System.out.println("Running IE?");
                   SystemVersionManager = Class.forName("com.ms.util.SystemVersionManager");
                   getVMVersion = SystemVersionManager.getMethod("getVMVersion",null);
                   VMVersion = getVMVersion.invoke(SystemVersionManager,null);
                   getProperty = VMVersion.getClass().getMethod("getProperty",arg);
                   System.out.println("You are running VM level " +  getProperty.invoke(VMVersion,inc));
              catch (Exception e)
                   System.out.println("You're not using Microsofts VM.");
              }It invokes the com.ms.util.SystemVersionManager and uses its getProperty() method on it.

  • Is it possible to change the name of an existing class in CSS?

    I'm painfully new to DW and gave a class a bad name - not generic or easy to ID and reuse as needed.  Is there a way to rename the existing class?  Or do I need to trash the class and make a new one with a better name?  Thanks.  -paiger

    Sure, you can just rename it in the css file and then change the references to it in the html.

  • Override Link Class in "Other CSS" Box

    Hi -is there a way to override the class of a link in the "other styles" box for a component?
    My example is this:
    I use a skin with a dark header. The text for the widgets in the header are white (Administration, etc)
    The body of the site is white.
    When I put another widget that uses the same class (x106 in this case) it makes the link color white and you can't see it on the page.
    I've tried many ways to go into the "other CSS" box (under the style tab) and none seem to work.
    Thanks.

    Hi - thanks.
    That's not exactly the problem. I know what the classes are (x106 and x107).
    The problem is that I am trying to use two "widgets" or ADF components (like the login/logout or My Favorites links) on two different background colors.
    I cannot get into the code of the ADF component to tell it to use a different class.
    Also, if I change the class (x106 for example) it changes ALL of them.
    What I think I need is a way to override the CSS for the link in the "Other CSS" box for that component somehow (I've tried many things - can't figure it out and not sure it can be done). I would think that this would override the class in the skin.
    In short - what I'm asking, I guess, is this.
    IS there a way to override the CSS LINK color for an ADF template component - OTHER THAN in the Skin's CSS file.
    Thanks!

  • Importing existing classes loses package identity in 9.0.2

    I have tried several ways, but everytime I import existing classes, they all go to Miscellaneous Files and won't display under their packages. This is from disk or from source code control (CVS). This works fine with the same exact classes and directories under JDeveloper 3.1.1. It seems simple, but it is frustrating. Any suggestions?

    Hi,
    This is normally because the Source Path setting (under Common->Input Paths in project settings) is not set to the correct directory. You should get a prompt asking if you want to add the correct path to the source path when adding files to a project.
    Thanks,
    Brian

  • Add new annotation to existing class

    Say I wrote my own annotation type:
    @Target(ElementType.TYPE)
    @Retention(RetentionPolicy.RUNTIME)
    public @interface  MyAnnotations {
         boolean isHappy() default false;
    }I can now annotate my own classes:
    @MyAnnotations(isHappy = true)
    class MyClass  {
    }However, how do I annotate classes in runtime that I couldn't annotate in source code? I don't want to change any annotation object, I want to add one to existing class. Is it possible?
    Thanks for help!
    Jakub

    emekadavid wrote:
    I don't think this is possible because at runtime, the binary representation of the classes have already been established by the java compiler. At runtime, the virtual machine loads the classes and then links the symbolic references as established beforehand, this loading and linking mechanism I believe makes it impossible for you to add any binary type to a class. It would be a dreadful security leak.um, i don't know how you would go about adding annotations to classes at runtime (the OP), but i do know that the jvm allows you to unload/reload or otherwise muck with classes at runtime (although within the bounds of the current security manager of course). there are variety of java packages for building or otherwise altering classes at runtime. one random link [http://jakarta.apache.org/bcel/] (no association with the project, just one i know of off hand.

  • Importing existing classes to Eclipse?

    Suppose i just created a new Eclipse project. Is it possible for me then to import an EXISTING class as the
    main class for this project? I have tried to do it and can't see a way. It seems to only want new classes added
    to its projects. I know i can just cut and paste, but that is a pain so i want to know if i can just bring them in.
    Any ideas? Thanks

    i tried that, and i get these options:
    select import source:
    existing project into workspace
    external features
    external plug ins and fragments
    file system
    team project set
    zip file
    none of those looks like what i need. Any advice?use import>fileSystem

  • ConversionManager - Override and Class Loader Issues

    Hi
    We are using Toplink 10.1.3 deployed withiin 10gAS 10.1.3.
    We have overridden the ConversionManger as documented in tips.
    1. MyConversionManager extends ConversionManager.
    2. We have overriden convertObject
    3. We have a pre-login SessionEventAdapter that sets the ConversionManager.
    We have had issues of classloading within the application previously, particularly where we have two versions of our application deployed on the same App Server instance (potentially with differing versions of MyConversionManager).
    For this reason we only set the ConversionManager within the preLogin event on the Session as follows:
    *//Just set the conversion manager for the session.*
    event.getSession().getLogin().getPlatform().setConversionManager(getConversionManager());
    We no longer set the default conversion manager, as my understanding was that this would set it at the root level within the OC4J instance (meaning that each deployment would override the previous).
    Additionally, we have had to sepcify the class loader to use, within the ovverriden convertObject method, as otherwise start up of Toplink falied, as it was unable to solve references to application classes specified within class indicator mappings. We do this as follows:
    *@Override*
    *public Object convertObject(final Object source, final Class javaClass) {*
    super.setShouldUseClassLoaderFromCurrentThread(true);
    The only know issue with this, is that if I try and use OEM to veiw the Toplink Cache, I just get and AnnotatedClassNotFoundException as it is attempting to use the system class loader (that does not contain our Application classes).
    Two questions therefore:
    1. Is the deployment we have now stable, i.e. overriding the class loader within the overriden Conversion Manager, and only loading this against the session??
    2. How can I get mutiple versions of the application to still work, together with being able to view the Toplink Cache from within OE:M.
    Any help or insight, would be greatly appreciated.
    Marc

    Looks fine, you may also wish to investigate using Converters in your mappings instead of customizing the ConversionManager.
    For the OEM issue, try setting the class loader to be your application class loader instead of the thread one, i.e. MyAppClass.getLoader().
    James : http://www.eclipselink.org

  • Override SWC classes in FB?

    I have a Flash Pro project with numerous items in the Library linked to Class files.
    I can successfully export a SWC and use the items in Flash Builder.
    However, how would one override the Class in the SWC with a new one n FB?
    Currently, to edit the Class, I have to open up the project in Flash Pro, edit the Class and export the SWC again. Only then will I see the changes.
    When I try to put a new Class in Flash Builder with the same name as the one in the SWC, it will run that new Class but the assets of the Library item are not there.
    Hopefully I am missing something obvious.

    This is a working hack  but   I would still prefer a better way!
    In Flash Builder I create a Class that is near-to but not exactly the same as the original Class from the SWC.
    In this Class I make it extend the original Class in the SWC.
    eg:
    Class in SWC: SomeClass.as
    Class in FB: SomeClassExt.as
    In SomeClassExt I use:
    public class SomeClassExt extends SomeClass{
    I still need to test this out further but so far so good. Obvious or not.
    One thing I should mention, at least with my current example I need to remove a listener or the Class fires twice:
    removeEventListener(Event.ADDED_TO_STAGE,Init);
    So why do I not remove the Class from the Library item in Flash Pro to begin with?
    I built all the items and their Classes in Pro. Moving to FB for this project is recent.
    I can still test the functionality of the Classes in Flash Pro doing it this way and Not have to put them all in the same project folder in FB.
    Again, I would still prefr a better way to just override the SWC's Class and not have to create new Class Names in FB. This requires a lot of changes to an otherwise functional application.

  • Override Existing functionality in OO ALV

    Hi
    Can any one give me the procedure to override the standard functionality associcate with the buttons in ALV Toolbar.
    I am not able debug the when the user perfroms action on the Standard ALV toolbar. Can you help me
    Thanks all.

    Check sample program BCALV_EDIT_05. You need to create a local class to handle user actions. By this way you can assign different functionality to an existing key or ad new keys with required functionality.

  • How do I override existing billing information in order to utilize an iTunes gift card?

    We have an existing Apple account tied to our debit card, however my daughter would like to use iTunes gift cards for purchases for her iPad.  How do we override the existing account info so she can use her card?  I have already redeemed the card and it shows a balance, I just don't know how to apply her purchases to the balance.

    Just buy as normal. Except for gifts from others which cannot be purchased with a credit balance, the cost of a purchase will be automatically deducted from any balance.
    Regards.

  • A way to reuse existing classes instead of generating the stub ones?

    Hello to all,
    I am using eclipse and weblogic 10.3 as an application server.
    I have a 1st project deployed with some exposed web services. I need to access these services from a 2nd project, so i run the clientgen ant task, which generates the client interface, along with some stub classes. These stub classes are basically a copy of the ones from the 1st project.
    My question is this:
    Is there a way to reuse the original objects that the 1st project is using, by putting the first project as a dependency on the second? Or do i have to use the generated stub classes?
    Thanks in advance! Any help is appreciated.

    hi raja,
    no, DB6CONV cannot reuse the existing compression dictionary - this is in general not possible.
    BUT:  the good news is, that the next version V5 of DB6CONV will (amongst other new features) handle compression in a much better way! like R3load and online_table_move the compression dictionary will then be created based on  (if possible) 20MB of sampled data ensuring optimal compression.
    this new version will become generally available within the next few weeks.
    regards, frank

  • Help to modify the Release procedure without disturbing the existing class

    Hi All,
    We have a requirement to modify the existing workflow approval procedure for PR and PO to include a case, where the PO amount is less than certain value (say 100 EUR) and the material group is equal to certain value, then we need to include the approval levels L2 (defined for PR) and X2 (defined for PO).
    Taking the case for PO`s, please note the following information,
    Existing release Strategies & release Levels for PO are
    51          Level X4
    52          Level X4 + X3
    53          Level X4 + X3 + X2
    54          Level X4 + X3 + X2 +X1
    Characteristics used
    Total Net order Value
    Purchasing organization
    Order Type
    Purchasing Group
    Example : If the PO triggering a Release strategy 51 and if the conditions PO Value and Material Group satisfied then in addition to X4 system should send the PO  Approval to X2 also. Similarly if the Po triggering the Release strategy 52 then in addition to X4 + X3, approval from X2 also required (provided if the condition satisfies).
    Solutions tried
    1)  We can achieve the requirement by adding a dummy variable in the Characteristics and defining the new release strategy 55 with Level X4 + X2 and using the User Exit EXIT_SAPLEBND_002 .But we donu2019t want to touch the Characteristics and class because this is used by other companies also.
    2) Also we can add a characteristic Material group with value equal to the required value and define 2 new release strategies 55 with Level X4 + X2 and 56 with Level X4+ X3 +X2.For all the other release strategies we can maintain the material group value as blank. Since the characteristics used by many companies we donu2019t want this option also.
    Request your valuable suggestion to meet the above requirement, without disturbing the existing characteristics and Classes, would be highly appreciable.

    >
    MadhanRaj S wrote:
    But we cannot use those because these are used by other companies of the same organization.
    >
    > We need a solution other than these two options with out disturbing the existing charecteristics and class.
    It looks to me like you need a new release strategy for the company that is different. This is a perfectly normal way to use release strategies and is exactly what they are designed for.
    Cheers,
    Mike

Maybe you are looking for