How to load Class only once...

hi all,
i am using the Class.forName() to load the class.
the code looks like as follows :
for loop.....{
Class.forName("classA");
inside the for loop , is there any possiblity of knowing that the class is already loaded or not. i can load the class the outside the for loop . but i am curious to know how we can check whether the classA is already loaded or not for the next iteration of the loop.
tia,
dhanasekaran.

Class.forName() will only load a class that has not been previously loaded. Whether or not a class is already loaded is totally transparent to a Java application. It will be loaded as soon as it is referred to for the first time, be it instantiation or access to static members or a call to Class.forName().

Similar Messages

  • How to load classes other than stub classes required for the stub classes

    Can any one pls tell me how to load supporting classes and interfaces for the stubs thru RMI? I am copying necessary stubs and policy file in the client class.
    one of the method of the class returns another supporting class. whenever i invoke this method ot says Class NotFoundException. I dont want to copy these supporitng classes into my client. They are deployment issues involved with this.
    HOW CAN I LOAD THE CLEINT CLASSES THRU RMI

    You should look at the documentation concerning CODEBASE. -Djava.rmi.server.codebase=
    It is too involved to explain it all here.

  • How to Load Classes in run time - Urgent

    Hi All,
    How to Load a class file from a .jar file in JDK1.1 with out using URLClassLoader. I have tried to extract the .jar file by file input stream and zipEntry classes and defineClass using the bytes i got from the stream , but the class loader fails to take the classes that are already loaded in the system.
    The customClassLoader that i created was not able to assign an object to the another reference variable that already in the JVM.Please i want to know how to assign or communicate between the objects of CustomclassLoader and SystemClassLoader?
    Please help me in this regard.
    Thanks in advance,

    Hi,
    The above code works in the straight way if the class is available in the classpath.
    I need to load a class by using custom class loader that i extends from classloader base class .
    I have to read a class file from a .jar file (in server) and load it in run time.Here i am able to read the bytes from the .jar file of the specified class file, but the class that i read extends some other class that is already loaded when i tried to create newInstance of the class i get Exceptions. Here the custom classLoader cannot find the loaded existing class in the JVM.can i get a solution for this situation

  • Pls give me the code to load method only once in JVM.

    Hi all,
    Pls give me the code to execute method only once in JVM.Even if we create more than one instance to call the method.
    Thanks & Regards,
    Vinodh

    [How to ask a question on these forums|http://catb.org/~esr/faqs/smart-questions.html]

  • How to load IDVD (only) from ILife'11

      I am waiting on delivery of ILife '11 package. How do I install (only) IDVD from this package? I have IOS Mountain Lion and it came with IMovie,Iphoto and Gagageband.  I believe they are included in ILife'11 along with some other apps.  My need is for IDVD.  Should I be aware of any pitfalls, when trying to load only IDVD?  I am a novice to a Mac and please offer suggestions, put to simple terms. Thanks.

    Click on the Customize button when it comes up:
    OT

  • How to load classes at ejb module deployment

    Hi,
    Can someone tell me how to loaded a class when I deploy an ear module (the class is in the ear) ?
    Thanks in advance.
    Fred.

    Hi Fred,
    Can you explain your question a bit more? Are you asking how to do
    dynamic class loading for your application or just how to package
    classes appropriately?
    --ken                                                                                                                                                                                                                                                                                                                                                               

  • How to load data only at the upper level in ASO

    We are loading the Days member with values 31/30/29/28 for the top level combinations in Block storage cube using a rule file.<BR>Now we need to carry out the same thing in ASO but ASO has a constraint that we can load data only at zero level.<BR>If we do that, then data at higher levels, after aggregation is incorrect. What can be done ?

    Also possible but a little more complicated is to create a separate cube with a DayCount account and only accounts and time dimensions. The time dimension goes down to day. You load it with 1 record per day. Then, you use this cube and your original cube as source, transparent partitions to a BSO cube. <BR><BR>This way, you have no bogus "input" members anywhere. Formulas that combine DayCount with other things would be written as outline formulas in BSO, since it doesn't support MDX. If you need those to be in MDX, then this wouldn't work for you.

  • HTML website, SWF do a load animation only once. Same file used on all pages?

    Hey all,
    Just going through some thinking here. My HTML website is
    going to using a flash header and navigation. Now I will be using
    the same swf's on all of the pages across the site. I would like to
    play a loading animation only on the first time the swfs are
    loaded. Is there a way to do this? Or because I am using the same
    swf's will it be okay to just tell my mc to go sit on a specific
    frame and because it is in the cache each page will be using the
    same file so the mc will still be at that frame or???
    And help would be nice...

    While Breqent is right that server side includes are the best way of doing this if you aren't up on
    server side coding then you can use Dreamweaver to manage you menu.
    You do this by simply ensuring you never edit the menu area on any individual page.
    It should therefore be identical on all page and as such you can just use find and replace across the entire site or folder to edit all occurances of your menu.
    I hope this helps.
    Andy
    Best Reception

  • How to load class from jar file dynamically?

    After I run my Java applicatoin, I need configuring the classpath of jvm to load some classess inside a jar file into the same jvm.How can I achive that?
    I mean, when I run my Java application, I don't know where the jar file is, what the jar file name is. All depends on the user to tell the jvm the details through some UI. I've tried to write: System.setProperty("java.class.path", "c:\myClass.jar");Class.forName("MyClass"); but failed.
    Can you tell my why and how?
    Thx

    After I run my Java applicatoin, I need configuring
    the classpath of jvm to load some classess inside a
    jar file into the same jvm.How can I achive that?
    I mean, when I run my Java application, I don't know
    where the jar file is, what the jar file name is. All
    depends on the user to tell the jvm the details
    through some UI. I've tried to write:
    System.setProperty("java.class.path",
    "c:\myClass.jar");Class.forName("MyClass"); but
    failed.That won't work. By the time it gets to your code it already has a copy of the original. You can't change it (short of modifying the JVM.)
    Can you tell my why and how?The usual way is to use a custom classloader.
    You can start by looking at java.net.URLClassLoader.

  • How  to load  class ???

    please note the below code :
    String systemPath = System.getProperty("java.class.path");
    String classpath = "E:\\Test.jar;" + systemPath;
    System.setProperty("java.class.path",classpath);
    System.out.println("class-path: " + getCompilerClassPath());
    Class.forName("Test");
    Why I can't load the Test class ?? please help me !
    thanks!

    After I run my Java applicatoin, I need configuring
    the classpath of jvm to load some classess inside a
    jar file into the same jvm.How can I achive that?
    I mean, when I run my Java application, I don't know
    where the jar file is, what the jar file name is. All
    depends on the user to tell the jvm the details
    through some UI. I've tried to write:
    System.setProperty("java.class.path",
    "c:\myClass.jar");Class.forName("MyClass"); but
    failed.That won't work. By the time it gets to your code it already has a copy of the original. You can't change it (short of modifying the JVM.)
    Can you tell my why and how?The usual way is to use a custom classloader.
    You can start by looking at java.net.URLClassLoader.

  • How to load classes dynamically?

    Hi all!
    I have folowing problem.
    In my applet I need to load different classes form the same Web server. The main class is located in parent directory and different are in it's subdirectories. Security Manager allows to do this, but I find it difficult how to do it. Can you give me advise how to do it.
    Thanks beforehand...

    Create a package on the web side myserver.mypackage with subfolders ex1 ex2
    THere place your class files to dynamical loading
    Every class in package must starts from
    package myserver.mypackage; statment
    In paren directory for package creat a class where main applet class will be located
    Create an inctance for submain classes as
    (Class)Class.forName("myserver.mypackage.ex1.Class1").newInctance() - for class1 in ex1
    (Class)Class.forName("myserver.mypackage.ex2.Class1").newInctance() - for class1 in ex2
    It works. I'll send you example on e-mail.

  • How to load time only no date using sql loader

    I want to load just time portion from the data, the data looks like this
    08/10/09 ,FZ10, AD2R, DFHMIRS , 14, 01:12:07.001230, 01:02:07.112354, TRANS PURGED / TIMED OUT ,
    control file:
    LOAD DATA
    APPEND
    INTO TABLE TRANS_ABENDS
    FIELDS TERMINATED ',' TRAILING NULLCOLS
         TRANS_DATE           DATE "MM/DD/YYYY",
         TRANS_ID          ,
         ABEND_CODE          ,
         ABEND_PGM           ,
         ABEND_COUNT           ,
         RESPONSE_TIME      "to_date(:RESPONSE_TIME,'dd/mm/yy HH:MI:SS.ffffff')",
         CPU_TIME          "to_date(:RESPONSE_TIME,'dd/mm/yy HH:MI:SS.ffffff')",
         ABEND_RESOLUTION     ,
         INSTANCE          CONSTANT 'EAST'
    I can load the time using the control file but it adds the first of the month as date in the column. I want to load only time value. Appreciate any help on this.

    I meant, how are these columns defined in the table that is being loaded?
    If these are defined as DATE, then as was pointed out Oracle will default the date portions if they are not provided in the formatted string.
    If these are defined as NUMBER (with some fractional portion), then you could use a combination of substr, multiplication and concatenation to derive the time as number in the form <seconds>.<fractional seconds>.
    You could also look into the data type INTERVAL DAY TO SECOND.
    SQL> create table trans_abends (
      2   trans_date date,
      3   trans_id char(4),
      4   abend_code char(4),
      5   abend_pgm char(8),
      6   abend_count number(4),
      7   response_time interval day (0) to second (6),
      8   cpu_time interval day (0) to second (6)
      9  )
    10  /
    Table created.
    SQL> insert into trans_abends values (sysdate, 'xxxx', 'xxxx', 'xxxxxxxx', 1, to_dsinterval('+0 01:12:07.001230'), to_dsinterval('+0 01:02:07.112354') )
      2  /
    1 row created.
    SQL> select response_time, cpu_time from trans_abends;
    RESPONSE_TIME
    CPU_TIME
    +0 01:12:07.001230
    +0 01:02:07.112354For the sql loader control file, try
    "to_dsinterval('+0 '||:RESPONSE_TIME)"
    not tested.
    Edited by: user142857 on Nov 18, 2009 12:20 PM
    Edited by: user142857 on Nov 18, 2009 12:27 PM

  • How to load a movie once?

    I'm building a site where each "page" is a stopped frame.
    Frame 1 is the preloader which when loaded, goes to and Stops
    frame 3 which is "home" of my movie.
    On the Home frame I have the action script and loader to
    stream an flv movie and it loads a movie using the NetStream. The
    movie is basically a "welcome and this is what my site is all
    about" kind of thing.
    How do I get that movie to only play if the user is coming
    from Frame 1 (the preloader) and not if they're returning to the
    home frame from elsewhere?

    The first time the flv is played set a variable to true, such
    as:
    var moviePlayed:Boolean = true;
    and on each visit to frame 3, check the value of the variable
    to see if the flv should be played or not.

  • How to load classes for a particular package

    I have a package name say com.test
    i need to get the names of all the classes starting with "Test" under this package. Also, i need to get the names of all the methods starting with "test" in each of these classes.
    ideas/suggestions welcome :)
    cheers
    yogesh

    Kaj,
    thnx for ur time :)
    i am developing a testing framework for our web applications. all our applications wd require to have com.test as the package which will contain all the JUnit test classes. the package name (com.test) will be provided by the tester thru a properties file. my framework will load all the classes (and also fetch the method names starting with "test" in those classes) and display them on a gui in a html form. the tester will just select the junit test cases he wants to run and my framework will expose this service thru a servlet. the servlet will then invoke all the methods selected by the tester via reflection.
    if the way i want to do it is not possible cd u please suggest any alternatives ?
    cheers
    yogesh

  • How to load Classes?

    How to retrive the class name during runtime.....
    suppose if i select java.lang package , i must get all the classes relating to lang package....
    i used reflection API, but using that you can retrive constructor and methods of any class... and i need the classes of perticular package.... how to do it?
    Thank You

    Must it be in run-time? If no classloader tricks are applied, the whole class path contents could be perused to gain a list of the classes available there even berore running your application.

Maybe you are looking for

  • Regarding layout of abap query

    hi all, i have an issue in the output of abap query. in output i have many columns with values, nw i have to insert two additional  colums in between of the existing output.how to do that???

  • G500 fan running at full speed for no apparent reason

    I have G500 that worked perfectly for a year now. My operating system is Windows 7 Professional. Yesterday the fan started working full speed while the laptop was idle, I wasn't using it and the software that was running in the background were the us

  • Help installing Creodistiller Assistant

    I am preparing a file for print. I have creodistiller assistant which I am supposed to install in Adobe Acrobat (so that in the print version the thin lines will automatically thicken so as not to cause print problems.) I am working on a PC with Vist

  • Problem with forms authentication in OWA

    Hi I have a problem with exchange 2013 standard When I enable forms authentication on OWA, after logging in I get a 404 file not found error. Forms authentication works fine on ECP. I noticed that the login url has a ReturnUrl on the querystring whic

  • URGENT: issue while creating user through reconciliation of AD

    Hi, We have a requirement where we need to create users in IDM through reconcilition against Active Directory. For certain type of account Ids I want to trigger a custom workflow used for user creation. So I set "viewOptions.Process" to my custom wor