Trouble w/ multiple applets dynamically starting and Class.forName()

I'm trying to start applets dynamically and I see strange behavior on some systems it works fine and gets the applet class from the jar file. On other systems it makes an http request back to the server to try and get the class. I don't know where in the Class or ClassLoader it's deciding whether to get this class from the jarfile or from the server and all of these classes are contained in the jarfile? Any suggestions?
Here's the method to start new applets
public Component startApplet( String className ) {
System.out.println("Starting applet "+className);
Class appletClass = null;
JApplet japplet = null;
try {
appletClass = Class.forName("com.actsolar.ui.applet."+className);
System.out.println(appletClass);
japplet = (JApplet)appletClass.newInstance();
japplet.init();
} catch (Exception e) {
System.out.println("startapplet Exception: "+e.getMessage());
return japplet;
thanks,
andrew

Hi,
I have seen the same problem when I mix up small letters and BIG LETTERS.
Ex :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<applet code="Function3.class"width="100" height="100">
</applet>
</html>
will work with Function3.class
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<applet code="function3.class"width="100" height="100">
</applet>
</html>
Will NOT work.
Maybe this will help you , I am also new on JAVA so maybe you make the same mistake like I did ?
Best Regards,
Didier.

Similar Messages

  • What is the Difference between ?  new Operator and Class.forName() ???

    plz tel me ....
    what is the Difference between ? new Operator and Class.forName() ??? ........

    Class.forName(), takes the class name as parameter,
    and loads that class in memory. But it doesn't create
    any instance of that class.
    That means static methods/variables are available for
    use.
    new keyword, checks if the class is loaded, if not
    then loads that class, and then creates an instance
    of that class.Class.forName actually returns the class object for that name (class - for -name). it might load it, if the class hasn't already been loaded, but it's misleading to say that's what that method does
    your definition of 'new' is wrong, too. give the dukes back

  • Difference between DriverManager.registerDriver and Class.forName?

    Hi all,
    I've noticed that the Oracle JDBC driver specifically asks to use DriverManager.registerDriver instead of Class.forName. What is the difference btw those 2 methods in loading and registering the driver?
    Thanks.

    I am trying to understand the jdbc, odbc drivers better.
    Does the class my.sql.Driver refer to a driver for MySql or is it a driver itself?
    with the lines one and two commented out, the code works fine. but with lines one and three commented out and the dbDriver being as specified in line two; no connection is made to the database. Can anyone explain this? and when i do Class.forName(dbDriver), is there a class by that name?
    //String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver"; //one
    //String dbDriver = "my.sql.Driver"; //two
    String dbDriver = "MySql ODBC 3.51 Driver"; //three
    String dbSource = "jdbc:odbc:mydb";
    try {
         Class.forName(dbDriver);
         conn = DriverManager.getConnection(dbSource);
         statement = conn.createStatement();
    } catch(Exception exception) {
         System.out.println(exception.getMessage()+" from the "+exception.toString());
         System.exit(1);

  • Difference between "new classname()" and  class.forName("...")?

    Hi,
    Please clarify me : What is the difference between the instnce creation by using new operator *( new ClassName())* and instance creation using class.forName("fully Qualified Name");
    thanks
    Gaurav

    The compiler can tell you whether new ClassName() will be valid. For the other, you have to wait until runtime to know for sure.
    new ClassName(...) can be invoked with arguments, and you provide them directly and simply. If you want to reflectively create an instance using a constructor that takes arguments, it's a more convoluted process.
    Using new, you know which checked exceptions can be thrown and you catch them directly. Using reflection, you have to catch some other exception and unravel its cause.
    You can use reflection (Class.forName and its more complicated cousins) when you don't know the classname at compile time.You can't do this with new.
    Don't use reflection unless you have to. It's more complex, somewhat less performant, and it denies you certain compile time checks.

  • 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.

  • Tomcat3 and Class.forName(my_class)

    Hi All,
    I am getting a ClassNotFoundException when I try to do a Class.forName(com.iw.command.my_class) in my servlet under Tomcat 3.3.1. I am running on RH Linux 7.2. The class is in my classes folder under WEB-INF. In the the tomcat config docs, it states that WEB-INF/classes is included in the tomcat classpath by default. Any help is greatly appreciated. I am under the gun and need to get this working ASAP.
    Thanks,
    Justin

    Forget it! I must have been visited by the idiot fairy while coding on late night.
    My method call was ... Class.forName("cmdname") when it should have been ...
    Class.forName(cmdname)
    Luckily I haven't spent much time on this.

  • Weblogic.policy and class.forname

    Hi,
    my company develops an application for an external customer (bea 6.1). In
    our cutomers eyes the application is a security risk because our customer is
    afraid that we are using the class.forname command to create manually
    connections to other databases.
    I would like to know, is it possible to disable this command for our
    application with the help of the weblogic.policy file?
    Regards
    Michael

    yes.. i think it returns Class object. But, isthere
    any other way to instantiate a class other thanusing
    the new operatorOthers
    - JNI, similar but not exactly new
    - Serialization which by passes the normal processCloning
    Class.newInstance has been mentioned, but Constructor.newInstance has not

  • Why Class.forName("driver class") ?

    Hi,
    whay we are using Class.forName("driver class"). why we dont import the driver package and access the required classes and methods?
    for eg:
    insead of calling
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); ,can we use import com.microsoft.jdbc.sqlserver.*; ?
    what is the use of DriverManager in this context? any connection between DriverManager and Class.forName() ?
    expecting answers.

    sure you can import the packages and use the classes directly but that defeats the whole purpose of pluggable drivers.
    Class.forName causes the class to be loaded and as stated before that should cause the driver to register itself with the driver manager.
    so then if you have a system where you are talking to several different database vendors then you don't have to worry about which is which as the DriverManager handles it for you.
    the big pros that i have actually seen though for having this be pluggable and not hard-coded (with the exception of the URL although you can do this dynamically as well) is what happens if you switch databases. if you import the package and use fully named classes and you switch databases at some point (could be just an upgrade of the same vendor's database) you are screwed.
    same problem could happen if you switch drivers for some reason.
    at any rate if you use things properly and are careful then you should only ever have to change your URL the rest of the code is fine if you use the DriverManager and use the drivers dynamically otherwise...

  • Can Class.forName("SomeClassName").newInstance() work in all classes?

    I saw some classes don't have a method called "newInstance()".
    but I have seen some advices say that is better using "Class.forName().newInstance()" than using "Class.forName()".

    I saw some classes don't have a method called
    "newInstance()".If you have class Foo, and you do Class.forName("Foo").newInstance();you're not calling Foo's newInstance method. You're calling java.lang.Class' newInstance method. You have a Class object that represents the Foo class. You tell that Class object newInstance() which invokes the public no-arg constructor of class Foo (as if you had done new Foo()). If Foo doesn't have a public no-arg constructor, you'll get an exception.
    but I have seen some advices say that is better using
    "Class.forName().newInstance()" than using
    "Class.forName()".They do two completely different things, and Class.forName().newInstance() first does Class.forName() and then class newInstance() on what that returns.
    Class.forName("Foo") returns the Class object that is associated with class Foo. It also loads the class if it hasn't already been loaded. It returns an instance of java.lang.class
    newInstance() calls the public, no-arg ctor of that class, if that ctor exists. Otherwise it throws an exeption. If it succeeds, it returns an instance of Foo.

  • How can I enable java applet plug-in and Web Start applications via terminal?

    Since the last Java update to Snow Leopard, I have found that the system periodically disables the Java applet plug-in after a period of disuse.  I know I can go to /Applications/Utilities/Java Preferences and just click to re-enable Java.  But I want to write a script which will do this periodically for a couple hundred Mac users where I work. 
    My question is - how can I reenable the Java applet plug-in and web start applications via Terminal command?  Is this possible?  Is there a plist file that can be modified, etc.?
    Bob Reed

    It is my understanding that Apple's most recent Java update automatically disables Java after a certain period of time that it hasn't been used.  We don't want users to have to keep re-enabling it.  So we wanted to find a way to do this via script either run by a Casper JSS server or stored locally on each workstation.   With the guidance provided by Mark Jalbert above and some text from a script written by Rich Trouton, I was able to make a script (with some minor changes) and a launch agent to re-run the script upon login.  So the preference is always enabled.
    For your reference, the script content is:
    #!/bin/sh
    # DYNAMICALLY SET THE UUID FOR THE BYHOST FILE NAMING
    if [[ `ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50` == "00000000-0000-1000-8000-" ]]; then
    MAC_UUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c51-62 | awk {'print tolower()'}`
    elif [[ `ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50` != "00000000-0000-1000-8000-" ]]; then
    MAC_UUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62`
    fi
    # Set the the "Enable applet plug-in and Web Start Applications" setting in the Java Preferences for the current user.
    /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UU ID}.plist
    /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UU ID}.plist
    /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UU ID}.plist
    /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UU ID}.plist
    The launch agent plist content is:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>Disabled</key>
              <false/>
              <key>Label</key>
              <string>org.XXXXX.enableJavaPlugin</string>
              <key>ProgramArguments</key>
              <array>
                        <string>sh</string>
                        <string>/Library/Scripts/XXXXX/enableJava_plugin.sh</string>
              </array>
              <key>RunAtLoad</key>
              <true/>
              <key>StartOnMount</key>
              <true/>
    </dict>
    </plist>
    I hope this is helpful to anyone wishing to keep the Java web plugin enabled.
    Bob
    Message was edited by: Robert Reed2

  • When starting computer, multiple DIAdem attempted startups (5 copies try to start) and errors.

    When starting computer, multiple startups of DIAdem clog the boot up process (5 copies try to start) and error messages state "Data Finder cannot start due to an internal error  (100): invalid config  STORE! USIF  error MSG:"     I did not ask  or want DIAdem to autostart but it sure wants to.  WHY?  Any help here? 

    Helllo Brad (and Matthias),
    I have  been using the tool Matthias recommended and it is indeed a very useful program.  It looks like I can stop it from doing the autostart.  However, I did not intentionally cause DIAdem to autostart and do not know how this happened.  (I must have done it since no one else messes with my laptop.) 
    A bit of historical info.  I originally used a demo disk of ver 10.0 and then used the activation code after purchasing.  I started having trouble with auto start and decided to upgrade to version 10.2 hoping ver 10.0 would  be deleted and all troubles would be gone.  No such luck.  I now have both versions and need to remove ver 10.0.  However, the control panel and 'add or remove programs' only finds one Nat Inst program (and it doesn't identify version). 
    Manually starting ver 10.0, generates an error message: "cannot open data store "MydataFinder"
    Manually starting ver 10.2 generates an error message: ""data finder cannot start due to an internal error (100) invalid config etc."
    In  spite of error messages, the programs seem to generally  work fine.  I am in the process of using the program recommended by Matthias to eliminate startup issues. I am also considering uninstalling and re-installing but am uncertain of which version will be uninstalled since only one program is identified.
    After I send this, I'm going to do a restart and see if problem with multiple restarts has been eliminated.
    Thanks for all your  help.
    David F

  • Dynamically start class member vi (non blocking)

    Hi folks,
    I've got a problem.
    I thought about building a framework, where i can dynamically start modules based on one class.
    The inherited classes representing the modules shold have a class member vi, that (containing a while loop) can be started dynamically.
    All selectes modules should be started from a loop starting one module after the other. Thus the dynamically start needs to be non blocking.
    I tried several ways, but allways reached the point, where the OOP approach limits the dynamically execution.
    Has anyone done something similar and can tell me how/if this is possible?
    Thanks in advance.
    Best regards,
    Balze

    Have a look at this link:
    http://lavag.org/topic/15035-lapdog-messaging-and-actor-framework/
    Or this:
    http://lavag.org/topic/14600-self-addressed-stamped-envelopes/
    On lavag.org there are a lot of discussion on that type of framework. There are a whole section for OOP, try to see if anything help you. 
    Look for Actor Framework or LapDog.
    Some talk alot on messages between loops, but that is to control free runing loops/vi's.
    Hope this helps.

  • Hyperion Planning dynamic forms based on start and end date across years

    Hi All,
    I have a requirement where i need to be able to view a form showing periods across years that are dynamically built depending on the start and end dates. If i have a start date of 01/11/2009 and an end date of 31/7/2013 i want to be able to view a form that shows all of the periods (Jan,Feb etc) in a form that is driven by these dates, in addition it will need to show the actual scenario up to the current month and the forecast from the current month to the end date. So basically if a user inputs the start and end dates the form will display the relevant periods driven by these dates.
    Any tips very much appreciated!

    Hello,
    This is difficult to realize, but you can get quite far with a workaround. The first question is, where do you want to input your selection of time periods? Assuming you have a webform with the complete timeline in months and years and you type in the start period and end period.
    Webforms have the option to suppress rows and columns.
    This can be extended with option of empty cells or not empty cells.
    You will need to apply your creativity on this.
    Put every month-year combination in a column and add the suppression.
    Calculate the timeline between start period and end period with a dummy member, so data exists for these and columns will show.
    Maybe you will need to copy the required timeline into a separate version for this, to avoid having periods which were outside the selection and still have data.
    I hope these hints help a bit in this challenge.
    Regards,
    Philip Hulsebosch
    www.trexco.nl

  • After Java patch 1.7.0_07 ENable applet plug-in and Web start checkbox is gone!

    Hello all,
    Using ML 10.8.1 and Safair 6.0
    After Java patch 1.7.0_07 ENable applet plug-in and Web start checkbox is gone! The check box to enable Safari to load Java pages is 100% gone, missing, just not there anymore.
    When I go to the Java test page it shows that I have Java 7 loaded. Has anyone else run into this problem or have a solution to enable true load loading in Safari and bring back the Enable applet plug-in and Web Start application check box in ML...
    Thanks

    I found out something very interesting. I noticed that another page would show up for less than have a second before the ML Java Preference would show up. I did a video recording of this and moved frame by frame. I show that the page / pane showing up had the following option:
                    Run applets:  in their own process
                                         within their browser process
    Both boxes for the two are unchecked.
    Then this page would disappear and nother would show up without the option / check box
    Enable applet plugin and Web Start applications
    Strange

  • I downloaded Photoshop CC but I start experiencing trouble, so un-istalled Creative Cloud and Photoshop CC. I then reinstalled Creative Cloud but I am not having trouble reinstalled Photoshop CC. Nothing seems to be working, it just shows me that Photosho

    I downloaded Photoshop CC but I start experiencing trouble, so un-istalled Creative Cloud and Photoshop CC. I then reinstalled Creative Cloud but I am not having trouble reinstalled Photoshop CC. Nothing seems to be working, it just shows me that Photoshop is up to date and ready to use and its not installed on my computer anywhere.

    Rattler2015 please see CC desktop lists applications as "Up to Date" when not installed - http://helpx.adobe.com/creative-cloud/kb/aam-lists-removed-apps-date.html for information on how to reinstall Photoshop CC.

Maybe you are looking for

  • "Permission denied" while accessing Canon 550D with libgphoto2

    I have followed the Wiki for access problems but I just can't get it to work, the camera is seen but I cannot transfer anything from it, I'm getting "libusb couldn't open USB device /dev/bus/usb/002/003: Permission denied. libusb requires write acces

  • Visual Composer 6.0 Patch2 on EP60 SP7 WAS 6.40 SP8

    Hello, I am trying to test visual composer for some of our developemnts. I have installed Visual composer 6.0 Patch2 and am able to connect to the CRM systems using the Portal framework. The iview created in the VC works in preview mode in VC workben

  • CF 9 Install fails

    Hi, I got stuck during the install of CF9 (Windows 7). Browsing for Apache conf and bin Directory faild and when i try tu run the install again, InstallAnywhere runs up to 100% but the Install itself does not start. I tryed to reboot. Would install J

  • MM losing preferences

    Hey all, not a huge deal overall but this seems to be happening more often than ever. Have got the mighty mouse scroll ball 'click' set for Expose, and side buttons for 'Dashboard' . Both preferences seem to be reset back to default every now and aga

  • Calculate Time

    I've this table TAB_TIME: NAME....................TIME_USER TOM............01/12/2008 12:10:15,000000 SAM............01/12/2008 12:10:18,150000 SAM............01/12/2008 12:11:18,150000 SAM............01/12/2008 12:20:15,150000 SAM............01/12/2