6 Replies Latest reply on Jul 18, 2008 11:29 AM by 843810

    How to work TRACE

      I'd like only do a Trace of my code but unfortunately I can't.
      I can't compile my code because there are a lot of errors, but doesn't matter , because I don't care these errors. I hope that I can use Trace also without compile the code.
      By the way, these are my command :
      C:\>\j2sdk1.4.2_01\bin\java -classpath C:\j2sdk1.4.2_01\lib\tools.jar Trace Proxy.java

      and I get :

      Exception in thread "main" java.lang.NoClassDefFoundError: Trace

      Please , help me , I'm driving crazy.

      Thanks in advance.
        • 1. Re: How to work TRACE
          Hi kento. Your command has two problems:
          - It tries to run the class named Trace but Trace is not on the classpath so it cannot be located.
          - It tries to trace 'Proxy.java', but the Trace program traces .class files not .java files.

          Trace.java is a JPDA demo program that is included in the JDK. See this for more info:

          The Trace source code is included in

          where '<jdk142>' is your JDK 1.4.2 installation directory.
          You have to build the Trace program before you can use it.

          To build Trace, do the following:
          mkdir examples
          cd examples
          <jdk142>/bin/jar xf <jdk142>/demo/jpda/examples.jar
          <jdk142>/bin/javac -classpath <jdk142>/lib/tools.jar com/sun/tools/example/trace/*.java

          To run trace on your program,
          cd <your directory>
          <jdk142>/bin/javac YourProgram.java
          <jdk142>/bin/java -classpath .:<jdk142>/lib/tools.jar:<your examples/ dir from above> com/sun/tools/example/trace/Trace YourProgram

          • 2. Re: How to work TRACE

            i am also not able to start a trace of my code.

            I use the following command :

            java �classpath tools.jar com/sun/tools/example/trace/Trace Foo

            but i receive the following error message :

            Exception in thread main java.lang.NoCLassDefFoundError: com/sun/tools/example/trace/Trace


            Foo ist the programm, i wanted to trace.

            all steps which are described by "JimHolmlund" are working fine but the last statement does not work.

            does somebody has a solution for that problem
            • 3. Re: How to work TRACE
              Looks like you don't have <your examples/dir> on your classpath. That is why it can't find the Trace class.
              • 4. Re: How to work TRACE
                hello jim ,

                thanks for your quick answer.

                why do i have to set the path of the file "Trace.class" to my classpath ?

                in my statement ,i had explicitly given the information , in which folder you can find Trace.class ( com/sun/tools/example/trace/Trace Foo )

                furthermore, I had temporary set the class path to C:\Programme\Java\jdk1.5.0\bin\com\sun\tools\example\trace,

                but it also doesnt work

                I hope you can say me what iam doing wrong
                • 5. Re: How to work TRACE
                  The name of the class is com.sun.tools.examples.trace.Trace. This name, with . changed to /, so that it becomes a partial file pathname, must be located on the classpath. IE, the directory that contains com\ must be on the classpath. For more info, see:
                  • 6. Re: How to work TRACE
                    hello jim ,

                    i have detected my error.

                    thanks jim , for your help