JavaDoc: inherit method comment from jdk classes?

My goal is to let custom classes inherit method comments from overridden methods of jdk classes. From the doctool documentation, I would assume that the way to go is to set the path to the jdk sources in the -sourcepath option. My problem is that this doesn't seem to work at all - looks like JavaDoc is simply not parsing the JDK source files at all.
The relevant (methinks :) part of the verbose output:
// these are the input options as created by ant run from eclipse under win2k
Executing 'D:\jdk\150_u6\bin\javadoc.exe' with arguments:
'-d'
'D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\dist\javadoc'
'-use'
'-splitindex'
'-verbose'
'-classpath'
'D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\lib\optional\MultipleGradientPaint.jar'
'-sourcepath'
'D:\jdk_doc\srcjdk1.5.0;D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\src\java'
'-link'
'file:D:/jdk_doc/jdk1.5b/docs/api'
'-source'
'1.5'
'org.jdesktop.swingx.table'
The ' characters around the executable and arguments are
not part of the command.
// following is the javadoc output
   [javadoc] [search path for source files: [D:\jdk_doc\srcjdk1.5.0,
D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\src\java]]
   [javadoc] [search path for class files:
[D:\jdk\150_u6\jre\lib\rt.jar, D:\jdk\150_u6\jre\lib\jsse.jar,
D:\jdk\150_u6\jre\lib\jce.jar, D:\jdk\150_u6\jre\lib\charsets.jar,
D:\jdk\150_u6\jre\lib\ext\dnsns.jar,
D:\jdk\150_u6\jre\lib\ext\junit.jar,
D:\jdk\150_u6\jre\lib\ext\localedata.jar,
D:\jdk\150_u6\jre\lib\ext\sunjce_provider.jar,
D:\jdk\150_u6\jre\lib\ext\sunpkcs11.jar,
D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\lib\optional\MultipleGradientPaint.jar]]
   [javadoc] Loading source files for package org.jdesktop.swingx.table...
   [javadoc] [parsing started
D:\JavaWorkspace\harvest\eclipse\javadesktop\jdnc-swingx\src\java\org\jdesktop\swingx\table\ColumnControlButton.java]
..snip..
   [javadoc] Constructing Javadoc information...
   [javadoc] [loading
D:\jdk\150_u6\jre\lib\rt.jar(java/awt/ComponentOrientation.class)]
   [javadoc] [loading
D:\jdk\150_u6\jre\lib\rt.jar(java/awt/Dimension.class)]
   [javadoc] [loading D:\jdk\150_u6\jre\lib\rt.jar(java/awt/Insets.class)]It doesn't seem to matter if javadoc is run from the commandline or through an ant task, the output is basically the same.
The loading from the rt.jar might be the problem, at least when comparing to a report about (maybe exactly the same) problem back in 2004
http://forum.java.sun.com/thread.jspa?forumID=41&threadID=536074
The posters stated that the -sourcepath didn't appear to work under win, while it did work under Solaris. When working, the [loading..] output contained the path to the sources instead of to the classes.
Any help, hint, thought, comment highly welcome!
Thanks in advance
Jeanette

Hi Doug,
thanks for your prompt reply!
My first question is what does the source tree look
below this directory:
-sourcepath 'D:\jdk_doc\srcjdk1.5.0
de]
To work, the the full path to, say, String.java,
would need to be:D:\jdk_docs\srcjdk1.5.0\java\lang\String.java
Because -sourcepath must point to the root of the
source tree. Is this what you have?
exactly, that's the case. In the meantime, I tried to put the sources somewhere relative to the classes (to exlude the possibility that the absolute path poses a problem)I want to document - to no avail.
>
Are you thinking that the class files are loaded from
rt.jar rather than the source .java files from the
source tree?
well, you are the expert to interpret the output :-) All I can be sure of is that this looks similar to output (for windows) in the old forum thread I mentioned and similar to a couple of bug reports. f.i.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5079630 (which is closed as a duplicate) or
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5105600 which is still open (but probably should be closed - it's a usage error to point to the zipped sources).
Hmm... thinking aloud: comparing my output to the output of the latter (it's quite analogous) it seems that in both cases the sources aren't found .. and the javadoctool falls back to get some search the missing information on the classpath. Maybe the question is: what could possibly go wrong (windows only) to not find the extracted sources (they are definitely there in my context ;-)?
You might try setting -bootclasspath to the empty
string, as describe here:
http://java.sun.com/j2se/javadoc/faq/#bootclasspath
I'll give it a try. BTW, this problem cropped up in the SwingLabs project, we are collectively scratching our heads in:
http://forums.java.net/jive/thread.jspa?threadID=18409
Thanks again!
Jeanette

Similar Messages

  • Stupid question - method missing from Socket class

    I'm sure I am just missing something here. I am using getInputStream from Socket class successfully - now want to add setKeepAlive method - I am getting an error:
    Method setKeepAlive(boolean) not found in class java.net.Socket.
    client.setKeepAlive(true);
    client is defined as a Socket
    Socket client = origSocket.accept();
    What am I screwing up here?? I know the classpath is correct since I am and have been using getInputStream with this socket for months!!
    Thanks for any responses!
    Beth

    javac is the compiler, not the run-time. That would have nothing to do with what the classpath is at run-time, which would either be the system environment variable CLASSPATH, or the -cp command-line parameter to java, not javac.

  • Method inheritence from abstract classes, and arguments

    I'm trying to do something a little weird. I'm writing a pretty complicated wrapper/adapter for two platforms, and I'd like to have an abstract method passed on to child classes, but with the type of the single argument specified by the child class. Is this possible?
    Example
    public abstract class AbstractParent {
    public abstract void foo([ambiguousType] arg);
    public class ChildOne extends AbstractParent {
    public void foo(TypeA arg) {
    //body
    public class ChildTwo extends AbstractParent {
    public void foo(TypeB arg) {
    //body
    }TypeA and TypeB have no common supertype beyond Object, and I'd rather not just do instanceof checks and throw errors. Does anyone know of a solution? Can I elaborate any better?

    Perhaps you could use generics?
        public abstract class AbstractParent<E> {
            public abstract void foo(E arg);
        public abstract class ChildOne extends AbstractParent<String> {
            public void foo(String arg) {
        public abstract class ChildTwo extends AbstractParent<Integer> {
            public void foo(Integer arg) {
        }

  • Compilation error while calling static method from another class

    Hi,
    I am new to Java Programming. I have written two class files Dummy1 and Dummy2.java in the same package Test.
    In Dummy1.java I have declared a static final variable and a static method as you can see it below.
    package Test;
    import java.io.*;
    public class Dummy1
    public static final int var1= 10;
    public static int varDisp(int var2)
    return(var1+var2);
    This is program is compiling fine.
    I have called the static method varDisp from the class Dummy2 and it is as follows
    package Test;
    import java.io.*;
    public class Dummy2
    public int var3=15;
    public int test=0;
    test+=Dummy1.varDisp(var3);
    and when i compile Dummy2.java, there is a compilation error <identifier > expected.
    Please help me in this program.

    public class Dummy2
    public int var3=15;
    public int test=0;
    test+=Dummy1.varDisp(var3);
    }test+=Dummy1.varDisplay(var3);
    must be in a method, it cannot just be out somewhere in the class!

  • SwingWorker, setting progress from other classes

    Hi.
    I'm interested in SwingWorker. It's very good tool for long running task in GUI applications. I want to use progress feature, but I don't want to code the logic of my long running task into its doInBackground() method. I have some class (which creates some other classes) which reflects my problem in reality. I want to use this classes for other problems too. So I would like to update progress from this class. Ideal case would be if the method setProgress() in SwingWorker was public, so I can create optional constructor with additional parameter for SwingWorker class (and its subclasses) and call method setProgress from this class. Does anybody know about some solution? I'm still thinking over, but I cannot find ideal solution.
    Thx for help

    Your configuration remains incomprehensible.
    From the other thread you mention a Listener which gets asynchronous messages. Are we talking about a context listener which handles JMS messages or the like? From these message you get a value and set it in a bean property.
    Then we get lost. You say you want to pass this value to a Servlet, presumably by passing a reference to the bean. But how is a particular incoming message associated with a transaction going through the Servlet? How do you imagine the bean reference being passed. A ContextListener doesn't see the web transactions. Should these bean values affect all subsequent transactions? Is there some kind of key in the web transaction that makes it look for data from a particular JMS message?
    In general the way for a ContextListener to pass data to a Servlet is by setting attributes in the ServletContext, but you really haven't made clear what you're trying to achieve.
    Try explaining in a more general way what your project is trying to achieve. You're concentrating on details which almost certainly don't contain the problem.

  • Clientgen Exception - java.lang.VerifyError:Cannot inherit from final class

    When i create a client jar from webservice ear the ant taks fails with compiler errors, such as:
    CreateProxy:
    [clientgen] Generating client jar for earname.ear(WebServiceName_WS) ...
    BUILD FAILED
    java.lang.VerifyError: Cannot inherit from final class
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:480)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:182)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:224)
    at weblogic.webservice.server.WebServiceFactory.loadNonArrayClass(WebServiceFactory.java:1318)
    at weblogic.webservice.server.WebServiceFactory.loadClass(WebServiceFactory.java:1293)
    at weblogic.webservice.server.WebServiceFactory.initTypeMaps(WebServiceFactory.java:384)
    at weblogic.webservice.server.WebServiceFactory.createFromMBean(WebServiceFactory.java:184)
    at weblogic.webservice.tools.build.internal.WSDLGenImpl.getWebServiceRuntime(WSDLGenImpl.java:240)
    at weblogic.webservice.tools.build.internal.WSDLGenImpl.run(WSDLGenImpl.java:135)
    at weblogic.webservice.tools.build.internal.ClientGenImpl.doClientGenFromEAR(ClientGenImpl.java:438)
    at weblogic.webservice.tools.build.internal.ClientGenImpl.run(ClientGenImpl.java:345)
    at weblogic.ant.taskdefs.webservices.clientgen.ClientGenTask.doClientGen(ClientGenTask.java:351)
    at weblogic.ant.taskdefs.webservices.clientgen.ClientGenTask.execute(ClientGenTask.java:208)
    at org.apache.tools.ant.Task.perform(Task.java:341)
    at org.apache.tools.ant.Target.execute(Target.java:309)
    at org.apache.tools.ant.Target.performTasks(Target.java:336)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
    at org.apache.tools.ant.Main.runBuild(Main.java:609)
    at org.apache.tools.ant.Main.start(Main.java:196)
    at org.apache.tools.ant.Main.main(Main.java:235)
    Total time: 25 seconds
    This is a ant command:
    <clientgen ear="${build}/earname.ear" onlyConvenienceMethod="true" warName="webservice.war" serviceName="WebServiceName_WS" packageName="my.package.webservices.generated" autotype="true" clientJar="${build.dist}/client/WebServiceName_WS.jar" overwrite="false" useServerTypes="true" keepGenerated="false" generateAsyncMethods="false" saveWsdl="true" j2me="false" useLowerCaseMethodNames="true" typePackageName="my.package.webservices.generated" usePortNameAsMethodName="false" />
    My webservice do not include any final class.
    I'm using WebLogic 8.1 SP4.Is there a solution for above problem?
    Thanks.
    Regards.

    Hi all,
    I m also facing quite similar problem.
    I have one sample JMX program, which i want to collect data from weblogic 9.2.
    but when i compile sample program on jdk 1.4 and run it on JDK 1.4 it throws following exception
    java.lang.VerifyError: class weblogic.utils.classloaders.GenericCl
    assLoader overrides final method .
    ERROR 02/13 09:54:03 Stderr 700100 at java.lang.ClassLoader.defineClass0(Native Method)
    ERROR 02/13 09:54:03 Stderr 700100 at java.lang.ClassLoader.defineClass(Unknown Source)
    ERROR 02/13 09:54:03 Stderr 700100 at java.security.SecureClassLoader.defineClass(Unknown Source)
    ERROR 02/13 09:54:03 Stderr 700100 at java.net.URLClassLoader.defineClass(Unknown Source)
    ERROR 02/13 09:54:03 Stderr 700100 at java.net.URLClassLoader.access$100(Unknown Source)
    ERROR 02/13 09:54:03 Stderr 700100 at java.net.URLClassLoader$1.run(Unknown Source)
    ERROR 02/13 09:54:03 Stderr 700100 at java.security.AccessController.doPrivileged(Native Method)
    ERROR 02/13 09:54:03 Stderr 700100 at java.net.URLClassLoader.findClass(Unknown Source)
    ERROR 02/13 09:54:03 Stderr 700100 at java.lang.ClassLoader.loadClass(Unknown Source)
    ERROR 02/13 09:54:03 Stderr 700100 at java.lang.ClassLoader.loadClass(Unknown Source)
    but sample program works fine if i run it on JDK 1.5..
    can someone tell me...wats reason?
    Thanks
    Nihil

  • Calling a method from abstarct class

    Hi Experts,
    Am working on ABAP Objects.
    I have created an Abstract class - with method m1.
    I have implemented m1.
    As we can not instantiate an abstract class, i tried to call the method m1 directly with class name.
    But it it giving error.
    Please find the code below.
    CLASS c1 DEFINITION ABSTRACT.
      PUBLIC SECTION.
        DATA: v1 TYPE i.
        METHODS: m1.
    ENDCLASS.                    "c1 DEFINITION
    CLASS c1 IMPLEMENTATION.
      METHOD m1.
        WRITE: 'You called method m1 in class c1'.
      ENDMETHOD. "m1
    ENDCLASS.                    "c1 IMPLEMENTATION
    CALL METHOD c1=>m1.
    Please tell me what is wrong and how to solve this problem.
    Thanks in Advance.

    Micky is right, abstract means not to be instantiated. It is just a "template" which you can use for all subsequent classes. I.e you have general abstract class vehicle . For all vehicles you will have the same attributes like speed , engine type ,  strearing , gears etc and methods like start , move etc.
    In all subsequent classes (which inherit from vehicle) you will have more specific attributes for each. But all of these classes have some common things (like the ones mentioned above), so they use abstract class to define these things for all of them.
    Moreover there is no sense in creating instance (real object) of class vehicle . What kind of physical object would vehicle be? there is no such object in real world, right? For this we need to be more precise, so we create classes which use this "plan" for real vehicles. So the abstract class here is only to have this common properties and behaviour defined in one place for all objects which will have these. Abstract object however cannot be created per se. You can only create objects which are lower in hierarchy (which are specific like car , ship, bike etc).
    Hope this claryfies what we need abstract classes for.
    Regards
    Marcin

  • Calling a class's method from another class

    Hi, i would like to know if it's possible to call a Class's method and get it's return from another Class. This first Class doesn't extend the second. I've got a Choice on this first class and depending on what is selected, i want to draw a image on the second class witch is a Panel extended. I put the control "if" on the paint() method of the second class witch is called from the first by the repaint() (first_class.repaint()) on itemStateChanged(). Thankx 4 your help. I'm stuck with this.This program is for my postgraduation final project and i'm very late....

    import java.awt.*;
    import java.sql.*;
    * This type was generated by a SmartGuide.
    class Test extends Frame {
         private java.awt.Panel ivjComboPane = null;
         private java.awt.Panel ivjContentsPane = null;
         IvjEventHandler ivjEventHandler = new IvjEventHandler();
         private Combobox ivjCombobox1 = null;
    class IvjEventHandler implements java.awt.event.WindowListener {
              public void windowActivated(java.awt.event.WindowEvent e) {};
              public void windowClosed(java.awt.event.WindowEvent e) {};
              public void windowClosing(java.awt.event.WindowEvent e) {
                   if (e.getSource() == Test.this)
                        connEtoC1(e);
              public void windowDeactivated(java.awt.event.WindowEvent e) {};
              public void windowDeiconified(java.awt.event.WindowEvent e) {};
              public void windowIconified(java.awt.event.WindowEvent e) {};
              public void windowOpened(java.awt.event.WindowEvent e) {};
         private Panel ivjPanel1 = null;
    * Combo constructor comment.
    public Test() {
         super();
         initialize();
    * Combo constructor comment.
    * @param title java.lang.String
    public Test(String title) {
         super(title);
    * Insert the method's description here.
    * Creation date: (11/16/2001 7:48:51 PM)
    * @param s java.lang.String
    public void conexao(String s) {
         try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
              String url = "jdbc:oracle:thin:system/[email protected]:1521:puc";
              Connection db = DriverManager.getConnection(url);
              //String sql_str = "SELECT * FROM referencia";
              Statement sq_stmt = db.createStatement();
              ResultSet rs = sq_stmt.executeQuery(s);
              ivjCombobox1.addItem("");
              while (rs.next()) {
                   String dt = rs.getString(1);
                   ivjCombobox1.addItem(dt);
              db.close();
         } catch (SQLException e) {
              System.out.println("Erro sql" + e);
         } catch (ClassNotFoundException cnf) {
    * connEtoC1: (Combo.window.windowClosing(java.awt.event.WindowEvent) --> Combo.dispose()V)
    * @param arg1 java.awt.event.WindowEvent
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void connEtoC1(java.awt.event.WindowEvent arg1) {
         try {
              // user code begin {1}
              // user code end
              this.dispose();
              // user code begin {2}
              // user code end
         } catch (java.lang.Throwable ivjExc) {
              // user code begin {3}
              // user code end
              handleException(ivjExc);
    * Return the Combobox1 property value.
    * @return Combobox
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private Combobox getCombobox1() {
         if (ivjCombobox1 == null) {
              try {
                   ivjCombobox1 = new Combobox();
                   ivjCombobox1.setName("Combobox1");
                   ivjCombobox1.setLocation(30, 30);
                   // user code begin {1}
                   this.conexao("select * from referencia");
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjCombobox1;
    * Return the ComboPane property value.
    * @return java.awt.Panel
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private java.awt.Panel getComboPane() {
         if (ivjComboPane == null) {
              try {
                   ivjComboPane = new java.awt.Panel();
                   ivjComboPane.setName("ComboPane");
                   ivjComboPane.setLayout(null);
                   getComboPane().add(getCombobox1(), getCombobox1().getName());
                   getComboPane().add(getPanel1(), getPanel1().getName());
                   // user code begin {1}
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjComboPane;
    * Return the ContentsPane property value.
    * @return java.awt.Panel
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private java.awt.Panel getContentsPane() {
         if (ivjContentsPane == null) {
              try {
                   ivjContentsPane = new java.awt.Panel();
                   ivjContentsPane.setName("ContentsPane");
                   ivjContentsPane.setLayout(new java.awt.BorderLayout());
                   getContentsPane().add(getComboPane(), "Center");
                   // user code begin {1}
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjContentsPane;
    * Return the Panel1 property value.
    * @return Panel
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private Panel getPanel1() {
         if (ivjPanel1 == null) {
              try {
                   ivjPanel1 = new Panel();
                   ivjPanel1.setName("Panel1");
                   ivjPanel1.setBackground(java.awt.SystemColor.scrollbar);
                   ivjPanel1.setBounds(24, 118, 244, 154);
                   // user code begin {1}
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjPanel1;
    * Called whenever the part throws an exception.
    * @param exception java.lang.Throwable
    private void handleException(java.lang.Throwable exception) {
         /* Uncomment the following lines to print uncaught exceptions to stdout */
         // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
         // exception.printStackTrace(System.out);
    * Initializes connections
    * @exception java.lang.Exception The exception description.
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initConnections() throws java.lang.Exception {
         // user code begin {1}
         // user code end
         this.addWindowListener(ivjEventHandler);
    * Initialize the class.
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initialize() {
         try {
              // user code begin {1}
              // user code end
              setName("Combo");
              setLayout(new java.awt.BorderLayout());
              setSize(460, 300);
              setTitle("Combo");
              add(getContentsPane(), "Center");
              initConnections();
         } catch (java.lang.Throwable ivjExc) {
              handleException(ivjExc);
         // user code begin {2}
         // user code end
    * Insert the method's description here.
    * Creation date: (11/17/2001 2:02:58 PM)
    * @return java.lang.String
    public String readCombo() {
         String dado = ivjCombobox1.getSelectedItem();
         return dado;
    * Starts the application.
    * @param args an array of command-line arguments
    public static void main(java.lang.String[] args) {
         try {
              /* Create the frame */
              Test aTest = new Test();
              /* Add a windowListener for the windowClosedEvent */
              aTest.addWindowListener(new java.awt.event.WindowAdapter() {
                   public void windowClosed(java.awt.event.WindowEvent e) {
                        System.exit(0);
              aTest.setVisible(true);
         } catch (Throwable exception) {
              System.err.println("Exception occurred in main() of Test");
              exception.printStackTrace(System.out);
    * Insert the type's description here.
    * Creation date: (11/17/2001 1:59:15 PM)
    * @author:
    class Combobox extends java.awt.Choice {
         public java.lang.String dado;
    * Combobox constructor comment.
    public Combobox() {
         super();
         initialize();
    * Called whenever the part throws an exception.
    * @param exception java.lang.Throwable
    private void handleException(java.lang.Throwable exception) {
         /* Uncomment the following lines to print uncaught exceptions to stdout */
         // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
         // exception.printStackTrace(System.out);
    * Initialize the class.
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initialize() {
         try {
              // user code begin {1}
              // user code end
              setName("Combobox");
              setSize(133, 23);
         } catch (java.lang.Throwable ivjExc) {
              handleException(ivjExc);
         // user code begin {2}
         // user code end
    * main entrypoint - starts the part when it is run as an application
    * @param args java.lang.String[]
    public static void main(java.lang.String[] args) {
         try {
              java.awt.Frame frame = new java.awt.Frame();
              Combobox aCombobox;
              aCombobox = new Combobox();
              frame.add("Center", aCombobox);
              frame.setSize(aCombobox.getSize());
              frame.addWindowListener(new java.awt.event.WindowAdapter() {
                   public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
              frame.setVisible(true);
         } catch (Throwable exception) {
              System.err.println("Exception occurred in main() of Combobox");
              exception.printStackTrace(System.out);
    * Insert the type's description here.
    * Creation date: (11/17/2001 2:16:11 PM)
    * @author:
    class Panel extends java.awt.Panel {
    * Panel constructor comment.
    public Panel() {
         super();
         initialize();
    * Panel constructor comment.
    * @param layout java.awt.LayoutManager
    public Panel(java.awt.LayoutManager layout) {
         super(layout);
    * Called whenever the part throws an exception.
    * @param exception java.lang.Throwable
    private void handleException(java.lang.Throwable exception) {
         /* Uncomment the following lines to print uncaught exceptions to stdout */
         // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
         // exception.printStackTrace(System.out);
    * Initialize the class.
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initialize() {
         try {
              // user code begin {1}
              // user code end
              setName("Panel");
              setLayout(null);
              setSize(260, 127);
         } catch (java.lang.Throwable ivjExc) {
              handleException(ivjExc);
         // user code begin {2}
         // user code end
    * main entrypoint - starts the part when it is run as an application
    * @param args java.lang.String[]
    public static void main(java.lang.String[] args) {
         try {
              java.awt.Frame frame = new java.awt.Frame();
              Panel aPanel;
              aPanel = new Panel();
              frame.add("Center", aPanel);
              frame.setSize(aPanel.getSize());
              frame.addWindowListener(new java.awt.event.WindowAdapter() {
                   public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
              frame.setVisible(true);
         } catch (Throwable exception) {
              System.err.println("Exception occurred in main() of java.awt.Panel");
              exception.printStackTrace(System.out);
    * Insert the method's description here.
    * Creation date: (11/17/2001 2:18:36 PM)
    public void paint(Graphics g) {
    /* Here's the error:
    C:\Test.java:389: non-static method readCombo() cannot be referenced from a static context
         System.out.println(Test.lerCombo());*/
         System.out.println(Test.readCombo());

  • Java.lang.VerifyError: Cannot inherit from final class

    Hi i am trying to call a crystal report from jsp but i am getting this error
    error:-
    org.apache.jasper.JasperException: Cannot inherit from final class
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause
    javax.servlet.ServletException: Cannot inherit from final class
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
         org.apache.jsp._1_jsp._jspService(_1_jsp.java:95)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause
    java.lang.VerifyError: Cannot inherit from final class
         java.lang.ClassLoader.defineClass1(Native Method)
         java.lang.ClassLoader.defineClass(Unknown Source)
         java.security.SecureClassLoader.defineClass(Unknown Source)
         org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1853)
         org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:875)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1330)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
         java.lang.ClassLoader.loadClassInternal(Unknown Source)
         com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)
         org.apache.jsp._1_jsp._jspService(_1_jsp.java:64)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    my jsp is
    <%@ page import="com.crystaldecisions.report.web.viewer.*" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"  %>
    <%@ page import="com.crystaldecisions.reports.sdk.ReportClientDocument" %>
    <%
        Object reportSource = session.getAttribute("reportSource");
        if (reportSource == null)
           String report = "report.rpt";
           ReportClientDocument reportClientDoc = new ReportClientDocument();
           reportClientDoc.open( "report.rpt", 0);
           reportSource = reportClientDoc.getReportSource();
           session.setAttribute("reportSource", reportSource);
        CrystalReportViewer viewer = new CrystalReportViewer();
        viewer.setReportSource(reportSource);
           viewer.setEnableLogonPrompt(false); 
        viewer.setOwnPage(true);
        viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
    %>
    and in my WEB-INF/lib i included jar files namely
    Concurrent.jar,CrystalCharting.jar,CrystalCommon.jar,CrystalContentModels.jar,CrystalExporters.jar,CrystalExportingBase.jar,CrystalFormulas.jar,CrystalQueryEngine.jar,CrystalReportEngine.jar,CrystalReportingCommon.jar,icu4j.jar,jrcerom.jar,keycodeDecoder.jar,log4j.jar,MetafileRenderer.jar,rasapp.jar,rascore.jar,rpoifs.jar,serialization.jar,URIUtil.jar,xml-apis.jar,xbean.jar,xercesImpl.jar,webreporting.jar,webreporting-jsf.jar
    please help me

    You can't inherit from a final class. 
    So - are you trying to inherit from a final class?
    Sincerely,
    Ted Ueda

  • Is it possible to call methods from another class from within an abstract c

    Is it possible to call methods from another class from within an abstract class ?

    I found an example in teh JDK 131 JFC that may help you. I t is using swing interface and JTable
    If you can not use Swing, then you may want to do digging or try out with the idea presented here in example 3
    Notice that one should refine the abstract table model and you may want to create a method for something like
    public Object getValuesAtRow(int row) { return data[row;}
    to give the desired row and leave the method for
    getValuesAt alone for getting valued of particaular row and column.
    So Once you got the seelcted row index, idxSelctd, from your table
    you can get the row or set the row in your table model
    public TableExample3() {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});
    // Take the dummy data from SwingSet.
    final String[] names = {"First Name", "Last Name", "Favorite Color",
    "Favorite Number", "Vegetarian"};
    final Object[][] data = {
         {"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)},
         {"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)},
         {"Alan", "Chung", "Green", new Integer(838), new Boolean(false)},
         {"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)},
         {"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)},
         {"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)},
         {"James", "Gosling", "Pink", new Integer(21), new Boolean(false)},
         {"David", "Karlton", "Red", new Integer(1), new Boolean(false)},
         {"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)},
         {"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)},
         {"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)},
         {"Dave", "Moore", "Green", new Integer(88), new Boolean(false)},
         {"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)},
         {"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)},
         {"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)},
         {"Chester", "Rose", "Black", new Integer(0), new Boolean(false)},
         {"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)},
         {"Georges", "Saab", "Red", new Integer(4), new Boolean(false)},
         {"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)},
         {"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)},
         {"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)}
    // Create a model of the data.
    TableModel dataModel = new AbstractTableModel() {
    // These methods always need to be implemented.
    public int getColumnCount() { return names.length; }
    public int getRowCount() { return data.length;}
    public Object getValueAt(int row, int col) {return data[row][col];}
    // The default implementations of these methods in
    // AbstractTableModel would work, but we can refine them.
    public String getColumnName(int column) {return names[column];}
    public Class getColumnClass(int col) {return getValueAt(0,col).getClass();}
    public boolean isCellEditable(int row, int col) {return (col==4);}
    public void setValueAt(Object aValue, int row, int column) {
    data[row][column] = aValue;
    };

  • How to call a static method of a class from another class?

    Hello,
    I have two classes in a package. The first one
    package my package;
    public class class1
    protected static ImageIcon createIcon(String path)
    The second one
    package my package;
    public class class2
    private ImageIcon image1;
    image1 = class1.createIcon("/mypath");
    This does not work since class2 cannot load the appropriate image. Where do I have to define the ImageIcon variables in class one or two and do they have to be static variables?
    Thanks in advance
    Christos

    If the two classes are in the same package, that will work, in fact. A trivial example:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    // Note: Member of the same package
    package foo;
    public class Foo2 {
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }However, if they are in different packages that won't work - the protected keyword guarantees that only classes derived from the class with the protected method can access it: Therefore this will not work:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    package foo.bar;
    public class Foo2{
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }But this will:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    package foo.bar;
    public class Foo2 extends foo.Foo1 {
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }I think you should read up a bit more about packages and inheritance, because you're going to have a lot of trouble without a good understanding of both. Try simple examples first, like the above, and if you hit problems try to produce a simple test case to help you understand the problem rather than trying to debug your whole application.
    Dave.

  • Moving a method from one class to another issues

    Hi, im new. Let me explain what i am trying to achieve. I am basically trying to move a method from one class to another in order to refactor the code. However every time i do, the program stops working and i am struggling. I have literally tried 30 times these last two days. Can some one help please? If shown once i should be ok, i pick up quickly.
    Help would seriously be appreciated.
    Class trying to move from, given that this is an extraction:
    class GACanvas extends Panel implements ActionListener, Runnable {
    private WorldMenuItems speedMenuItems, designMenuItemsPlantGrowth, designMenuItemsPlantCount;
         private WorldMenuItems designMenuItemsPlantEaten, designMenuItemsApproximatePopulation;
         private WorldMenuItems designMenuItemsEatersBorn,designMenuItemsMutationProbability;
         private WorldMenuItems designMenuItemsCrossoverProbability;
    MenuBar getMenuBar() {
              menuBar = new MenuBar();
              addControlItemsToMenuBar();
              addSpeedItemsToMenuBar();
              addWorldDesignItemsToMenuBar();
              return menuBar;
    This is the method i am trying to move (below)
    public void itemsInsideWorldDesignMenu() {
              designMenuItemsPlantGrowth = new WorldMenuItems("Plants Grow",
                        new String[] { "In Rows", "In Clumps", "At Random",
                                  "Along the Bottom", "Along the Edges" }, 1);
              designMenuItemsPlantCount = new WorldMenuItems("Number Of Plants",
                        new String[] { "50", "100", "150", "250", "500" }, 3);
              designMenuItemsPlantEaten = new WorldMenuItems("When a Plant is Eaten",
                        new String[] { "It grows back somewhere",
                                  "It grows back nearby", "It's Gone" }, 0);
              designMenuItemsApproximatePopulation = new WorldMenuItems(
                        "Approximate Population", new String[] { "10", "20", "25",
                                  "30", "40", "50", "75", "100" }, 2);
              designMenuItemsEatersBorn = new WorldMenuItems("Eaters are Born",
                        new String[] { "At the Center", "In a Corner",
                                  "At Random Location", "At Parent's Location" }, 2);
              designMenuItemsMutationProbability = new WorldMenuItems(
                        "Mutation Probability", new String[] { "Zero", "0.25%", "0.5%",
                                  "1%", "2%", "3%", "5%", "10%" }, 3);
              designMenuItemsCrossoverProbability = new WorldMenuItems(
                        "Crossover Probability", new String[] { "Zero", "10%", "25%",
                                  "50%", "75%", "100%" }, 4);
    Class Trying to move to:
    class WorldMenuItems extends Menu implements ItemListener {
       private CheckboxMenuItem[] items;
       private int selectedIndex = -1;
       WorldMenuItems(String menuName, String[] itemNames) {
          this(menuName, itemNames, -1);
       WorldMenuItems(String menuName, String[] itemNames, int selected) {
          super(menuName);
          items = new CheckboxMenuItem[itemNames.length];
          for (int i = 0; i < itemNames.length; i++) {
             items[i] = new CheckboxMenuItem(itemNames);
    add(items[i]);
    items[i].addItemListener(this);
    selectedIndex = selected;
    if (selectedIndex < 0 || selectedIndex >= items.length)
    selectedIndex = 1;
    items[selectedIndex].setState(true);
         public int getSelectedIndex() {
              return selectedIndex;
    public void itemStateChanged(ItemEvent evt) {  // This works on other systems
    CheckboxMenuItem newSelection = (CheckboxMenuItem)evt.getSource();
    for (int i = 0; i < items.length; i++) {
    if (newSelection == items[i]) {
    items[selectedIndex].setState(false);
    selectedIndex = i;
    newSelection.setState(true);
    return;

    Ok i've done this. I am getting an error on the line specified. Can someone help me out and tell me what i need to do?
    GACanvas
    //IM GETTING AN ERROR ON THIS LINE UNDER NAME, SAYING IT IS NOT VISIBLE
    WorldMenuItems worldmenuitems = new WorldMenuItems(name, null);
    public MenuBar getMenuBar() {
              menuBar = new MenuBar();
              addControlItemsToMenuBar();
              addSpeedItemsToMenuBar();
              worldmenuitems.addWorldDesignItemsToMenuBar();
              return menuBar;
    class WorldMenuItems extends Menu implements ItemListener {
         private WorldMenuItems speedMenuItems, designMenuItemsPlantGrowth, designMenuItemsPlantCount;
         private WorldMenuItems designMenuItemsPlantEaten, designMenuItemsApproximatePopulation;
         private WorldMenuItems designMenuItemsEatersBorn,designMenuItemsMutationProbability;
         private WorldMenuItems designMenuItemsCrossoverProbability;
         GACanvas gacanvas = new GACanvas(null);
       private CheckboxMenuItem[] items;
       private int selectedIndex = -1;
       WorldMenuItems(String menuName, String[] itemNames) {
          this(menuName, itemNames, -1);
       WorldMenuItems(String menuName, String[] itemNames, int selected) {
          super(menuName);
          items = new CheckboxMenuItem[itemNames.length];
          for (int i = 0; i < itemNames.length; i++) {
             items[i] = new CheckboxMenuItem(itemNames);
    add(items[i]);
    items[i].addItemListener(this);
    selectedIndex = selected;
    if (selectedIndex < 0 || selectedIndex >= items.length)
    selectedIndex = 1;
    items[selectedIndex].setState(true);
         public int getSelectedIndex() {
              return selectedIndex;
    public void itemStateChanged(ItemEvent evt) {  // This works on other systems
    CheckboxMenuItem newSelection = (CheckboxMenuItem)evt.getSource();
    for (int i = 0; i < items.length; i++) {
    if (newSelection == items[i]) {
    items[selectedIndex].setState(false);
    selectedIndex = i;
    newSelection.setState(true);
    return;
    public void itemsInsideWorldDesignMenu() {
         designMenuItemsPlantGrowth = new WorldMenuItems("Plants Grow",
                   new String[] { "In Rows", "In Clumps", "At Random",
                             "Along the Bottom", "Along the Edges" }, 1);
         designMenuItemsPlantCount = new WorldMenuItems("Number Of Plants",
                   new String[] { "50", "100", "150", "250", "500" }, 3);
         designMenuItemsPlantEaten = new WorldMenuItems("When a Plant is Eaten",
                   new String[] { "It grows back somewhere",
                             "It grows back nearby", "It's Gone" }, 0);
         designMenuItemsApproximatePopulation = new WorldMenuItems(
                   "Approximate Population", new String[] { "10", "20", "25",
                             "30", "40", "50", "75", "100" }, 2);
         designMenuItemsEatersBorn = new WorldMenuItems("Eaters are Born",
                   new String[] { "At the Center", "In a Corner",
                             "At Random Location", "At Parent's Location" }, 2);
         designMenuItemsMutationProbability = new WorldMenuItems(
                   "Mutation Probability", new String[] { "Zero", "0.25%", "0.5%",
                             "1%", "2%", "3%", "5%", "10%" }, 3);
         designMenuItemsCrossoverProbability = new WorldMenuItems(
                   "Crossover Probability", new String[] { "Zero", "10%", "25%",
                             "50%", "75%", "100%" }, 4);
    public void addWorldDesignItemsToMenuBar() {
         gacanvas = new GACanvas(null);
         itemsInsideWorldDesignMenu();
         Menu designMenuItems = new Menu("WorldDesign");
         designMenuItems.add(designMenuItemsPlantGrowth);
         designMenuItems.add(designMenuItemsPlantCount);
         designMenuItems.add(designMenuItemsPlantEaten);
         designMenuItems.add(designMenuItemsApproximatePopulation);
         designMenuItems.add(designMenuItemsEatersBorn);
         designMenuItems.add(designMenuItemsMutationProbability);
         designMenuItems.add(designMenuItemsCrossoverProbability);
         gacanvas.menuBar.add(designMenuItems);

  • Calling a method from another class... that requires variables?

    I'm calling a method from another class to change the date (its a date object) in another class.
    I keep getting the error 'setDate(int,int,int) in Date cannot be applied to ()'
    My code is:
    public int changeDate()
         cycleDate.setDate();
    }I'm guessing I need to pass 3 parameters (day, month, year), but I'm not sure how! I have tried, but then I get errors such as ')' expected?
    Any ideas! :D

    f1d wrote:
    I'm calling a method from another class to change the date (its a date object) in another class.
    I keep getting the error 'setDate(int,int,int) in Date cannot be applied to ()'
    My code is:
    public int changeDate()
    cycleDate.setDate();
    }I'm guessing I need to pass 3 parameters (day, month, year), seems that way from the error you posted
    but I'm not sure how!
    setDate(16, 6, 2008);
    I have tried, but then I get errors such as ')' expected?
    Any ideas! :Dyou need to post your code if you're getting specific errors like that.
    but typically ')' expected means just that, you have too many or not enough parenthesis (or in the wrong place, etc.)
    i.e. syntax error

  • Calling a method from another class while in a seperate class

    Hello
    I am currently TRYING to proramme a simple alarm clock program, The way it has had to be set out is that there are two classes one is called ClockDisplay which is just the clock and the one i have had to create is called AlarmDisplay
    I am trying to write code so that when the String alarmdisplayString(this is located in the alarm class which i am typing this code) is the same as String displayString the system will print out something like "Beep wake up" So far i have this code but i cannot figue out what to put to reference the method from the ClockDisplay class while codingi n the AlarmDisplay class
    if(alarmdisplayString = DONT KNOW WHAT TO PUT HERE) {
    system.out.println ("DING WAKE UP");
    Any help would be great!
    Thanks

    That makes sense i have put in this code
    private void Alarmtone()
    ClockDisplay displayString = new ClockDisplay();
    if (alarmdisplayString == ClockDisplay.displayString){
    system.out.println ("DING WAKE UP");
    displayString is the method in the ClockDisplay Class
    alarmdisplayString is the method in the AlarmDisplay class
    I get the error message "non-static variable displayString cannot be referenced from a static context
    Thanks for the help so far :D

  • Calling a backend bean method from another class

    Hi,
    I'm new in JSF & in this forum so maybe this question is already aswer.
    My problem is that I made a jsf component to deal with a tree menu. The resources in the leaf nodes of the menu are stored in a action calling pattern (i.e.: #{myBean.myMethod}) & I'm looking for a way to bind & execute the call from the class of the component that treats the events.
    I suppose that I need to get the current instance of the context, get the bean location, instance it & invoke the method, but I don�t know how.
    I have another more question, may this resource invocation have any kind of undesirable side effect, I meen, it's me & not the faces context who is making the call so I'm not sure if that the best way to solve the problem.
    Thanks in advance.

    If I understand what you're saying correctly... you have a component which enables a user to select an action (leaf nodes in the menu). You are processing this selection in your component and now have a EL expression that looks like #{myBean.myMethod}. You now need to know how to use that expression from Java code to invoke it. Is that correct?
    If so:
    FacesContext ctx = FacesContext.getCurrentInstance();
    MethodBinding mb = ctx.getApplication().createMethodBinding("#{myBean.myMethod}", new Class[] {});
    mb.invoke(ctx, null);
    This should do what you want. If you need to pass arguments to the method, you can do that as well... you need to pass in the types via the Class[], and the objects via an Object[] instead of null.
    Note also that the API's for EL change for JSF 1.2 to the standard EL API's, however, the older API's (above) are still supported.
    Ken Paulsen
    https://jsftemplating.dev.java.net

Maybe you are looking for

  • Save As Image fails with PDF files

    Using Acrobat X Pro, version 10.1.7. After the most recent update, I can no longer crop a PDF file and save it in any image format. The options are there, but when I select File > Save As > Image > PNG (or JPG or any other image format) and enter the

  • Not getting email notifications for some instances

    Hi, Recently we moved our production instance to new server. Now databse agent uses virtual name and host agent uses physical name. After move Instance generates alerts in OEM but doesn't send email notification. Rest of the instances sends email ale

  • Debugging a Web service with JDeveloper 902

    JDeveloper (902) is the major development tool in my project, and till now we used RMI for remote function calls. We are considering to use SAOP instead. I've installed JWSDP and I manage to run SOAP based Web service with Tomcat. However, after depl

  • Large Images aren't display after report is saved

    I created a new crystal report, in the crystal reports application, and inserted a 8.5" X 11" 600 DPI image and saved the report.  I closed the report and opened it again and the image control exists but the image was missing. I tried TIF, BMP & JPG

  • Integrating Flash CS3 with XML

    Hello, I done a tutorial from learnflash.com on Integrating Flash CS3 with XML, and I can't figure out why when the file is published the scrollbar component doesn't work.