11 Replies Latest reply on Nov 13, 2001 7:14 PM by 807592

    Please I'm new to java.Can anyone help me?

    807592
      Whenever i try to execute a java program
      at the command line I get the error message " .classfiles not found.I checked in my directory and the classfiles are there.I made sure I'm in the directory when i'm trying to execute the .class files.
      when i use EditPlus i get the error message of

      ---------- java ----------
      java.lang.NoClassDefFoundError: Comparison
      Exception in thread "main" Normal Termination
      Output completed (1 sec consumed).

      Can anyone tell what i'm doing wrong or what i'm not doing?
        • 1. Re: Please I'm new to java.Can anyone help me?
          807592
          Kind of sounds like you are trying to run a class that either has a badly defined main method or none at all.
          • 2. Re: Please I'm new to java.Can anyone help me?
            807592
            Post your main() method please so somebody may help you.
            • 3. Re: Please I'm new to java.Can anyone help me?
              800560
              I don't know anything about EditPlus, but NoClassDefFound error is usually a classpath problem. If your Comparison.class file is in a directory named c:\myjava then java needs to know how to find it. Some editors manage this for you, some don't. If you are using EditPlus to try to run your applications, then check the documentation for classpath settings. (And java class names are case sensitive, so if you defined your class as comparison, java can't find Comparison.)
              • 4. Re: Please I'm new to java.Can anyone help me?
                807592
                make sure your program is correct firstly, then check your classpath. if both are correct, you may try:
                java -cp . yourapplication
                • 5. Re: Please I'm new to java.Can anyone help me?
                  807592
                  Ok here is the program I'm trying to execute:
                  import javax.swing.JOptionPane;
                  public class Comparison
                  {
                       public static void main(String[] args)
                       {
                            String firstNumber, secondNumber, result;
                            int number1,number2;
                            double sum, product, quotient, difference;
                            firstNumber = JOptionPane.showInputDialog("Please enter the first integer: " );
                            secondNumber = JOptionPane.showInputDialog("Please enter the second integer: " );



                            number1 = Integer.parseInt(firstNumber);
                            number2 = Integer.parseInt(secondNumber);
                            sum = number1 + number2;
                            quotient = number1/number2;
                            product = number1 * number2;
                            difference = number1 - number2;

                            
                            JOptionPane.showMessageDialog(null,"The sum of number1 and number2 is: " sum "\n"+"The product of number1 and number2 is: " + product +"\n"+"The difference of number1 and number2 is : " + difference +"\n"+ "The quotient of number1 and number2 is: " +quotient, "Here are the result" ,JOptionPane.INFORMATION_MESSAGE);
                                 
                            
                            System.exit(0);

                       
                       }
                  }



                  and this is my CLASSPATH :
                  c:\javax\;c:\unzipped\servlet-2_3-fcs-classfiles\;c:\java;c:\jdk1.3.1_01\server.jar;c:\Apache Tomcat\lib\servlet.jar
                  • 6. Re: Please I'm new to java.Can anyone help me?
                    807592
                    compile at the command prompt with
                    javac -classpath . filename.java

                    and also edit autoexec.bat .
                    In autoexec.bat set path=set PATH=%PATH%;c:\jdk1.3.0_02\bin\;

                    and add to your classpath . the current directory.
                    Hope this helps you.
                    Ehsan.

                    • 7. Re: Please I'm new to java.Can anyone help me?
                      807592
                      Definately your classpath. Your code seems fine to me. I don't know what you do or don't need in your classpath but changing it to the following will allow you to run your code.

                      c:\javax\;c:\unzipped\servlet-2_3-fcs-classfiles\;c:\java;c:\jdk1.3.1_01\server.jar;c:\Apache Tomcat\lib\servlet.jar;.

                      Notice that I have added ";." to the end. This means that your classpath is no longer limited to just the directories specified. modification means that your classpath now includes the current directory and anything on the path variable, i.e. the Java Foundation Classes.
                      • 8. Re: Please I'm new to java.Can anyone help me?
                        807592
                        From Julesh1

                        To: DaithiMcGibon and ehsan java

                        Thank you very much i added the ";." and now i can execute the any code.
                        Your assistance is greatly appreciated.

                        I'm using windows 2000 Pro; jdk1.3.1_01; and apache tomcat 4.0.

                        But whenever i try to start apache tomcat i get a number of errors.
                        I have copied these errors from the command windows and pasted them below because i don't know where to begin.Does anyone think i should reinstall apache tomcat 4.0
                        Please take a look, here below are the error messages i'm getting.

                        A nonfatal internal JIT (3.10.107(x)) error 'Relocation error: NULL relocation target' has occurred in :
                        'org/apache/crimson/parser/Parser2.maybeComment (Z)Z': Interpreting method.
                        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi

                        Catalina.start: LifecycleException: null.open: java.net.BindException: Address in use: bind
                        LifecycleException: null.open: java.net.BindException: Address in use: bind
                        at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.java:1116)
                        at org.apache.catalina.core.StandardService.initialize(StandardService.java, Compiled Code)
                        at org.apache.catalina.core.StandardServer.initialize(StandardServer.java, Compiled Code)
                        at org.apache.catalina.startup.Catalina.start(Catalina.java:775)
                        at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
                        at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java, Compiled Code)
                        ----- Root Cause -----
                        java.net.BindException: Address in use: bind
                        at java.net.PlainSocketImpl.socketBind(Native Method)
                        at java.net.PlainSocketImpl.bind(Unknown Source)
                        at java.net.ServerSocket.<init>(Unknown Source)
                        at java.net.ServerSocket.<init>(Unknown Source)
                        at org.apache.catalina.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:118)
                        at org.apache.catalina.connector.http.HttpConnector.open(HttpConnector.java:946)
                        at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.java:1114)
                        at org.apache.catalina.core.StandardService.initialize(StandardService.java, Compiled Code)
                        at org.apache.catalina.core.StandardServer.initialize(StandardServer.java, Compiled Code)
                        at org.apache.catalina.startup.Catalina.start(Catalina.java:775)
                        at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
                        at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java, Compiled Code)



                        • 9. Re: Please I'm new to java.Can anyone help me?
                          807592
                          From Julesh1

                          To: DaithiMcGibon and ehsan java

                          Thank you very much i added the ";." and now i can execute the any code.
                          Your assistance is greatly appreciated.

                          I'm using windows 2000 Pro; jdk1.3.1_01; and apache tomcat 4.0.

                          But whenever i try to start apache tomcat i get a number of errors.
                          I have copied these errors from the command windows and pasted them below because i don't know where to begin.Does anyone think i should reinstall apache tomcat 4.0
                          Please take a look, here below are the error messages i'm getting.

                          A nonfatal internal JIT (3.10.107(x)) error 'Relocation error: NULL relocation target' has occurred in :
                          'org/apache/crimson/parser/Parser2.maybeComment (Z)Z': Interpreting method.
                          Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi

                          Catalina.start: LifecycleException: null.open: java.net.BindException: Address in use: bind
                          LifecycleException: null.open: java.net.BindException: Address in use: bind
                          at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.java:1116)
                          at org.apache.catalina.core.StandardService.initialize(StandardService.java, Compiled Code)
                          at org.apache.catalina.core.StandardServer.initialize(StandardServer.java, Compiled Code)
                          at org.apache.catalina.startup.Catalina.start(Catalina.java:775)
                          at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
                          at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
                          at java.lang.reflect.Method.invoke(Native Method)
                          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java, Compiled Code)
                          ----- Root Cause -----
                          java.net.BindException: Address in use: bind
                          at java.net.PlainSocketImpl.socketBind(Native Method)
                          at java.net.PlainSocketImpl.bind(Unknown Source)
                          at java.net.ServerSocket.<init>(Unknown Source)
                          at java.net.ServerSocket.<init>(Unknown Source)
                          at org.apache.catalina.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:118)
                          at org.apache.catalina.connector.http.HttpConnector.open(HttpConnector.java:946)
                          at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.java:1114)
                          at org.apache.catalina.core.StandardService.initialize(StandardService.java, Compiled Code)
                          at org.apache.catalina.core.StandardServer.initialize(StandardServer.java, Compiled Code)
                          at org.apache.catalina.startup.Catalina.start(Catalina.java:775)
                          at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
                          at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
                          at java.lang.reflect.Method.invoke(Native Method)
                          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java, Compiled Code)



                          • 10. Re: Please I'm new to java.Can anyone help me?
                            807592
                            I'm not new to Java but I'm new to J2EE. I'm having exactly the same problem on Windows 2000 Professional and on Windows NT.
                            Starting web service at port: 8005
                            Starting secure web service at port: 7000
                            J2EE SDK/1.3
                            LifecycleException: null.open: java.net.BindException: Address in use: JVM_Bind
                            at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConne
                            ctor.java:1081)
                            at org.apache.catalina.startup.Embedded.start(Embedded.java:945)
                            at com.sun.web.server.WebService.start(WebService.java:214)
                            at com.sun.web.server.WebServer.start(WebServer.java:193)
                            at com.sun.enterprise.server.J2EEServer.startWebService(J2EEServer.java:
                            730)
                            at com.sun.enterprise.server.J2EEServer.run(J2EEServer.java:294)
                            at com.sun.enterprise.server.J2EEServer.main(J2EEServer.java:913)
                            java.lang.RuntimeException: null.open
                            at com.sun.enterprise.server.J2EEServer.run(J2EEServer.java:350)
                            at com.sun.enterprise.server.J2EEServer.main(J2EEServer.java:913)
                            J2EE server reported the following error: null.open
                            Error executing J2EE server ...

                            All of the paths are set correctly and there is nothing listening on either port. I've checked deja, java.sun, and several other news groups. I see plenty of similar postings but no answer. Perhaps this would make a good FAQ...
                            • 11. Re: Please I'm new to java.Can anyone help me?
                              807592



                              go here;

                              http://jonjon.0catch.com




                              ^