Dynamically loading a class that is part of a larger loaded package

I am dynamically loading a class that is part of a large package, much of which is loaded at startup. The code directly references protected variables in the parts of the package that is loaded by the default class loader. Attempting to access these protected variables gives an access error when the class is dynamically loaded that doesnt occur when the class is loaded at startup.
Is there a way to make this work?

To answer my own question -- no
A reference from http://access1.sun.com/techarticles/DR-article.html says:
The use of Dynamic Class Reloading can introduce problems when classes that are being dynamically reloaded make calls to non-public methods of helper classes that are in the same package. Such calls are likely to cause a java.lang.IllegalAccesserror to be thrown. This is because a class that is dynamically reloaded is loaded by a different classloader than the one used to load the helper classes. Classes that appear to be in the same package are effectively in different packages when loaded by different classloaders. If class com.myapp.MyServlet is loaded by one classloader and an instance of it tries to call a non-public method of an instance of class com.myapp.Helper loaded by a different classloader, the call will fail because the two classes are in different packages.
So not being able to access non-private variables in this scenario is the way it works.

Similar Messages

  • 6.1 Doesnt read classes that arent part of packages

    Migrating webapps from 6.0, it appears the 6.1 server doesnt find classes that are in WEB-INF/classes directory. When I place them in packages it finds them. Do I have to convert all classes to be part of a package now?

    Migrating webapps from 6.0, it appears the 6.1 server doesnt find classes that are in WEB-INF/classes directory. When I place them in packages it finds them. Do I have to convert all classes to be part of a package now?

  • How do I dynamically load a SWF that was compiled from an Fla with a linked external class file

    I am dynamically loading external SWFs in a Main Fla in response to clicks on a menu.
    The loading code is standard and works fine for all of the SWFs except one. When I try to load it I get the following error:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
    I am certain that the URL to the problem SWF is correct. The SWF itself doesn't load any other SWFs or images.
    The problem SWF is linked to an external class file and compiled with it.
    i.e. in the properties panel of the main timeline of the problem SWF's Fla I have entered the path to the external class.
    1. there is no problem compiling this SWF with the class (it works fine by itself)
    2. if I remove the external class from the properties panel and don't use it the resulting SWF imports without a problem into the Main Fla mentioned before
    So the problem seems to be the fact that the external class is linked in the properties panel. Is this a path problem?
    Would appreciate any suggestions,
    Thanks!

    despite what you say, that loaded swf most likely is loading something and that's the cause of the error.
    you could test that by putting the main swf's embedding html file in the same directory with problematic swf.  if the problem is as explained above, you'll have no problem when the main html is in the same directory with the loaded swf.

  • How to dynamically load jar files - limiting scope to that thread

    Dynamically loading jar files has been discussed a lot. I have read a quite a few posts, articles, and demo code for doing just that. However, I have yet to find a solution to my problem. Most people modify their system class loader and are happy. I have done that and was happy for a time. Occasionally, you will see reference to an application server or tomcat or some other large project that have successfully been able to load and unload jar files, allow for dynamic deployment of code, etc. However, I have not been able to achieve similar success; And my problem is much less complicated.
    I have an application that executes a thread to send a given file/message to a standard JMS Server Queue. Depending on the parameters selected by the user, this thread may need to communicate with one of a number of JMS Servers, ie. JBoss, WebLogic, EAServer, Glassfish, etc. All of which can be done with the same code, but each needs to load their own flavor of JMS Client Jar files. In this instance, spawning a separate JVM for each communication would work from a classloader perspective. However, I need to keep it in the family and run under the same JVM, albeit each JMS Server Connection will be created and maintained in separate Threads.
    I am close, I am doing the following...
    1. Creating a new URLClassLoader in the run() method of each thread.
    2. Set this threads contextClassLoader to the new URLClassLoader.
    3. Load the javax.jms.JMSException class with the URLClassLoader.loadClass() method.
    4. Create an initialContext object within this thread.
    Note: I read that the initialContext and subsequent conext lookup calls would use the Thread�s
    contextClassLoader for finding/loading classes.
    5. Perform context.lookup calls for a connectionFactory and Queue name.
    6. Create JMS Connection, etc. Send Message.
    Most of this seems to work. However, I am still getting a NoClassDefFoundError exception for the javax.jms.JMSException class ( Note step #3 - tried to cure unsuccessfully).
    If I include one of the JMS Client jar files ( ie wljmsclient.jar for weblogic ) in the classpath then it works for all the different JMS Servers, but I do not have confidence that each of the providers implemented these classes that now resolve the same way. It may work for now, but, I believe I am just lucky.
    Can anyone shine some light on this for me and all the others who have wanted to dynamically load classes/jar files on a per Thread basis?

    Thanks to everyone - I got it working!
    First, BenSchulz' s dumpClassLoader() method helped me to visualize the classLoader hierarchy. I am still not completely sure I understand why my initial class was always found by the systemClassLoader, but knowning that - was the step I needed to find the solution.
    Second, kdgregory suggested that I use a "glue class". I thought that I already was using a "glue class" because I did not have any JMSClient specific classes exposed to the rest of the application. They were all handled by my QueueAdmin class. However...
    The real problem turned out to be that my two isolating classes (the parent "MessageSender", and the child "QueueAdmin") were contained within the same jar file that was included in the classpath. This meant that no matter what I did the classes were loaded by the systemClassLoader. Isolating them in classes was just the first step. I had to remove them from my jar file and create another jar file just for those JMSClient specific classes. Then this jar file was only included int custom classLoader that I created when I wanted to instantiate a JMSClient session.
    I had to create an interface in the primary jar file that could be loaded by the systemClassLoader to provide the stubs for the individual methods that I needed to call in the MessageSender/QueueAdmin Classes. These JMSClient specific classes had to implement the interface so as to provide a relationship between the systemClassLoader classes and the custom classLoader classes.
    Finally, when I loaded and instantiated the JMSClient specific classes with the custom classLoader I had to cast them to the interface class in order to make the method calls necessary to send the messages to the individual JMS Servers.
    psuedu code/concept ....
    Primary Jar File   -  Included in ClassPath                                                      
    Class<?> cls = ClassLoader.loadClass( "JMSClient.MessageSender" )
    JMSClientInterface jmsClient = (JMSClientInterface) cls.newInstance()                            
    jmsClient.sendMessage()                                                                      
    JMSClient Jar File  -  Loaded by Custom ClassLoader Only
    MessageSender impliments Primary.JMSClientInterface{
        sendMessage() {
            Class<?> cls=ClassLoader.loadClass( "JMSClient.QueueAdmin" )
            QueueAdmin queueAdmin=(QueueAdmin) cls.newInstance()
            queueAdmin.JMSClientSpecificMethod()
        }

  • Error editing task sequence: Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" From XML into WMI

    I've started getting an intermittent error editing my Windows 7 OSD task sequence.  Sometimes I can open the TS to edit, but when I try to apply changes I get the error.  Other times I get the error when trying to open the TS.  If I try again
    right away, I still get the error, but if I wait a few minutes and try again sometimes it will open the TS. 
    The error reads:
    ConfigMgr Error Object:instance of SMS_Extended Status{Description = "Failed to load dynamic properties for class \"SMS_TaskSequence_ApplyWindowsSettingsAction\" from XML into WMI";Error Code = 2147943746;File = "e:\\qfe\\nts\\sms\\siteserver\\sdk_provider\\smsprov\\ssptspackage.cpp";Line = 3454;Operation = "ExecMethod";ParameterInfo = "SMS_TaskSequencePackage";ProviderName = "WinMgmt";StatusCode = 2147749889;}
    Coinciding with this error, I show the following entries in the TaskSequenceProvider.log file: 
    [PID: 7608] Invoking method SMS_TaskSequence.LoadFromXml
    TaskSequenceProvider
    Failed to protect memory buffer, hr=0x80070542
    TaskSequenceProvider
    Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" from XML into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load node Apply Windows Settings from XML into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "PostInstall" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "Execute Task Sequence" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load XML for the task sequence into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    [PID: 7608] Done with method SMS_TaskSequence.LoadFromXml
    TaskSequenceProvider
    Setting status complete:  status code = 0x80070542; Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" from XML into WMI
    TaskSequenceProvider
    I exported the task sequence and checked in "object.xml" for the "ApplyWindowsSettingsAction", to see if there was something odd in the xml, but I don't find anything that jumps out as being wrong.  Here's the section of XML for
    that step.  I've removed identifying info, and replaced it with a generic term in bold.
    <step type="SMS_TaskSequence_ApplyWindowsSettingsAction" name="Apply Windows Settings" description="" runIn="WinPE" successCodeList="0" runFromNet="false"><action>osdwinsettings.exe /config</action><defaultVarList><variable name="OSDLocalAdminPassword" property="AdminPassword"></variable><variable name="OSDComputerName" property="ComputerName">%_SMSTSMachineName%</variable><variable name="OSDProductKey" property="ProductKey"></variable><variable name="OSDRandomAdminPassword" property="RandomAdminPassword">false</variable><variable name="OSDRegisteredOrgName" property="RegisteredOrgName">COMPANY NAME</variable><variable name="OSDRegisteredUserName" property="RegisteredUserName">COMPANY NAME</variable><variable name="OSDServerLicenseConnectionLimit" property="ServerLicenseConnectionLimit">5</variable><variable name="OSDTimeZone" property="TimeZone">Central Standard Time</variable></defaultVarList></step><step type="SMS_TaskSequence_ApplyNetworkSettingsAction" name="Apply Network Settings" description="" runIn="WinPEandFullOS" successCodeList="0" runFromNet="false"><action>osdnetsettings.exe configure</action><defaultVarList><variable name="OSDDomainName" property="DomainName">DOMAIN.COM</variable><variable name="OSDJoinPassword" property="DomainPassword"></variable><variable name="OSDJoinAccount" property="DomainUsername">DOMAIN ACCOUNT</variable><variable name="OSDEnableTCPIPFiltering" property="EnableTCPIPFiltering" hidden="true">false</variable><variable name="OSDNetworkJoinType" property="NetworkJoinType">0</variable><variable name="OSDAdapterCount" property="NumAdapters" hidden="true">0</variable></defaultVarList></step>
    Is there any other log I should check for a clue on this issue?  What could be causing this error?

    Thanks for sharing that!  I tend to save contacting MS support until after I've exhausted other options.  I'm always afraid that I'll spend the $500 to open a case and then it turns out to be something simple that I would have found if I had just
    kept working on it myself a little longer.
    It looks like that link is for an update released in February as KB3023562.  I downloaded and installed it. I'll try opening/editing/saving the task sequence a few times today to see if the issue is resolved.  
    After I had already installed it, I thought to look up that update in configmgr.  The update is listed as superseded by 2 other updates.  The newest of those is KB3046049, which just installed last night with the other March patches, so it's possible
    that I didn't need to install KB3023562 after all.  

  • Dynamic loading of a class at runtime with known inheritance

    Hi,
    I am trying to dynamically load a class during runtime where I know that the class implements a particular interface 'AInterface'. Also, this class may be linked to other classes in the same package as that class, with their implementations/extensions given in their particular definitions.
    The class is found by using a JFileChooser to select the class that implements 'AInterface', and loaded up.
    Because the name of the class can be practically anything, my current approach only works for certain classes under the package 'Foo' with classname 'Bar'. Some names have been changed to keep it abstract.
    private AInterface loadAInterface(URL url) throws Exception {
         URL[] urls = { url };
         // Create a new class loader with the directory
         URLClassLoader cl = new URLClassLoader(urls);
         // Load in the class
         Class<?> cls = cl.loadClass("Foo.Bar");
         return (AInterface) cls.newInstance();
    }As you can see, all that is being returned is the interface of the class so that the interface methods can be accessed. My problem is that I don't know what the class or package is called, I just know that the class implements AInterface. Also note that with this approach, the class itself isn't selected in the JFileChooser, rather the folder containing Foo/Bar.class is.

    ejp wrote:
    The class is found by using a JFileChooser to select the class that implements 'AInterface', and loaded up.
    Also note that with this approach, the class itself isn't selected in the JFileChooser, rather the folder containing Foo/Bar.class is.These two statements are mutually contradictory...My apologies, I worded that wrong. My current approach (the one given in the code) selects the root package folder. However, what I want to be able to do, is to simply select a single class file. The current code just makes some assumptions so that I can at least see results in the program.
    As you said, if the root of the package hierarchy is known, then this could be achieved. The problem is that the user either selects the package root or the AInterface class, but not both.
    Is there a way to get package details from a .class file to be used in the actual loading of the class?

  • How to dynamically load static (inner) class

    I have an urgnent question, any comments would be appricated.
    I have a static inner class definition.
    Class myObject
    public static class innerObject
    I want to dynamically load the static innerObject class such as
    Class c = Class.forName ( "myObject.innerObject" );
    innerObject t = ( innerObject ) c.newInstance();
    I can't do this as it give me ClassNotFound Exception, Do I need to load myObject first? any comments?
    The other alternative is that to define my myObject as having a static variable referencing the static class.
    Class myObject
    staic innerObject m_inner = new innerObject();
    public static class innerObject
    Is there any option in java allowing me to load a static variable?
    Many thanks
    Jay

    I can't do this as it give me ClassNotFound Exception,Use "myObject$innerObject" instead of "myObject.innerObject".
    Is there any option in java allowing me to load a
    static variable?What do you mean by that?

  • Show the class that is loading

    Hi i have an applet that take a lot of classes to load and i have a splash screen that display the user a little image with a JProgressBar with the setIndeterminate() to true. For this i don't care, but what i want is to do like acrobat software that display all plugin that is loading. So when the splashscreen start i want it to display all classes that is loading at the moment the jre load it.
    Is there a dynamic way? Cause i know i can use
    Class thatClass = Class.forName("TheClassToLoad");
    theObject = thatClass.newInstance();
    but each time i will have to add a new class i will add to add these line... so i want something that will know which classes the java runtime is loading and display the name to the user
    thx

    maybe this could help
    it's a class i had to load the applet, that give me the possibility to start my splash screen before the user dl all my big applet
    import javax.swing.JApplet;
    import java.applet.AppletStub;
    import java.awt.Graphics;
    import java.awt.GridLayout;
    import javax.swing.JLabel;
    import javax.swing.JEditorPane;
    public class QuickLoader extends JApplet implements Runnable, AppletStub
        String appletToLoad;
        JLabel label;
        Thread appletThread;
        public void init()
            appletToLoad = getParameter("applet");
            if (appletToLoad == null)
                label = new JLabel("No applet to load.");
            else
                label = new JLabel("Please wait - loading applet " + appletToLoad);
            getContentPane().add(label);
        public void run()
            if (appletToLoad == null)
                return;
            try
                // Get the class for the applet we want
                Class appletClass = Class.forName(appletToLoad);
                // Create an instance of the applet
                JApplet realJApplet = (JApplet)appletClass.newInstance();
                // Set the applet's stub - this will allow the real applet to use
                // this applet's document base, code base, and applet context.
                realJApplet.setStub(this);
                // Remove the old message and put the applet up
                getContentPane().remove(label);
                // The grid layout maximizes the components to fill the screen area
                // - you want the real applet to be maximized to our size.
                getContentPane().setLayout(new GridLayout(1, 0));
                // Add the real applet as a child component
                getContentPane().add(realJApplet);
                // Crank up the real applet
                realJApplet.init();
                realJApplet.start();
            catch (Exception e)
                // If we got an error anywhere, print it
                label.setText("Error loading applet.");
            // Make sure the screen layout is redrawn
            getContentPane().validate();
        public void start()
              appletThread = new Thread(this);
              appletThread.start();
        public void stop()
              appletThread.interrupt();
              appletThread = null;
        // appletResize is the one method in the JAppletStub interface that
        // isn't in the JApplet class. You can use the applet resize
        // method and hope it works.
        public void appletResize(int width, int height)
              resize(width, height);
    }bu i don't know how to integrate your code to load all my classes correctly and be able to display the name of the class that are loading
    thx for help

  • How do I write a Java Class that Loads a RPT and exports to PDF All Automatically?

    <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="2">I am using Crystal Reports for Eclipse and I am trying to create a java class that will do everything independently.<span>  </span>It will take a .rpt file, load it with data from the database and then export that to a pdf file and put that pdf in a specific location with a specific name.</font></p><font face="Times New Roman" size="2"> </font> <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="2">I am using the Crystal Reports for Eclipse and the sample jsp project does that but I am looking for a java class example that doesn't require human interaction through the website.<span>  </span>I have read the help file and seen snippet examples but I am not seeing a complete example.<span>  </span>Could someone point me in the proper direction of a good example either in the forum or the help file for eclipse?</font></p>

    <p>Hi,</p><p>    If you wanted to achieve this in a JSP page then I would suggest using the JSP Page Wizard as it allows you to select PDF as an output type. You can run the wizard and choose the PDF output and it will automatically generate the required code for you. </p><p>However, as you want to use a Java class then I would suggest downloading the following package of sample code:</p><p><a href="http://support.businessobjects.com/communityCS/FilesAndUpdates/crxi_r2_jrc_desktop_samples.zip">http://support.businessobjects.com/communityCS/FilesAndUpdates/crxi_r2_jrc_desktop_samples.zip</a> </p><p>This package includes a number of sample Java classes that demonstrate how to use the engine. The one that you will be interested in is titled "<strong>JRCExportReport"</strong> </p><p>To make life easier I would suggest trying the class in a Crystal Reports Web Project as the runtime libraries will automatically be in the classpath. </p><p>Anyway, give this a shot and let me know how you make out. </p><p>Regards,<br />Sean Johnson (CR4E Product Manager) <br /><br /> <a href="http://www.eclipseplugincentral.com/Web_Links-index-req-ratelink-lid-639.html">Rate this plugin @ Eclipse Plugin Central</a>          </p>

  • Import classes that are not part of any package

    I have this problem with the JDK1.4 compiler:
    I have a few classes that were created outside of any package for some JNI uses. When I used JDK1.3 to compile, I was able to get the compiler to find these classes by doing the following in the calling classes:
    import ClassOutSideOfPackage;
    Now that I am trying to use JDK 1.4, the compiler complains with the following error:
    "." expected
    import ClassOutSideOfPackage;
    I tried to take the import out and had no luck. The compiler complained that it can't find this class. What can I do or is the only solution to change the class to include it in a package and change all relavant JNI native calls... etc. Thank you.

    Removing the entire import statement should work. Check for a classpath problem if it
    doesn't. It is not necessary to place in a package and recompile, though.I tried your suggestion. However, it keeps complaining that it can't find the class. The class file resides in the current directory and I have "." at the beginning of my class path. I don't see anything wrong with the classpath. Did you have this working?

  • Spry Tabbed panels + Progressive Enhancement and Dynamic Loading of Content With Spry

    Is there any way to combine tabbed panels together with "Progressive Enhancement and Dynamic Loading of Content With Spry"?
    Visit: http://labs.adobe.com/technologies/spry/articles/best_practices/progressive_enhancement.ht ml#updatecontent
    And click on the "Using Spry.Utils.updateContent()"
    The 3rd example shows how to use a fade transition whenever the content changes.
    I already have tabbed panels. My menu contains buttons (on tabs) and my Content div contains the panels.
    Tabs code;
    <ul class="TabbedPanelsTabGroup">
              <li class="TabbedPanelsTab">
                   <table class="Button"  >
                        <tr>
                        <td style="padding-right:0px" title ="Home">
                        <a href="javascript:TabbedPanels1.showPanel(1);" title="Home" style="background-image:url(/Buttons/Home.png);width:172px;height:75px;display:block;"><br/></a>
                        </td>
                        </tr>
                   </table>
              </li>
    etc
    etc
    etc
    and the panel code:
    <div class="TabbedPanelsContent" id="Home">
         CONTENT
    </div>
    I hoped i can use the example code from the link into my tabbed panels.
    I thought this code:
    onclick="FadeAndUpdateContent('event', 'data/AquoThonFrag.html'); return false;"
    could be added to the tab code like this:
    <a href="javascript:TabbedPanels1.showPanel(1);" onclick="FadeAndUpdateContent('event', 'data/AquoThonFrag.html'); return false;" title="Home" style="background-image:url(/Buttons/Home.png);width:172px;height:75px;display:block;"><br/></a>
    But the content doesnt fade...
    I know i need to change the header etc.
    The following is from the link:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Aquo Events</title>
    <script src="../../../includes/SpryEffects.js" type="text/javascript"></script>
    <script src="../../../includes/SpryData.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function FadeAndUpdateContent(ele, url)
    try {
         Spry.Effect.DoFade(ele,{ duration: 500, from: 100, to: 0, finish: function() {
              Spry.Utils.updateContent(ele, url, function() {
                        Spry.Effect.DoFade(ele,{ duration: 500, from: 0, to: 100 });
    }catch(e){ alert(e); }
    -->
    </script>
    <style type="text/css">
    /* IE HACK to prevent bad rendering when fading. */
    #event { background-color: white; }
    </style>
    </head>
    So i changed my header etc, put the SpryEffects.js and SpryData.js into position and nothing changed...
    Is there a way to keep my tabbed panel (or change as less as possible) and let
    A. The fade work
    B. The loading work.
    The problem now is that it loads all pages instead of only the home. Therefore i wanted this Progressive Enhancement.
    And the fading part is just because its nice...

    It doesnt show in the post but off course i changed this link;
    "data/AquoThonFrag.html"
    into;
    "javascript:TabbedPanels1.showPanel(1);"
    I must say i dont know if this even works...

  • URLClassLoader + dynamically loading signed jar files

    I have an applet that does not know all of the jar files it will need to load at startup.
    I would like to dynamically load these signed jar files using the URLClassLoader, however it does not recognize these jar files as being signed and I get java.security.AccessControlException: access denied errors.
    Any suggestions?
    Thanks!

    Try this classloader for loading the jars, it should to the trick:
    import java.net.URL;
    import java.net.URLClassLoader;
    import java.net.URLStreamHandlerFactory;
    import java.security.AllPermission;
    import java.security.CodeSource;
    import java.security.PermissionCollection;
    import java.security.Permissions;
    public class AllPermissionsClassLoader extends URLClassLoader {
        public AllPermissionsClassLoader (URL[] urls) {
            super(urls);
        public AllPermissionsClassLoader (URL[] urls, ClassLoader parent) {
            super(urls, parent);
            System.out.println(parent);
        public AllPermissionsClassLoader (URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) {
            super(urls, parent, factory);
        protected PermissionCollection getPermissions (CodeSource codesource) {
            Permissions permissions = new Permissions();
            permissions.add(new AllPermission());
            return permissions;
    }

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

  • Can I call a dynamically loaded subvi from a subvi inside a library?

    I have an application that uses a .lvlib, this library has many subvi's.  From my executable, I can dynamically load subvi's within the library using the "open reference.vi" and passing in just the name as long as the subvi's being called are listed in the "always included" list of my build specification.  What I want to do now is load an external subvi (external to the library) using the same method.  But when I try to do this, LabVIEW cannot find the external subvi even when it is included as part of the executable.  It seems the Paths are getting messed up.  Here is what is happening:
    Lets say I have Mylibrary.lvlib as my library in the following path C:\MyProject\Mylibrary.lvlib,
    and internal.vi as my subvi within the library in the following path C:\MyProject\MySubVis\internal.vi,
    and external.vi as my subvi outside of my library in the following path C:\MyProject\external.vi
    This is all in the same project.
    I'm using the "Open VI Reference.vi" from internal.vi to call external.vi, and I'm including both internal.vi and external.vi in my executable (MyEXE.exe for illustration purposes).  When I run this part of my code I get an error and LabVIEW reports the path of my external subvi as: C:\MyProject\MyEXE.exe\MySubVis\external.vi which is really the path for my library subvi.  Why?
    Either way, when I hard code what is supposed to be the correct path to my external subvi:  C:\MyProject\MyEXE.exe\external.vi, LabVIEW can't seem to find the file, its' almost like an access scope problem because I'm trying to access something outside of the library.  Is there such thing?  If the file is part of my exe why can't LabVIEW find it???  How can I call my external.vi BY NAME from my internal.vi??
    Any help is appreciated.

    Your hardcoded path is incorrect. How do you have the build configured? Are you using the new executable structure or the pre-8.2 structure.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to style dynamically loading text?

    Hi,
    I am dynamically loading a .txt file into CS3 using
    ActionScript 3.0. I want to style the text using CSS/HTML. The only
    thing I can get to function using CSS/HTML is the "a tag", I can't
    seem to get bold, colour, font, etc working. Should i be using CSS
    or should I be doing this styling from ActionScript in the swf
    files? I have checked the help files but I could get their tags to
    work.
    Any suggestions very welcome.
    Thanks.

    you will have more control over all of this if you feed in an
    xml file rather than a txt file. you can stipulate your class
    attributes within the xml then
    if you want to style the dynamic content using just your txt
    file and the controls within the fla you could embed the typeface
    glyphs you want to use within your output swf file and colour them
    / change weight etc within the fla
    hope that is of some use
    ;-)

Maybe you are looking for