Defining class on the fly

Hi,
Is it possible to have a java program read in a new class from a text file while the program is running and then compile that class file and use it?
thanks

inabind wrote:
thanks. First of all I just wanted to know if it was possible. What I really want to do is define a whole bunch of methods which will act on data depending on the format of that data. So, when the web-app is deployed and running I want a user to be able to dynamically define a class/method to act on their own data. i.e.:
data = "The brown fox is very cunning"
method = replace every third letter with capital equivalent.
now, this is dead easy to do in the 'solid' code but i would like to do it on the fly...Well, how did you, as a person, make that decision? The rules so far aren't clear, but you're probably looking for the Strategy design pattern
Generating classes on the fly isn't going to be much use. You want to reuse components, not endlessly recreate them

Similar Messages

  • Class that creates classes on the fly?

    Hello,
    how do I do this:
    I want to have a class that produces special .class-files (with different variables, different methods) on the fly (during production).
    It should create those files so that they are ready to call (from any other class).
    Is this possible?
    What would be the best solution to this problem?
    Greetings
    zuhans

    Should you really need it:
    http://jakarta.apache.org/bcel/
    The Byte Code Engineering Library is intended to give users a convenient possibility to analyze, create, and manipulate (binary) Java class files (those ending with .class). Classes are represented by objects which contain all the symbolic information of the given class: methods, fields and byte code instructions, in particular.
    Such objects can be read from an existing file, be transformed by a program (e.g. a class loader at run-time) and dumped to a file again. An even more interesting application is the creation of classes from scratch at run-time.

  • Reloading classes on the fly?

    Is there a convenient way to reload changed classes without shutting down and restarting the cluster nodes? I would like to just do cache.clear() then reload the class files and begin populating the cache with the new objects.
    Thanks,
    Andrew

    That depends on how the classes are loaded.
    You probably used the CLASSPATH environment variable to load classes into classpath.
    In this case you have to restart your nodes in order for new classes to be loaded by the JVM.
    To my knowledge, Coherence does not provide any separate classloading features as, for example, an application server does
    where each deployed application gets its own classloader on top of the system classloader defined by CLASSPATH.
    In order to provide this same functionality you have to write a separate classloader that loads the classes of the types
    you load in the cache. In this case the coherence.jar etcetera are in the system classloader (CLASSPATH), while your
    application classes are loaded by a custom classloader.
    ConfigurablePofContext is ClassLoaderAware (http://download.oracle.com/docs/cd/E18686_01/coh.37/e18683/com/tangosol/io/ClassLoaderAware.html)
    From the ConfigurablePofContext API (http://download.oracle.com/docs/cd/E18686_01/coh.37/e18683/com/tangosol/io/pof/ConfigurablePofContext.html):
    "It is conceivable that the ConfigurablePofContext is loaded by the system ClassLoader (or some other relatively global ClassLoader), while the objects
    deserialized by the PofContext are loaded by an application-specific ClassLoader, such as is typical within an application server. The ConfigurablePofContext
    is designed to load the configuration, the POF-able object classes and the PofSerializer classes from within a specified ClassLoader context, and to pass
    the ClassLoader information on to the PofSerializer instances, just in case they are not loaded from within the application's ClassLoader context.
    In other words, the ConfigurablePofContext, its configuration, the PofSerializer classes and the POF-able classes can all be loaded by the same ClassLoader,
    or they can all be loaded by different ClassLoaders, so long as the configuration, the POF-able classes and the PofSerializer classes can be loaded by either
    the specified ClassLoader or by the ClassLoader that loaded the ConfigurablePofContext itself."
    The problem is (with most classloading) how to unload the classes that are referenced in a runtime environment. This usually means, in the case of an
    application server, to delete a certain deployment and redeploy again.
    Hope it makes a little sense.
    An example of a custom classloader and same more background on classloading can be found here: http://middlewaremagic.com/weblogic/?p=6725

  • Compiling new classes on the fly without having a .java file

    Hi everybody,
    I'd like to compile dynamically produced JAVA code (code from user input in my application). I don't wanna store the source code in a .java file, but just compile the code (as char[] or something like that) to a byte[].
    Does anybody have an idea ??
    Thanks
    Jan

    Have you looked at the idea of interpreting rather than compiling, say using Jython (a python interpreter written in Java). Python and Java are extremely close in syntax, and it should be relatively easy to do what you are talking about.
    I am worried though, that you are going to let users type in text, and assume that it has valid syntax in the language you are using. Many years of UI experience indicate that letting users type in anything results in a certain error rate. Letting it be instructions you are to follow in your code is even more dangerous.
    There are many programs that let users define actions interactively. They seem to either let the user type in text, and error check it to death (a lot of work, think spreadsheet type programs), or they present the user with a set of choices, often using a wizard type interface, which takes more up front UI work, but only lets the users select valid options.
    It sounds like you want to interpret what the user types in as instructions. Even with Jython (or a similar interpreter), you would need to parse the user input for formatting errors, invalid variable names, and anything else they could make a mistake on, before you could pass any of it to the interpreter.
    Good luck.

  • Creating the class on the fly.

    Hi all,
    I want to create a class not an instance on runtime. Is there any way to create a class on runtime and then get its intance?
    Rana.

    As I see it you'll need to create and compile a .java file it in runtime. Getting an instance can be then done through reflection.
    The class java.lang.Compiler may prove useful.
    You can use the sun's javac for getting started but you can't distribute it. IBM has an open source java compiler: http://oss.software.ibm.com/developerworks/opensource/jikes/
    Creating a new instance of a class: Class.forName("full.class.Name").newInstance() (assuming you have a no-arg constructor)

  • Overriding classes on the fly

    Hello everyone!
    Sorry for the vague title, as I don't know quite how to name the following example of code:
    AbstractClass concreteObject = new AbstractClass( a, b ) {
                public void previouslyAbstractMethod (Object parameter) {
                    doSomethingWith( parameter );
            };My question is this: if I wanted to pass a local variable into my newly overridden and substantiated class object, is it impossible to create a new constructor in my override? For example:
    AbstractClass concreteObject = new AbstractClass( a, b, c ) {
                public AbstractClass( A a, B b, C c ) {
                    super( a, b );
                    doSomethingSpecial( c );
                public void previouslyAbstractMethod (Object parameter) {
                    doSomethingWith( parameter );
            };Or do I have to live with the kind of mess I've been using as below:
    AbstractClass concreteObject = new AbstractClass( a, b ) {
                public AbstractClass returnMeButAlsoDoSomething( C c ) {
                    doSomethingSpecial( c );
                    return this;
                public void previouslyAbstractMethod (Object parameter) {
                    doSomethingWith( parameter );
            }.returnMeButAlsoDoSomething( c );It all seems a little messy to me (yeah yeah I know I should be creating separate classes for these kinds of arrangements, but when you have lots... creating single-object classes this way is so convenient!)
    Appreciate the help!
    Weasel.

    My main use of this code is to pass in an extra
    parameter for an event handler to use (normally the
    parent object so I can run a method)... I suppose I
    could start registering the parent as the event
    handler, but there may be alot of event spawners to
    register it with.
    Implement the handler as an interface and return the appropriate type via the Factory pattern.
    I'm definitely loathe to create named classes for
    these objects when all I'm doing is passing a
    parameter in and overriding a single and simple
    method.
    Not all objects are huge. In fact, some of the most useful are the smallest. I try to keep any object to a dozen methods or less, and any method to no more than screen-size in my IDE. Large classes should usually be refactored into smaller ones. I have never heard of a class that is 'too small', as long as it is doing something useful.
    I'm probably alone on this point, but I like the feel
    of anonymous classes taking parameters more than have
    a ton of 'if then else if's in the event catcher!
    If you have real objects, polymorphism will take care of this for you, and you will have cleaner, shorter code in your objects.
    Thinking about it, I'm almost certain I'm alone in
    this :o) In fact, I'd consider myself a bit odd!No worries. If it runs and works, it's valid. Might not be maintainable, but still would be valid.
    - Saish

  • Loading the user defined class file

    Hai,
    Is there any way to load the user defined class at the time of starting my Jakarta Tomcat server.
    Regards
    ackumar

    Hi!!
    Hope, <load-on-startup> tag of web.xml helps in
    s in this regard.I think this tag is to load servlet. I am talking about loading a user defined class file for example xyz.class which is no a servlet just a class file.
    Regards
    ackumar

  • Error while defining class: com.crystaldecisions.data.xml.CRDB_XMLImpl This error indicates that the class: OCA.OCAdbdll.DbDLLOperations could not be located while defining the class: com.crystaldecisions.data.xml.CR...

    Post Author: lkamesam
    CA Forum: Integrated Solutions
    Hi,
            I am running Crystal Reports version 10 from IBM Rational 6.0.1  build 20050725_1800 XML data source. When I try to run the report under WAS 6.0.1 I get the following error:
    Does any body have any clue how to resolve my problem? Thanks
    Error 500: Error while defining class: com.crystaldecisions.data.xml.CRDB_XMLImpl This error indicates that the class: OCA.OCAdbdll.DbDLLOperations could not be located while defining the class: com.crystaldecisions.data.xml.CRDB_XMLImpl This is often caused by having the class at a higher point in the classloader hierarchy Dumping the current context classloader hierarchy: ==> indicates defining classloader *** indicates classloader where the missing class could have been found ==>&#91;0&#93; com.ibm.ws.classloader.CompoundClassLoader@163dd786 Local ClassPath: C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\classes;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\bobj_platform_jsf.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\cecore.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\celib.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\ceplugins.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\cereports.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\cesession.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\clientlogic.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\Concurrent.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CorbaIDL.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CRDBXMLExternal.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CRDBXMLServer.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalCharting.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalCommon.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalContentModels.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalExporters.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalExportingBase.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalFormulas.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalQueryEngine.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalReportEngine.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\CrystalReportingCommon.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\ebus405.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\icu4j.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\jrcerom.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\jsf_common.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\keycodeDecoder.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\log4j.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\MetafileRenderer.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\rasapp.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\rascore.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\rpoifs.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\serialization.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\URIUtil.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\webreporting-jsf.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\webreporting.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\xercesImpl.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent\WEB-INF\lib\xmlParserAPIs.jar;C:\Documents and Settings\Administrator\IBM\rationalsdp6.0\workspace\sample1\WebContent; Delegation Mode: PARENT_FIRST &#91;1&#93; com.ibm.ws.classloader.JarClassLoader@338761606 Local Classpath: Delegation mode: PARENT_FIRST &#91;2&#93; com.ibm.ws.classloader.ProtectionClassLoader@38e75786 &#91;3&#93; com.ibm.ws.bootstrap.ExtClassLoader@7e475784 &#91;4&#93; sun.misc.Launcher$AppClassLoader@7e5a5784 &#91;5&#93; sun.misc.Launcher$ExtClassLoader@7e565784 -Original exception- java.lang.NoClassDefFoundError: OCA/OCAdbdll/DbDLLOperations at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code)) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java(Compiled Code)) at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:576) at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code)) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code)) at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code)) at com.crystaldecisions.reports.queryengine.driver.i.<init>(Unknown Source) at com.crystaldecisions.reports.queryengine.driver.i.case(Unknown Source) at com.crystaldecisions.reports.queryengine.av.ak(Unknown Source) at com.crystaldecisions.reports.queryengine.av.else(Unknown Source) at com.crystaldecisions.reports.queryengine.av.byte(Unknown Source) at com.crystaldecisions.reports.queryengine.av.do(Unknown Source) at com.crystaldecisions.reports.queryengine.as.new(Unknown Source) at com.crystaldecisions.reports.queryengine.at.long(Unknown Source) at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source) at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source) at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source) at com.crystaldecisions.reports.reportdefinition.cy.b(Unknown Source) at com.crystaldecisions.reports.reportdefinition.cy.long(Unknown Source) at com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source) at com.crystaldecisions.reports.reportdefinition.a1.a(Unknown Source) at com.crystaldecisions.reports.common.ab.a(Unknown Source) at com.crystaldecisions.reports.common.ab.if(Unknown Source) at com.crystaldecisions.reports.reportdefinition.a1.if(Unknown Source) at com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source) at com.crystaldecisions.reports.reportengineinterface.a.a(Unknown Source) at com.crystaldecisions.reports.reportengineinterface.JPEReportSource.a(Unknown Source) at com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory.createReportSource(Unknown Source) at com.crystaldecisions.report.web.a.a.K(Unknown Source) at com.crystaldecisions.report.web.event.aa.a(Unknown Source) at com.crystaldecisions.report.web.event.aa.a(Unknown Source) at com.crystaldecisions.report.web.event.bx.a(Unknown Source) at com.crystaldecisions.report.web.event.b1.broadcast(Unknown Source) at com.crystaldecisions.report.web.event.as.a(Unknown Source) at com.crystaldecisions.report.web.WorkflowController.if(Unknown Source) at com.crystaldecisions.report.web.WorkflowController.doLifecycle(Unknown Source) at com.crystaldecisions.report.web.ServerControl.a(Unknown Source) at com.crystaldecisions.report.web.ServerControl.processHttpRequest(Unknown Source) at com.crystaldecisions.report.web.viewer.taglib.ServerControlTag.doEndTag(Unknown Source) at com.crystaldecisions.report.web.viewer.taglib.ReportServerControlTag.doEndTag(Unknown Source) at com.ibm._jsp._sample._jspx_meth_crviewer_viewer_0(_sample.java:135) at com.ibm._jsp._sample._jspService(_sample.java:77) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629) at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117) at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:171) at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:230) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220) at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934) at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021) at

    For those who would have the same problem, here is how I could eventually fix it.
    Since the Flex Test Drive is sometimes out of sync with flash builder 4, I recreated a project using other help pages on Adobe site :
    Entry point :
    http://help.adobe.com/en_US/Flex/4.0/AccessingData/WSbde04e3d3e6474c4-668f02f4120d422cf08- 7ffd.html
    As suggested, I used the New Project wizard to create a new project, with :
    Application server type : J2EE
    Check the radio button "Use remote object access service : BlazeDS"
    Then, as indicated in following pages (section "Accessing BlazeDS")... :
    file:///C:/Mes%20documents%20C/Commun/Developpement/Documentation/HT-Tracks/AccessingData/ help.adobe.com/en_US/Flex/4.0/AccessingData/WSbde04e3d3e6474c4-668f02f4120d422cf08-7ffe.ht ml#WSbde04e3d3e6474c4-19a3f0e0122be55e1b7-8000
    ...I selected the "Data / Connect to Data/Services..." menu option, which started the Data/service connection wizard.
    There, I selected a BlazeDS (and not Web Services) service type, and everything went fine.
    Suggestion to adobe staff : maybe it would be useful to update the Flex Test Drive to reflect Flash Builder 4 ?
    Very nice product anyway, so far, congratulations...
    Rgds
    Marc.

  • Using Class and Constructor to create instances on the fly

    hi,
    i want to be able to create instances of classes as specified by the user of my application. i hold the class names as String objects in a LinkedList, check to see if the named class exists and then try and create an instance of it as follows.
    the problem im having is that the classes i want to create are held in a directory lower down the directory hierarchy than where the i called this code from.
    ie. the classes are held in "eccs/model/behaviours" but the VM looks for them in the eccs directory.
    i cannot move the desired classes to this folder for other reasons and if i try to give the Path name to Class.forName() it will not find them. instead i think it looks for a class called "eccs/model/behaviours/x" in the eccs dir and not navigate to the eccs/model/behaviours dir for the class x.
    any ideas please? heres my code for ye to look at in case im not making any sense:)
    //iterator is the Iterator of the LinkedList that holds all the names of the
    //classes we want to create.
    //while there is another element in the list.
    while(iterator.hasNext())
    //get the name of the class to create from the list.
    String className = (String) iterator.next();
    //check to see if the file exists.
    if(!doesFileExist(className))
    System.out.println("File cannot be found!");
    //breake the loop and move onto the next element in the list.
    continue;
    //create an empty class.
    Class dynamicClass = Class.forName(className);
    //get the default constructor of the class.
    Constructor constructor = dynamicClass.getConstructor(new Class[] {});
    //create an instance of the desired class.
    Behaviour beh = (Behaviour) constructor.newInstance(new Object[] {});
    private boolean doesFileExist(String fileName)
    //append .class to the file name.
    fileName += ".class";
    //get the file.
    File file = new File(fileName);
    //check if it exists.
    if(file.exists())
    return true;
    else
    return false;
    }

    ok ive changed it now to "eccs.model.behaviours" and it seems to work:) many thanks!!!
    by the following you mean that instead of using the method "doesFileExist(fileName)" i just catch the exception and throw it to something like the System.out.println() ?
    Why don't you simply try to call Class.forName() and catch the exception if it doesn't exist? Because as soon as you package up your class files in a jar file (which you should) your approach won't work at all.i dont think il be creating a JAR file as i want the user to be able to create his/her own classes and add them to the directory to be used in the application. is this the correct way to do this??
    again many thanks for ye're help:)

  • Switching BW authorization concept back and forth on the fly

    After upgrading to BW 7.0, we are currently developing the BW authorizations from scratch with the new analytical authorizations. The system is currently set to the legacy RSR authorization objects. The idea is now to define two timeframes on our development system, one for the users working with old authorizations, and a second timeframe for testing the new analytical authorizations.
    Can we switch the authorization concept back and forth on the fly, or are there any obstacles?
    Thanks in advance!

    Andreas,
    The latest version of BW is 7.3 which is also Analysis authorization concept like 7.0. So please clarify from the system status what level are you upgrading to.
    Under 7.0, the RSR objects were still available i.e. you can switch the concept back and forth on the fly, it will trigger a transport. AFAIK - In 7.3 however there is no support for RSR anymore in fact even the object class is not visible and so does the switch for the concept and even RSR objects (Z-objects) do not show up in PFCG either.
    So if you are moving to 7.0 switch is possible, 7.3 it is not. But in either case, you should be upgrading using a dual landscape with upgrade work being done & tested in separate boxes than daily production support landscape. It will come in handy at the time of testing also.
    Regards,
    Shivraj Singh

  • Creating buttons on the fly and setting button properties

    If I have a view and want to add buttons to it "on the fly" from values in an array, is that something straightforward to do?
    I have an array of UIImageVIew objects and would like to create buttons from them (showing the image on the buttons) and associate those buttons with a method in my implementation file. That would be a lot more general and flexible than creating the buttons in the Interface Builder I would imagine.
    And one more question - can I freely set button properties while doing that? Or in Objective-C can I only set properties that are already pre-defined for that class?
    Thanks!
    doug

    Thanks for your reply.
    That.... works! Thanks!
    And I can generate the button and click on it and it calls my other method and that works too. Cool!
    The syntax is still very mysterious to me, but I suppose eventually I'll understand what it all means.
    Breaking it down to see what it means:
    [button1 addTarget:self action:@selector(selectedHandler1:) forControlEvents:UIControlEventTouchUpInside];
    * button1 is the object I created (I'm going to try to do this in a loop next.)
    * addTarget is a message I am sending to button1 and the content of the message is "self", which refers to - this button? I'm not sure why such a message would be necessary.
    * action is another message sent to button1 and the contents of that message are a little harder to parse. I see the result, and can mimic the syntax now that I've seen it, but I don't really understand what the @ is for, or the : after the method name or why this wouldn't just be "action: selectedHandler". I'm sure the language designers have a logical reason for all that, but I don't quite "grok" those extra symbols yet.
    * forControlEvents is another message sent to button1 and the event message itself is clear in its meaning.
    Anyway, that is working and I can refer more to the UIButton class reference now and try to set more stuff, like position it better, etc.
    Thanks very much!
    doug

  • Print Module templates layouts do not update on the fly

    Print layouts do not update on the fly when attempting to choose between various Print Module>Template Browser> Lightroom or User templates. This occurs in all three Layout Styles. The very first layout chosen in Single Image/Contact Sheet, Picture Package, or Custom Package is the permanent 'default' and cannot be changed. The Preview will show as expected however any image stays stuck in the very first layout I chose after installing LR4 beta.
    For example, I first chose Template Browser>Lightroom Templates>Maximum Size, and Layout Style>Single Image/Contact Sheet. Clicking through any other Templates (Lightroom or User defined) will alter the preview but not the layout display in the Print window. Same problem in either of the other Layout styles. I have been trying for days to rectify this, but it seems somehow more difficult than LR3. and not what I expect.
    As a comparison, using the same steps in LR3 works perfectly as all print template/layouts can be changed on the fly as expected. I have no problems generating different layouts in LR3 and have been using LR print module since version 1 without this issue.
    Is this a bug or are there any extra steps or workarounds I have not discovered? Any other testers seen this?

    Update with more info. What am I doing wrong, if anything?
    Print layouts do not update on the fly when attempting to choose between various Print Module>Template Browser> Lightroom or User templates. This is not a hang since the layouts do not change after the initial choice no matter how much time elapsed.
    iMac OS 10.6.8. 8GB RAM.Processor Intel Core 2 Duo. NVIDIA GeForce 8800 GS.
    The steps as follows:
    1) Lightroom 3.6 & LR4Beta exist side by side.
    2) LR4 Beta> Print Module;
    3) From filmstrip choose image;
    4) Template Browser> Lightroom4Beta Templates>Maximum Size;
    5) Preview displays as expected;
    6) Layout Styles>Single Image/Contact Sheets
    7) Template Browser> Lightroom4Beta Templates>click through any other templates (Lightroom or User defined);
    8) Image layout in main window does not update;
    9) Previews update;
    10) Layout Style>Picture Package;
    11) Template Browser>Maximum size is then automatically shown, however the template in the main window is actually (1) 7x5, (2) 2.5x3.5;
    12) Any further attempts to change the layouts regardless of Style Layout choices are not successful.
    13) Close LR4Beta>re-open LR4Beta;
    14) Repeat test;
    15) Print Module layouts do not update on the fly as expected;
    16) Close LR4Beta and all applications;
    17) Reboot iMac.
    18) Open LR4Beta only;
    19) LR4Beta>Print Module>Template Browser >Lightroom Templates>Maximum Size;
    20) Image displays in main layout window with Template and Preview display as expected;
    21) Choose different image>Template Browser>Lightroom Templates>Maximum Size;
    22) Click through templates, layouts DO NOT update in main window although previews do automatically update.
    23) CONCLUSION - In Lightroom 4 Beta>Print Module>Template Browser, image layouts do not change after initial choice as expected.
    I posted this on Photoshop.com as a problem.

  • How do I test a Java card applet with different AIDs on the fly?

    ... Like sweeping cards from employees in a queue of people lining up in the morning?
    When I created my applet, the aid is a fixed value inside the class.
    Whenever I wanted to test it with another value, I changed that AID and rerun the applet.
    I find it very cumbersome that needs to be rerun and rerun, over and over again.
    How do I test the applet easily with any values of AIDs that I'd like to put in, on the fly.
    I know I can't simulate the sweeps of card in the applet because I can't have a main method with a signature
    of Strings[] args or String[] args. I can only have JUnit to help me out, but still java card doesn't allow either
    main(Strings[] args) or TestCase to inherit from.
    Thanks
    Jack

    your question is hard to understand but:
    an applet always has one definite AID and you cant change it after install as far as i know
    a) you want to test many cards with diffrent AIDs?
    ->send a list of select commands and check the return values
    b)you want one card with the same applet to be available for many AIDs?
    ->install many dummy applets forwarding the commands to one core applet
    c)i think i didnt get your point :/

  • JAVA 3D: How to animate "on-the-fly"?

    Hy guys,
    I'm new to Java 3D and I've read a whole bunch of tutorials as well as Selman's book.
    However, as great as Java 3D seems, it seems like I can't get Interpolators to work the way I want them to! Here is my goal:
    Create a simulation where the View is FIXED and the main ANIMATED character (comibnation of objects) MOVE AROUND the universe through the user's keyboard commands.
    I've managed the above by creating all my objects, adding them to a branchgroup, adding that branchgroup to a transformgroup, adding a few interpolator animations to the transformgroup and finally adding a cutom keyboard navigator behavior to the transformgroup.
    The following problem has occurred:
    I can't NICELY move the transformgroup around because I use Transform3D objects to calculate the next position of the transformgroup and I then apply it to the transformgroup by calling the "setTransform" method on that group with the Transform3D object. The result is an instantaneous leap x locale units away with no animation in between the original and final position. :o( This is the only way I got this working. The Java runtime keeps yelling at me that I can't add or remove Interpolators or transformgroups from other transformgroups or branchgroups, so I can't change interpolators on-the-fly (say, when the user wants to move in a different direction)... Can it possibly be that we can only declare and use interpolators at prior to executing a universe?!
    The IDEAL solution I'm looking for (!INSERT YOUR HELP HERE! ;o) ):
    Replace the ugly "setTransform" call by adding a PositionInterpolator or something to the transformgroup object in order to generate a SMOOTH ANIMATION from the original position to the final position. The end result will be must nicer and more professional.

    Ok, I've modified the simple behavior class in order to extend the PositionInterpolator class and be able to get a translation that always begins from the last target position. Eventually, I'd also like to be able to modify the AXIS so I can change direction... Anyway, right now I just want what IWON managed to do in one direction.
    Here's what I got that DOESN'T WORK, can someone please help me, IWON?:
    // Allows an object or group of objects to be moved around SMOOTHLY by the keyboard.
    public class KeyboardControlBehavior extends PositionInterpolator {
    private TransformGroup source;
    public static final float distance = 0.1f;
    public static final long time = 200;
    // create SimpleBehavior
    KeyboardControlBehavior(TransformGroup source, TransformGroup target){
    super(new Alpha(1, Alpha.INCREASING_ENABLE, 0000, 0, time, 0, time, 0, 0, 0), target);
    // initialize the Behavior
    // set initial wakeup condition
    // called when behavior beacomes live
    public void initialize(){
    // set initial wakeup condition
    this.wakeupOn(new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED));
    // behave
    // called by Java 3D when appropriate stimulus occures
    public void processStimulus(Enumeration criteria){
    // Check which direction we're going and adjust the AXIS and endPosition
    // in consequence.
    KeyEvent event = (KeyEvent) ((WakeupOnAWTEvent) criteria.nextElement()).getAWTEvent()[0];
    int c = event.getKeyCode();
    System.out.println("KEY PRESSED = "+c);
    if ( c != KeyEvent.CHAR_UNDEFINED ) {
    if(c == KeyEvent.VK_UP) {
    System.out.println("UP");
    if(c == KeyEvent.VK_DOWN) {
    System.out.println("DOWN");
    if(c == KeyEvent.VK_LEFT) {
    System.out.println("LEFT");
    if(c == KeyEvent.VK_RIGHT) {
    System.out.println("RIGHT");
    // Let the PositionInterpolator animate the translation.
    super.processStimulus(criteria);
    // Adjust the source's position to be at the end position of the
    // animation (same as target).
    Transform3D newPosition = new Transform3D();
    Transform3D oldPosition = new Transform3D();
    source.getTransform(oldPosition);
    target.getTransform(newPosition);
    newPosition.mul(oldPosition);
    source.setTransform(newPosition);
    // Reset the Alpha class since it only executes once.
    super.getAlpha().setStartTime(0);
    // Consume the event.
    event.consume();
    // do what is necessary
    this.wakeupOn(new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED));
    } // end of class SimpleBehavior

  • Problem in drawing image on the fly using jsp

    I have been searching the forum and web for the problem but in vain. I have wrote a jsp which creates an image on the fly from the data selected from the database. But after the image is drawn, it throws an IllegalStateException. The offending code is at the time of releasePageContext() method of the compiled jsp. I am using the following code in jsp to display the image.
    BufferedImage bi = obj.getBufferedImage();
    javax.imageio.ImageIO.write(bi,"png",response.getOutputStream());
    I even tried to do the same with servlet, but the problem is that when I am using forward action in jsp I am getting the image but the control is in the servlet and if I am including the servlet, I am getting junk characters instead of image. I have set the content type in servlet and also in jsp.
    Thank you in advance.

    Hi all,
    I've developed a web application using glassfish server... my database is postgresql.... i try to generate a report using Jasper Reports.... i've succesfully developed the report template..... My problem when ever i try to generate a report it gets the data from the back end.... and throws the following error.....
    StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    java.lang.IllegalStateException: getOutputStream() has already been called for this response
    at org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:652)
    at org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:196)
    at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:149)
    at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:142)
    at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:216)
    at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:134)
    at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:89)
    at org.apache.jsp.GenerateBirthCertificate_jsp._jspService(GenerateBirthCertificate_jsp.java:149)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    i've written my code in jsp.... My code is....
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page language="java" import="java.io.*, net.sf.jasperreports.engine.*, java.sql.*, java.util.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>CDAC Portal</title>
    </head>
    <body>
    <%
    try {
    Connection con=null;
    String query="";
    String regNo="";
    regNo=request.getParameter("regNo");
    regNo = regNo.toUpperCase();
    out.println("Registration No :"+regNo);
    Class.forName("org.postgresql.Driver");
    con = DriverManager.getConnection("jdbc:postgresql://192.168.31.79:5432/Municipality","postgres","");
    System.out.println("connected succefully");
    ServletContext context = this.getServletConfig().getServletContext();
    File reportFile = new File(context.getRealPath("/reports/birth_cert.jasper"));
    query="select * from birth_details where regn_unit='"+regNo+"'";
    Map parameters = new HashMap();
    parameters.put("regNo",""+regNo);
    parameters.put("query",""+query);
    byte[] bytes = null;
    try {               
    bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), parameters, con);
    response.setContentType("application/pdf");
    response.setContentLength(bytes.length);
    ServletOutputStream ouputStream = response.getOutputStream();
    ouputStream.write(bytes, 0, bytes.length);
    ouputStream.flush();
    ouputStream.close();
    } catch (JRException e) {
    System.out.println("Error : "+e);
    con.close();
    } catch(Exception exc) {
    System.out.println("Connection pool error :"+exc.toString());
    %>
    </body>
    </html>
    can anyone help me hw to solve this problem....
    Thanks in advance
    R Vijay,
    Project Engineer,
    CDAC, Chennai.
    India
    [email protected]
    [email protected]

Maybe you are looking for

  • Can a 4th generation ipod touch have a second hard drive?

    i have a 4th generation ipod touch and i am wondering if it is possible to have a second hard drive on it?

  • IE incompatible ? Image size.

    Hi, I know very little about HTML, CSS and the like but as a photographer I upload gallery webs all the time for clients etc. I generate these in PS CS2 or iView MediaPro and then upload to my server (shared web hosting). With a current project requi

  • IPhoto5 to iPhoto6 question

    I tried searching the threads here but haven't seen an answer to my specific question. Apologies if this has been already answered... Had my old PowerMac (running iPhoto5) die recently (hard drive survived) and I upgraded to the MacPro (now running i

  • When should I buy a new battery?

    I've had my macbook for 8 months, I'm just wondering when should I buy a new battery? The cycle count is 310, and checking System Profiler, the battery full charge is 5143. Should I buy a new battery in a now, or should I not worry about buying a new

  • Vendor sub-range in automatic po

    Hi, All, I have a problem with vendor sub-range in the next process: In info record there is sub-range SR1 for material/vendor. In contract there is sub-range SR2 for same material/vendor In mrp was created requisition with reference to contract. we