Using a class or servlet that implements Serializable

Hello everyone,
Can someone please help me. I need to make a program that uses a class or servlet that implements Serializable and then use the values of the variables in servlets.
The first is using it to validate login. then changing the color of the background, header and footer of each servlet.
the variables in the Serialized file are all Strings for color, username, password, header text and footer text.
I tried using the applet tag to run the class in the servlet but it is not working.

It's not working because you seem to be making random guesses what servlets, serialization and files are

Similar Messages

  • Modifying a Class that implements Serializable

    I have a class LDAPUser
    import java.io.*;
    public class LDAPUser implements java.io.Serializable{
         private java.lang.String name;
         private java.lang.String userID;
         private java.lang.String associateNumber;
    public LDAPUser() {
         super();
    public boolean equals(Object o) {
         if (o == this)
         return true;
         if (!(o instanceof LDAPUser))
         return false;
         return (((LDAPUser)o).getAssociateNumber().equals(this.getAssociateNumber()));
    public java.lang.String getAssociateNumber() {
         if(associateNumber == null){
              return getUserID();
         return associateNumber;
    public java.lang.String getName() {
         return name;
    public java.lang.String getUserID() {
         return userID;
    public void setAssociateNumber(java.lang.String newAssociateNumber) {
         associateNumber = newAssociateNumber;
    public void setName(java.lang.String newName) {
         name = newName;
    public void setUserID(java.lang.String newUserID) {
         userID = newUserID;
    It works fine.
    I needed to add functionality to it. These were the modifications.
    private java.lang.String distinguishedName;
    private boolean validUser;
    public java.lang.String getDistinguishedName() {
         return distinguishedName;
    public boolean isValidUser() {
         return validUser;
    public void setDistinguishedName(java.lang.String newDistinguishedName) {
         distinguishedName = newDistinguishedName;
    public void setValidUser(boolean newValidUser) {
         validUser = newValidUser;
    I am using visual age for java and in the Test environment the changes work fine.
    When I promote the changes to our application server (websphere) the changes are not there. I get a method not found error and though trial and error have identified that the server is not actually using the class from the jar. I have removed any other occurences of the class from the server.
    My question is if I change a Serializable class how do I make those changes take affect (thorough better coding) and for right now, where is this "old instance" of my class coming from and how do I get rid of it.
    Thanks in Advance,
    Jason Grieve

    If the server is running than the class might be already loaded through the class loader, so it wont be load again.
    this unless you use hot deployment, which you have to figure how it is being handled in your srver.
    Doron

  • Example class that implements Serializable interface

    Dear,
    I have a class myData that I want to implement Serializable interface. class myData has only two fields: Integer iData1, String sData2.
    Could anybody shown me how my myData class should be?
    Thanks a lot!

    Hey, if you have yet to obtain a remote reference from the app server ...then we are into pandora's box. I lost three whole heads of hair getting up on JBoss when I first started. You want to check out the JBoss forums on the JBoss website, and the enterprise javabeans forum here. Search some posts and read the free JBoss manual.
    Unfortunately, there isn't a 'here, do this' solution to getting connected with JBoss. There are quite a few gotcha's. There are descriptors, descriptor syntax ...and this changes between releases so there seems to be alot of people saying 'here, do this' ...but you try and it doesn't work (wrong release). Here are some descriptors that I threw up recently for someone ...a place to start.
    http://forum.java.sun.com/thread.jsp?forum=13&thread=414432
    This drove me nuts until it all worked right. I was stuck for three weeks at one point ...ready to give up, but then I got it. Perservere ...its a nice container for learning in (its free!).
    I will try and watch for you.
    Oh, and put something in your head ...at least then you will keep your hair !
    :)

  • Declaring Argument as Class of Enum That Implements Interface

    I'm trying to declare a method parameter that is the class of an enum which implements a specified interface. I can't figure out the required syntax, or if this is even possible.
    Here is the interface:
    public interface Describer { String describe(); }_________________________________________________
    Here' s an enum that implements the interface:
    public enum DeviceProperty implements Describer {
    TYPE("Device Type"),
    USE("Device Use");
    private String description;
    private DeviceProperty(final String description) { this.description = description; }
    @Override public String describe() { return description; }
    Here's my unsuccessful attempt to declare the method parameter:
    public <E extends Enum<E extends Describer>> void addChanges(final Class<E> properties) {
         final EnumSet<E> set = EnumSet.allOf(properties);
         for (final Enum<E> property : set) {
              // Do something with the property
    The problem, of course, is that addChanges() doesn't compile. If I remove "extends Describer" it compiles, but then I can't detect compile time errors (i.e., an enum which doesn't implement Describer).
    Is what I'm attempting even possible in Java? If so, I'd be very grateful if someone could explain the correct syntax.

    doremifasollatido wrote:
    TPD Opitz-Consulting com wrote:
    aksarben wrote:
    [...]Here's my unsuccessful attempt to declare the method parameter:
    public <E extends Enum<E extends Describer>> void addChanges(final Class<E> properties)
    Nothing is being returned at all. The method return type is "void".OK.
    Then I understand that <tt>&lt;E extends Enum&lt;E extends&gt; &amp; Describer&gt;</tt> is a more detailed definition for the parameter type <tt>Class&lt;E&gt;</tt>, right?
    And your method iterates over all the constants defined in the passes enum type.
    Meight be usefull sometiems.. thanks!
    bye
    TPD

  • Servlet that implements RMI

    Hi Everyone,
    I m planning to implement RMI with servlet. The architecture is as follows:
    --> Http request to the server(tomcat) where the servlet will accept the request. It will get the header request and the post request and on the basis of this post request it will invoke RMI to process specific functionality like fetching image from database.
    --> RMI then uses JDBC to interact with the database and get required results.
    --> The servlet then returns this image back to the client.
    Now, I have seen some examples for servlet and RMI but I havent seen a concrete tutorial explaining this situation.
    Is my architecture correct ? Is there anything that I m missing ?
    Please guide me.
    Thank you.

    Hi DrClap,
    Thanks for your reply.
    Well, I did that ! I pasted RMI Client code to Servlets doGet method but it wont compile and gives me 2 errors.
    symbol  : class HelloInterface
    location: class HelloWorld
    HelloInterface hello = (HelloInterface) Naming.lookup ("//xxx.xxx.xxx/Hello"
    ^
    HelloWorld.java:14: cannot find symbol
    symbol  : class HelloInterface
    location: class HelloWorld
    HelloInterface hello = (HelloInterface) Naming.lookup ("//xxx.xxx.xxx/Hello"
                            ^
    2 errorsI have the Stub and Interface in web-inf/classes folder but I dont know whats happening over here. I have checked the interface and everything but it wont work.
    And my servlet :
    try
    HelloInterface hello = (HelloInterface) Naming.lookup ("//xxx.xxx.xxx/Hello");
    System.out.println("IP Address: "+hello.showIPAddress());
    System.out.println("User Name: "+hello.getUsernames());
    }catch(Exception e)
    System.out.println("Error from hello world: "+e);
    }Message was edited by:
    siddhsdesai

  • My class is serializing w/o implementing serializable

    I have a class Foo that implements Serializable.
    Foo has a data member that is an instance of class Bar.
    Class Bar does NOT implement Serializable.
    When I serialize an instance of Foo out to a file and
    then deserialize it back in, I'm seeing Bar's no-arg
    constructor being called.
    Shouldn't I be getting IOExceptions on the write and
    and read of my Foo instance when the JVM tries to
    write/read the Bar member, since only classes that implement
    Serializable can be serialized/deserialized?
    Oh, I'm using JDK 2SDK version 1.3.1
    -Steve

    From the Serializable API
    "To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable in this case. The error will be detected at runtime."
    There seems to be a mistake in the second to last sentence. I would think itr should say 'It is an error to declare a class Serializable if this is not the case'.

  • Calling class from servlet gives 500

    I have a servlet that works fine by itself, and another class that works fine by itself. However, when I try to create a new instance of the class using the servlet and access a method in the class such as:
    Servlet code
    Object a = new Object()
    a.method
    the server returns 500.
    Is there some security aspect to calling classes from servlets that may be causing this?

    Thanks for the replies which have tracked the problem down.
    The Server log says:
    NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
    This class is needed by the class being called by the servlet.
    The missing class is in a jar file which is put on the classpath when running the class in a standalone environment. I don't know if it's possible to put this jar on the classpath in the Server environment.
    However a solution is to explode the jar file and put the exploded classes in the WEB-INF/classes of the Server. The only disadvantage is that they get wiped out every time I re-deploy the application war file.

  • Serializing a class that implements the Singleton pattern

    Hello,
    I am relatively new to Java and especially to serialization so the answer to this question might be obvious, but I could not make it work event though I have read the documentation and the article "Using XML Encoder" that was linked from the documentation.
    I have a class that implements the singleton pattern. It's definition is as follows:
    public class JCOption implements Serializable {
      private int x = 1;
      private static JCOption option = new JCOption();
      private JCOption() {}
      public static JCOption getOption() { return option; }
      public int getX() { return x; }
      public void setX(int x) { this.x = x; }
      public static void main(String args[]) throws IOException {
        JCOption opt = JCOption.getOption();
        opt.setX(10);
        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("Test.xml")));
        encoder.setPersistenceDelegate(opt.getClass(),  new JCOptionPersistenceDelegate());
        encoder.writeObject(opt);
        encoder.close();
    }Since this class does not fully comply to the JavaBeans conventions by not having a public no-argument constructor, I have create a class JCOptionPersistenceDelegate that extends the PersistenceDelegate. The implementation of the instantiate method is as follows:
      protected Expression instantiate(Object oldInstance, Encoder out) {
           Expression expression = new Expression(oldInstance, oldInstance.getClass(), "getOption", new Object[]{});
            return expression;
      }The problem is that the resulting XML file only contains the following lines:
        <java version="1.5.0_06" class="java.beans.XMLDecoder">
            <object class="JCOption" property="option"/>
        </java> so there is no trace of the property x.
    Thank you in advance for your answers.

    How about this:
    import java.beans.DefaultPersistenceDelegate;
    import java.beans.Encoder;
    import java.beans.Expression;
    import java.beans.Statement;
    import java.beans.XMLEncoder;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    public class JCOption {
        private int x = 1;
        private static JCOption option = new JCOption();
        private JCOption() {}
        public static JCOption getOption() { return option; }
        public int getX() { return x; }
        public void setX(int x) { this.x = x; }
        public static void main(String args[]) throws IOException {
          JCOption opt = JCOption.getOption();
          opt.setX(10);
          ByteArrayOutputStream os = new ByteArrayOutputStream();
          XMLEncoder encoder = new XMLEncoder( os );
          encoder.setPersistenceDelegate( opt.getClass(), new JCOptionPersistenceDelegate() );
          encoder.writeObject(opt);
          encoder.close();
          System.out.println( os.toString() );
    class JCOptionPersistenceDelegate extends DefaultPersistenceDelegate {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            return new Expression(
                    oldInstance,
                    oldInstance.getClass(),
                    "getOption",
                    new Object[]{} );
        protected void initialize( Class<?> type, Object oldInstance, Object newInstance, Encoder out ) {
            super.initialize( type, oldInstance, newInstance, out );
            JCOption q = (JCOption)oldInstance;
            out.writeStatement( new Statement( oldInstance, "setX", new Object[] { q.getX() } ) );
    }   Output:
    <?xml version="1.0" encoding="UTF-8"?>
    <java version="1.5.0_06" class="java.beans.XMLDecoder">
    <object class="JCOption" property="option">
      <void property="x">
       <int>10</int>
      </void>
    </object>
    </java>

  • Serialize a value object that implements Comparator T

    Hi.
    I'm implementing a VO like this:
    public class RegionVO implements Serializable, Comparable<RegionVO>My problem is that i need that the class could be serialized completely.
    The VO will be transfered throught EJB's and by past experiences with EJB 2 projects (the actual project is developed with EJB 3) and running the project in clusters, the application crashes to use VO defined like that.
    I think that the problem is caused by implement Comparable too, this inteface isn't serializable and even if implement of Serializable interface, at least 1 method (compareTo(RegionVO o))not would serializable.
    My question is if that is true, how to solve to serialize the entire VO.
    Thanks.
    Edited by: terinlagos on Jul 24, 2008 2:48 PM

    terinlagos wrote:
    Well, the question was because if eventually could have the same problem when in the future the application run in a clusterized server. Actually in my pc has no problem.Well at least you are thinking that clustering will introduce problems you don't have currently.
    I suggest you start trying to cluster you application as early as possible, you undoubtedly will have allot of lessons to learn (I have never seen a cluster solution from an it-works-on-my-pc solution not run into unexpected problems)
    Note: you can run a "clustered" solution on a single PC just in multiple JVMs (which would be deployed to different machines in your final solution)
    You should make looking at this your top priority. IMHO.

  • Problem with NotSerializableException on class implementing Serializable

    Hi,
    Any idea as to why I get this exception, and what I can do to avoid it ?
    java.io.NotSerializableException: util.NumberStore$UserI have this, relatively simple, class
    class User implements Serializable
         private static long serialVersionUID = 1L;
         private String uid;
         private String nr;
         public User(){}
         public User( String uid, String nr ) {
              this.uid = uid;
              this.nr = nr;
         public String getUid()     {
              return uid;
         public String getNr() {
              return nr;
         public void setUid(String uid){
              this.uid = uid;
         public void setNr(String nr){
              this.nr = nr;
    }When loading and saving it, I use these two methods:
         private void saveLocalList()
              FileOutputStream f = null;
              try {
                   f = new FileOutputStream("./users.dat");
                   ObjectOutputStream out = new ObjectOutputStream(f);
                   for (User u: numbers)
                        out.writeObject(u);
                   f.close();
              } catch (IOException e) {
                   System.err.println("User info not saved:"+e.getLocalizedMessage());
                   if (f != null)
                        try {
                             f.close();
                        } catch (IOException e1) {
         private boolean loadLocalList()
              FileInputStream f = null;
              try {
                   f = new FileInputStream("./users.dat");
                   ObjectInputStream input = new ObjectInputStream(f);
                   numbers = new ArrayList<User>();
                   User u = (User) input.readObject();
                   while (u != null)
                        numbers.add(u);
                        u = (User) input.readObject();
                   f.close();
                   return true;
              } catch (FileNotFoundException e) {
                   return false;
              } catch (IOException e) {
                   e.printStackTrace();
                   if (f != null)
                        try {
                             f.close();
                        } catch (IOException e1) {
                             // ignore close errors
                   return false;
              } catch (ClassNotFoundException e) {
                   if (f != null)
                        try {
                             f.close();
                        } catch (IOException e1) {
                             // ignore close errors
                   return false;
         }Both the User class and the methods are found within the NumberStore class.

    The User class indeed does not contain any references at all to the NumberStore classIf 'User' is nested inside 'NumberStore' and it isn't static, User does indeed have a hidden reference to the outer class NumberStore. That's how the syntax 'NumberStore.this' works.
    I can say with absolute certainty that an object which was not marked as serializable was written to the users.dat file.Quite apart from the fact that the source code of ObjectOutputStream makes it utterly impossible, I don't see how you can possibly say that 'with absolute certainty'. For a start there's no information in the file to indicate what interfaces were and weren't implemented by the class of the serialized object at the time it was serialized.
    I'm not absolutely positive about whether or not it bombed out on this occassion, or when trying to re-read it next time aroundNotSerializableException is only thrown when writing, not when reading, so that answers that.
    Do you still have the file? I'd like to see exactly what was written. In any case a serialization file that copped any kind of IOException when being written should have been thrown away immediately, you're right about that.
    BTW your reading code is wrong. You shouldn't be testing for null, unless you are deliberately writing a null as a sentinel value. You should be catching EOFException.

  • Compile-time warning during javac of a Class that implements Comparable

    Hello All,
    I have defined a class as follows;
    public class CardTiles extends JButton implements Comparable{
    During normal compilation with javac, it tell me to use Xlint to compile and the warning it throws is below:
    CardTiles.java:4: warning: [serial] serializable class CardTiles has no definition of serialVersionUID
    public class CardTiles extends JButton implements Comparable{
    ^
    1 warning
    What does this warning mean?
    Many thanks!

    ejp wrote:
    you can choose to to differentiate between various versions of your CardTiles classThat's back to front. Serialization will always do that unless you stop it, which you can do via a fixed serialVersionUID. This tells Serialization that different versions of your class are compatible under serialization.I suppose I see it this way because I wouldn't have a serializable object without an ID. Without having an explicit ID the process isn't as transparent to me. It's the same sort of thing as using braces for statements when they're not necessary, e.g.
              if(check)
                   System.out.println("check is on");
              else
                   System.out.println("check is off");     versus     
              if(check) {
                   System.out.println("check is on");
              } else {
                   System.out.println("check is off");
              }

  • Example Servlets that use JAXM?

    OK, maybe I missed a chapter in the JWSDP tutorial but I'm trying to develop a servlet that uses JAXM to process a soap request, and I can't find any examples of how to do this. There are a number of client code examples, but nothing for the server side. There is no source code for the "ReceivingServlet.class", which I believe does what I am loooking for.
    BTW, I know that I can do it easily using JAX-RPC, but I specifically want to do it using JAXM.
    Any ideas or suggestions?
    Thanks,
    Frank

    Example Sending Servlet with out messaging provider
    /* The following program is a servlet, which when run in the browser, constructs a soap message
    and sends the soap message to receiving end, i.e ReceivingServlet in this case*/
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import javax.xml.soap.*;
    import javax.activation.*;
    import javax.naming.*;
    public class SendingServlet extends HttpServlet {
    String to = null;
    String data = null;
    ServletContext servletContext;
    // Connection to send messages.
    private SOAPConnection con;
    public void init(ServletConfig servletConfig) throws ServletException {
    super.init( servletConfig );
    servletContext = servletConfig.getServletContext();
    try {
         SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
    con = scf.createConnection();
    } catch(Exception e) {
              System.out.println("Error in init(): ");
    e.printStackTrace();
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException {
    String retval ="<html> <H4>";
    try {
    // Create a message factory.
    MessageFactory mf = MessageFactory.newInstance();
    // Create a message from the message factory.
    SOAPMessage msg = mf.createMessage();
    // Message creation takes care of creating the SOAPPart - a
    // required part of the message as per the SOAP 1.1
    // specification.
    SOAPPart sp = msg.getSOAPPart();
    // Retrieve the envelope from the soap part to start building
    // the soap message.
    SOAPEnvelope envelope = sp.getEnvelope();
    // Create a soap header from the envelope.
    SOAPHeader hdr = envelope.getHeader();
    // Create a soap body from the envelope.
    SOAPBody bdy = envelope.getBody();
    // Add a soap body element to the soap body
    SOAPBodyElement gltp
    = bdy.addBodyElement(envelope.createName("GetLastTradePrice",
    "ztrade",
    "http://wombat.ztrade.com"));
    gltp.addChildElement(envelope.createName("symbol","ztrade",
    "http://wombat.ztrade.com")).addTextNode("SUNW");
    URL urlEndpoint = new URL("http://localhost:8080/servlet/ReceivingServlet");
    retval += " Sent message (check \"sent.msg\") and ";
    FileOutputStream sentFile = new FileOutputStream("sent.msg");
    msg.writeTo(sentFile);
    sentFile.close();
    // Send the message to the provider using the connection.
    SOAPMessage reply = con.call(msg, urlEndpoint);
    if (reply != null) {
    FileOutputStream replyFile = new FileOutputStream("reply.msg");
    reply.writeTo(replyFile);
    replyFile.close();
    System.err.println("Reply logged in \"reply.msg\"");
    retval += " received reply (check \"reply.msg\"). </H4> </html>";
    } else {
    System.err.println("No reply");
    retval += " no reply was received. </H4> </html>";
    } catch(Throwable e) {
    e.printStackTrace();
    retval += " There was an error " +
    "in constructing or sending message. </H4> </html>"+ e.toString();
    try {
    OutputStream os = resp.getOutputStream();
    os.write(retval.getBytes());
    os.flush();
    os.close();
    } catch (IOException e) {
    e.printStackTrace();
    Example Receiving Servlet without messaging provider
    /* The following code is a servlet which receives the message sent by client servlet,i.e SendingServlet in this case,
    and constructs a response soap message and sends the response message back to the SendingServlet */
    import javax.xml.soap.*;
    import javax.xml.messaging.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.transform.*;
    import javax.naming.*;
    public class ReceivingServlet
    extends JAXMServlet
    implements ReqRespListener
    static MessageFactory fac = null;
    static {
    try {
    fac = MessageFactory.newInstance();
    } catch (Exception ex) {
    ex.printStackTrace();
    public void init(ServletConfig servletConfig) throws ServletException {
    super.init(servletConfig);
    // Not much there to do here.
    // This is the application code for handling the message.. Once the
    // message is received the application can retrieve the soap part, the
    // attachment part if there are any, or any other information from the
    // message.
    public SOAPMessage onMessage(SOAPMessage message) {
    try {
    message.writeTo(System.out);
    SOAPMessage msg = fac.createMessage();
    SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
    env.getBody()
    .addChildElement(env.createName("Response"))
    .addTextNode("This is a response");
    return msg;
    } catch(Exception e) {
    return null;
    /* How to compile: javac ReceivingServlet.java
    How to run: simply place the ReceivingServlet.class in WEB-INF/classes directory, and
    run "http://localhost:8080/servlet/SendingServlet" in the browser. the ReceivingServlet
    constructs a file reply.msg in the tomcat/bin directory */
    Hope these examples help you

  • Compiling a Servlet that uses JavaBean

    I have a servlet that will get data from a JavaBean which is created before in a jsp file. While I trying to compile the servlet I am getting this message:
    --------------------Configuration: JDK version 1.3 <Default>--------------------
    Command : "C:\jdk1.3\bin\javac.exe" -d "C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes" C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java
    Directory : C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\TasitKayitGirisi.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean = (SimpleBean) session.getAttribute
    ^
    ("simpleBean");
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean= (SimpleBean) session.getAttribute("simpleBean");
    ^
    2 errors
    Process completed.
    Where is the problem. SimpleBean is successfully being initializing in my jsp file. But I couldn't compile my servlet that will get data from that bean. Both my servlet and bean are in the same package. I am using JCreator to compile servlets. I think the problem is the compile string that JCreator uses. Can you help me. Thx in advance.

    Looks like an import Problem.
    The Compiler is not able to "see" the SimpleBean Class.
    Take care of the Classpath and your imports.
    Happy Coding. :-)

  • Transform a class that implements JPanel into a bean.

    I'd to create a bean, from a class that implements JPanel, that in fact is a custom component.
    How can I create a bean?
    I have absolutely no idea about beans.
    What can make beans for me?
    I know a lot about the theory of ejb, is this what I need?
    I'm quite confused, please make me see the light!!!!!
    Thanks.

    Hi Daniel!
    To answer your question short as possible:
    Java -Beans are reusable code - components,
    similar to VB Active -X components,
    which you can use when developing your own
    applications.
    Beans can have a graphic user interface, so you
    can use builder tools like JBuilder or Beanbox
    to show them graphically in a designer.
    You can modify them about their properties,
    mostly shown in a special property window of a
    builder tool.
    It's really not very hard to create your own beans,
    the only thing you have to do is to pack all the
    classes which make the bean into a jar file.
    Then you can import the bean with the builder
    and it will be shown.
    The jar manifest file needs to look like for example:
    Manifest-Version: 1.0
    Name: BeanClock.class
    Java-Bean: True
    All the properties are implemented by public property-get
    and property-set methods, in order to show them in the property window.
    Java is doing that by introspection.
    Hope, this makes it a little bit clearer for you!

  • Reflect the class that implements Runnable

    Hi,
    I am implementing the reflection of the class that implements Runnable. In order to start a new thread I am trying to invoke "start()" method ( which is obviously not defined my class ) and I therefore I am getting "java.lang.NoSuchMethodException".
    I am wondering is it possible at all to start a new thread on a reflected class?
    thanks in advance.
    {              Class refClass = Class.forName(className);
    String methodName = "start";
    Class[] types = new Class[1];
    types[0] = Class.forName("java.util.HashMap");
    Constructor cons = refClass.getConstructor(types);
    Object[] params = new Object[5];
    params[0] = new HashMap();
    Method libMethod = refClass.getMethod(methodName, null);
    libMethod.invoke(objType, null); }

    Well, if we knew what it meant to "start a thread on a class" we could probably figure out how to "start a thread on a reflected class". If we knew what a "reflected class" was, that is.
    In other words, it would help if you rephrased your question using standard terminology (and also explained why you want to do whatever it is you want to do).
    But let's guess for now: If you have an object which implements Runnable then you start a thread to run that object like this:
    Runnable r = // some object which implements Runnable
    new Thread(r).start();Not what you wanted? Go ahead and clarify then.

Maybe you are looking for

  • Connecting to Airport Express from a Router

    I have an Airport Express that works nicely with my 13"MacBook Pro. However, I still have my Dell PC, and a modem with only one ethernet out port. I assume I will need a router to use both the wired PC and to use my MacBook either wired or wireless w

  • TS3694 how come when i am restoring my iphone 3g is it coming up with error 1015

    how come when i am restoring my iphone 3g is it coming up with error 1015 just as it is verifirying the software??? help me please

  • Solid state hard drive for X100e

    Can one replace  the hard drive that comes with the x100e with a solid state drive?  If so how would one go about doing it? Is there a Thinkpad with a solid state hard drive about the same size as the x100e?  My only complaint about the x100e is the

  • Setting the proxy in the JRE

    Hello all, I was just wondering how I can set the proxy I use in the JRE. If possible how I can set the auto configuration script but failing that setting the proxy server and port number would be fine. Thanks

  • CHANGE OF PRINT PROGRAM IN SAPSCRIPTS

    CAN ANYBODY EXPLAIN HOW WE CAN CHANGE THE PRINT PROGRAM IN SAPSCRIPTS?