1 2 3 Previous Next 38 Replies Latest reply: Nov 3, 2008 8:52 AM by abillconsl Go to original post RSS
      • 15. Re: Error in creating JAR file
        793982
        Exception in thread "main" java.lang.NoClassDefFoundError: transpackage/JavaTrans
        Caused by: java.lang.ClassNotFoundException: transpackage.JavaTrans
        This error is caused by basic mistakes: a missing package or wrong import clauses, or a bad classpath.
        You have to be very careful with the basic steps, that's why I'm asking this "stupid" questions.

        Since your problem is in command line, not on the IDE, let's also compile it through the command line.
        All the classes of your project are in the transpackage package? (In the following example, I'll assume yes)
        A important thing is that your directory structure must reflect your package structure, not only the compiled files but also where you place your source files.

        An easy way to do this is letting them together in the same dir, but if you want it separated, you'll need two "transpackage" dirs.
        Organize your project like this:
        C:\myproject\source\transpackage
        where you place your *.java files
        And another dir where will be generated the *.class files
        C:\myproject\classes\transpackage
        In order to compile, you should issue the command:
        javac -d c:\myproject\source\classes -sourcepath c:\myproject\source c:\myproject\source\transpackage\*.java
        Then, to jar your program:
        cd c:\myproject\source\classes
        jar -cef transpackage.JavaTrans c:\myproject\MyJar.jar transpackage\*
        Atmguy question is also good. Can you run your application directly?

        Regards,
        Henrique Abreu
        • 16. Re: Error in creating JAR file
          807589
          Thanks for your reply,

          The first command executed genarate  ClassNotFoundException: transpackage.JavaTrans as you can see below
          C:\Documents and Settings\isz\Desktop\JavaTrans>java -cp MyJar.jar transpackage.JavaTrans
          Exception in thread "main" java.lang.NoClassDefFoundError: transpackage/JavaTrans
          Caused by: java.lang.ClassNotFoundException: transpackage.JavaTrans
          at java.net.URLClassLoader$1.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClassInternal(Unknown Source)

          The second command showes below output and as you can see JavaTrans is not up. Is that makes difference?
          C:\Documents and Settings\isz\Desktop\JavaTrans>jar tf MyJar.jar
          META-INF/
          META-INF/MANIFEST.MF
          transpackage/EventThread$ThreadTrace.class
          transpackage/EventThread.class
          transpackage/Info.class
          transpackage/JavaTrans$1.class
          transpackage/JavaTrans$2.class
          transpackage/JavaTrans$3.class
          transpackage/JavaTrans$DemoAction.class
          transpackage/JavaTrans.class
          transpackage/StepInfo.class
          transpackage/StreamRedirectThread.class

          C:\Documents and Settings\iszalans\Desktop\JavaTrans>
          • 17. Re: Error in creating JAR file
            807589
            Thanks a lot Henrique Abreu,

            I have done a dir under c: called myproject then I created 2 dirs called classes and source. Under each dir I have created a dir called transpackage and I put classes in C:\myproject\classes\transpackage and all .java files in C:\myproject\source\transpackage
            I tried to compile by using the same command you gave me :
            javac -d c:\myproject\source\classes -sourcepath c:\myproject\source c:\myproject\source\transpackage\*.java
            I got the following errors:

            c:\myproject\source\transpackage\JavaTrans.java:45: package com.sun.jdi.connect
            does not exist
            import com.sun.jdi.connect.*;
            ^
            c:\myproject\source\transpackage\JavaTrans.java:53: cannot find symbol
            symbol : class VirtualMachine
            location: class transpackage.JavaTrans
            private VirtualMachine vm;
            ^
            c:\myproject\source\transpackage\JavaTrans.java:400: cannot find symbol
            symbol : class VirtualMachine
            location: class transpackage.JavaTrans
            VirtualMachine launchTarget(String mainArgs) {
            ^
            c:\myproject\source\transpackage\JavaTrans.java:419: cannot find symbol
            symbol : class LaunchingConnector
            location: class transpackage.JavaTrans
            LaunchingConnector findLaunchingConnector() {
            ^
            c:\myproject\source\transpackage\JavaTrans.java:431: cannot find symbol
            symbol : class LaunchingConnector
            location: class transpackage.JavaTrans
            Map connectorArguments(LaunchingConnector connector, String mainArgs) {
            ^
            c:\myproject\source\transpackage\StreamRedirectThread.java:11: package com.sun.j
            di does not exist
            import com.sun.jdi.*;
            ^
            .....
            c:\myproject\source\transpackage\EventThread.java:298: cannot find symbol
            symbol : class Field
            location: class transpackage.EventThread
            Field field = (Field)it.next();
            ^
            Note: Some input files use unchecked or unsafe operations.
            Note: Recompile with -Xlint:unchecked for details.
            100 errors

            C:\>
            • 18. Re: Error in creating JAR file
              793982
              Sorry, I forgot to mention you also need to set the classpath. Coping what you posted on reply 8, it should be something like this:
              javac -d c:\myproject\source\classes -sourcepath c:\myproject\sourc -classpath "C:\Program Files\Java\jdk1.6.0_05\demo\jpda\com\sun\tools\example\debug\bdi";"C:\Program Files\Java\jdk1.6.0_05\demo\jpda\examples.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\localedata.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunjce_provider.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunmscapi.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunpkcs11.jar" c:\myproject\source\transpackage\*.java
              Regards,
              Henrique Abreu
              • 19. Re: Error in creating JAR file
                807589
                Thanks a lot for your cooperation and patient with me. I did the following command and I got the following:

                Am I missing something?
                C:\myproject>javac -Xlint -d c:\myproject\source\classes -sourcepath c:\myprojec
                t\source -classpath "C:\Program Files\Java\jdk1.6.0_05\demo\jpda\com\sun\tools\example\debug\bdi";"C:\Program Files\Java\jdk1.6.0_05\demo\jpda\examples.jar";"C:
                \Program Files\Java\jdk1.6.0_05\jre\lib\ext\localedata.jar";"C:\Program Files\Ja
                va\jdk1.6.0_05\jre\lib\ext\sunjce_provider.jar";"C:\Program Files\Java\jdk1.6.0_
                05\jre\lib\ext\sunmscapi.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sun
                pkcs11.jar";"C:\Program Files\Java\jdk1.6.0_05\lib\tools.jar" c:\myproject\source\transpackage\*.java
                c:\myproject\source\transpackage\JavaTrans.java:21: package javax.tools.JavaCompiler does not exist
                import javax.tools.JavaCompiler.CompilationTask;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:22: package javax.tools does not exist
                import javax.tools.JavaCompiler;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:23: package javax.tools does not exist
                import javax.tools.JavaFileObject;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:24: package javax.tools does not exist
                import javax.tools.StandardJavaFileManager;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:25: package javax.tools does notexist
                import javax.tools.ToolProvider;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:26: cannot find symbol
                symbol : class ServiceLoader
                location: package java.util
                import java.util.ServiceLoader;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:27: package javax.tools does not exist
                import javax.tools.Tool;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:28: package javax.tools does not exist
                import javax.tools.DiagnosticCollector;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:29: package javax.tools does not exist
                import javax.tools.Diagnostic;
                ^
                c:\myproject\source\transpackage\JavaTrans.java:44: cannot find symbol
                symbol : class FileNameExtensionFilter
                location: package javax.swing.filechooser
                import javax.swing.filechooser.FileNameExtensionFilter;
                ^
                c:\myproject\source\transpackage\EventThread.java:181: warning: [unchecked] unch
                ecked call to addElement(E) as a member of the raw type java.util.Vector
                v.addElement(si);
                ^
                c:\myproject\source\transpackage\EventThread.java:195: warning: [unchecked] unch
                ecked call to addElement(E) as a member of the raw type java.util.Vector
                v.addElement(si);
                ^
                c:\myproject\source\transpackage\EventThread.java:206: warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
                v.addElement(si);
                ^
                c:\myproject\source\transpackage\EventThread.java:253: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Map
                traceMap.put(event.thread(), trace);
                ^
                c:\myproject\source\transpackage\StepInfo.java:60: warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
                dataList.addElement(i);
                ^
                c:\myproject\source\transpackage\JavaTrans.java:274: cannot find symbol
                symbol : class FileNameExtensionFilter
                location: class transpackage.JavaTrans
                FileNameExtensionFilter filter = new FileNameExtensionFilter("java files", "java");
                ^
                c:\myproject\source\transpackage\JavaTrans.java:274: cannot find symbol
                symbol : class FileNameExtensionFilter
                location: class transpackage.JavaTrans
                FileNameExtensionFilter filter = new FileNameExtensionFilter("java files", "java");
                ^
                c:\myproject\source\transpackage\JavaTrans.java:406: warning: [unchecked] unchec
                ked conversion
                found : java.util.Map
                required: java.util.Map<java.lang.String,? extends com.sun.jdi.connect.Connector.Argument>
                return connector.launch(arguments);
                ^
                c:\myproject\source\transpackage\JavaTrans.java:1128: cannot find symbol
                symbol : class DiagnosticCollector
                location: class transpackage.JavaTrans
                DiagnosticCollector<JavaFileObject> diagnostics=new Diag
                nosticCollector<JavaFileObject>();
                ^
                c:\myproject\source\transpackage\JavaTrans.java:1128: cannot find symbol
                symbol : class JavaFileObject
                location: class transpackage.JavaTrans
                DiagnosticCollector<JavaFileObject> diagnostics=new Diag
                nosticCollector<JavaFileObject>();
                ^
                c:\myproject\source\transpackage\JavaTrans.java:1128: cannot find symbol
                symbol : class DiagnosticCollector
                location: class transpackage.JavaTrans
                DiagnosticCollector<JavaFileObject> diagnostics=new Diag
                nosticCollector<JavaFileObject>();
                ^
                c:\myproject\source\transpackage\JavaTrans.java:1128: cannot find symbol
                symbol : class JavaFileObject
                location: class transpackage.JavaTrans
                DiagnosticCollector<JavaFileObject> diagnostics=new Diag
                nosticCollector<JavaFileObject>();

                ^
                c:\myproject\source\transpackage\JavaTrans.java:1129: cannot find symbol
                symbol : class JavaCompiler
                location: class transpackage.JavaTrans
                JavaCompiler jc = ToolProvider.getSystemJavaCompiler();

                ^
                c:\myproject\source\transpackage\JavaTrans.java:1129: cannot find symbol
                symbol : variable ToolProvider
                location: class transpackage.JavaTrans
                JavaCompiler jc = ToolProvider.getSystemJavaCompiler();

                ^
                c:\myproject\source\transpackage\JavaTrans.java:1130: cannot find symbol
                symbol : class StandardJavaFileManager
                location: class transpackage.JavaTrans
                StandardJavaFileManager fileManager =jc.getStandardFileM
                anager(diagnostics, null, null);
                ^
                c:\myproject\source\transpackage\JavaTrans.java:1131: cannot find symbol
                symbol : class JavaFileObject
                location: class transpackage.JavaTrans
                Iterable<? extends JavaFileObject> compilationUnits =fil
                eManager.getJavaFileObjectsFromStrings(Arrays.asList(filePath));
                ^
                c:\myproject\source\transpackage\JavaTrans.java:1133: package JavaCompiler doesnot exist
                JavaCompiler.CompilationTask task = jc.getTask( null, fi
                leManager, diagnostics, options , null, compilationUnits);
                ^
                c:\myproject\source\transpackage\JavaTrans.java:1139: cannot find symbol
                symbol : class Diagnostic
                location: class transpackage.JavaTrans
                for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {
                ^
                c:\myproject\source\transpackage\JavaTrans.java:1241: warning: [serial] serializ
                able class transpackage.JavaTrans.DemoAction has no definition of serialVersionUID
                class DemoAction extends AbstractAction {
                ^
                c:\myproject\source\transpackage\JavaTrans.java:47: warning: [serial] serializab
                le class transpackage.JavaTrans has no definition of serialVersionUID
                public class JavaTrans extends JFrame{
                ^
                c:\myproject\source\transpackage\StreamRedirectThread.java:50: warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector

                outvector.addElement(s);
                ^
                c:\myproject\source\transpackage\StreamRedirectThread.java:51: warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector

                JavaTrans.vv.addElement(s);
                ^
                22 errors
                10 warnings


                C:\myproject>
                • 20. Re: Error in creating JAR file
                  793982
                  I forgot to include the jre basic lib (jre\lib\rt.jar), the previous one I just copied from your posting without reading it.
                  I'm not even very sure of it, since I never had this kind of problem, someone with more experience may be a better help.
                  But, until they show up I'll try to help you.

                  Try this one now:
                  javac -d c:\myproject\source\classes -sourcepath c:\myproject\source -classpath "C:\Program Files\Java\jdk1.6.0_05\demo\jpda\com\sun\tools\example\debug\bdi";"C:\Program Files\Java\jdk1.6.0_05\demo\jpda\examples.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\localedata.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunjce_provider.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunmscapi.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunpkcs11.jar";"C:\Program Files\Java\jdk1.6.0_05\lib\tools.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\rt.jar" c:\myproject\source\transpackage\*.java
                  By the way, in my opinion, it's easier to learn Java going through the [basics tutorial|http://java.sun.com/docs/books/tutorial/index.html] and start writing the programs without any IDE help,
                  compiling and running it from the command line, as we're trying now.

                  Regards,
                  Henrique Abreu
                  • 21. Re: Error in creating JAR file
                    abillconsl
                    Boise I dunno about that classpath you got there.

                    If you still have the same packaging scenario as B4, try these steps from the directory immediately above transpackage, and with the manifest file (forgot what you called it) in this directory, and not in traspackage dir:
                    javac -classpath . transpackage\*.java
                    java -cp . transpackage.JavaTrans
                    jar cvmf MyJar.jar your_manifest_file.txt transpackage/*.class
                    java -jar -cp . MyJar.jar
                    ... and with your manifest file contents looking like this:
                    Main-Class: transpackage.JavaTrans

                    ^
                    |____new line
                    ~Bill
                    • 22. Re: Error in creating JAR file
                      807589
                      Thanks a lot, compilation works now with only few warnings. I only have modified the first line of the command you have given to me. I was so happy seeing it compiling through command line.

                      1- I used the following command:
                      C:\myproject\classes>javac -Xlint -d c:\myproject\classes -sourcepath c:\myproject\source -classpath "C:\Program Files\Java\jdk1.6.0_05\demo\jpda\com\sun\tools\example\debug\bdi";"C:\Program Files\Java\jdk1.6.0_05\demo\jpda\examples.jar";"C
                      :\Program Files\Java\jdk1.6.0_05\jre\lib\ext\localedata.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunjce_provider.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunmscapi.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext\sunpkcs11.jar";"C:\Program Files\Java\jdk1.6.0_05\lib\tools.jar";"C:\Program Files\Java\jdk1.6.0_05\jre\lib\rt.jar" c:\myproject\source\transpackage\*.java
                      2- next step I did the following:
                      C:\myproject\classes>jar -cmf manifest.mft MyJar.jar transpackage\*.class
                      3- the jar file created but when I run it I still get the follwing error:
                      C:\myproject\classes>java -jar MyJar.jar
                      Exception in thread "main" java.lang.NoClassDefFoundError: transpackage/JavaTrans
                      Caused by: java.lang.ClassNotFoundException: transpackage.JavaTrans
                      at java.net.URLClassLoader$1.run(Unknown Source)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.net.URLClassLoader.findClass(Unknown Source)
                      at java.lang.ClassLoader.loadClass(Unknown Source)
                      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
                      at java.lang.ClassLoader.loadClass(Unknown Source)
                      at java.lang.ClassLoader.loadClassInternal(Unknown Source)


                      what do you think my error is? Thanks a lot
                      • 23. Re: Error in creating JAR file
                        DrClap
                        Your problem is that the jar file doesn't contain a JavaTrans.class file in a transpackage directory.

                        Look in the jar file yourself and you will see that's the case.
                        • 24. Re: Error in creating JAR file
                          abillconsl
                          And is there a reason that you changed the compile text from what I suggested?

                          If you compile from c:\myproject\source\, don't put:

                          c:\myproject\source\transpackage\*.java

                          Rather, put:

                          transpackage\*.java
                          • 25. Re: Error in creating JAR file
                            807589
                            Thanks a lot for your comments, I checked it and it is there, see my command below:
                            C:\myproject\classes>jar tf MyJar.jar
                            META-INF/
                            META-INF/MANIFEST.MF
                            transpackage/EventThread$ThreadTrace.class
                            transpackage/EventThread.class
                            transpackage/Info.class
                            transpackage/JavaTrans$1.class
                            transpackage/JavaTrans$2.class
                            transpackage/JavaTrans$3.class
                            transpackage/JavaTrans$DemoAction.class
                            transpackage/JavaTrans.class
                            transpackage/StepInfo.class
                            transpackage/StreamRedirectThread.class
                            • 26. Re: Error in creating JAR file ( Code Provided ) Please help
                              807589
                              Here is the code, I am really stuck how can I make a jar file for it. Too hard to find the error for me....

                              The main program: JavaTrans.java
                              /**
                               * @(#)JavaTrans.java
                               * JavaTransTest application
                               * @author I. Alansari
                               * @version 1.00 2008/3/12
                               */
                              
                              
                              import java.io.*; 
                              import java.text.*; 
                              import java.awt.event.*;  
                              import javax.swing.event.*;
                              import java.util.*;
                              import java.lang.String;
                              import javax.swing.text.DefaultHighlighter;
                              import javax.swing.text.Highlighter;
                              import javax.swing.text.BadLocationException;
                              import java.io.IOException;
                              import java.awt.*;
                              import javax.swing.*;
                              import javax.tools.JavaCompiler.CompilationTask;
                              import javax.tools.JavaCompiler;
                              import javax.tools.JavaFileObject;
                              import javax.tools.StandardJavaFileManager;
                              import javax.tools.ToolProvider;
                              import java.util.ServiceLoader;
                              import javax.tools.Tool;
                              import javax.tools.DiagnosticCollector;
                              import javax.tools.Diagnostic;
                              import java.util.*;
                              import com.sun.jdi.*;
                              import com.sun.jdi.request.*;
                              import com.sun.jdi.event.*;
                              import com.sun.jdi.connect.*;
                              import java.util.List;
                              import java.net.URL;
                              import java.awt.BorderLayout;
                              import java.awt.Dimension;
                              import java.awt.Toolkit;
                              import java.awt.event.ActionEvent;
                              import java.awt.event.ActionListener;
                              import java.lang.reflect.*;
                              import javax.swing.JToolBar;
                              import javax.swing.filechooser.FileNameExtensionFilter;
                              import com.sun.jdi.connect.*;
                                 
                               public class JavaTrans  extends JFrame{
                               
                                   //first number is number of rows, second is number of columns 
                                   String[][] columnData;
                                   // Running remote VM
                                  public static Vector vv = new Vector();
                                  private  VirtualMachine vm;
                                  // Thread transferring remote error stream to our error stream
                                  private Thread errThread = null;
                                  private Vector v= new Vector(5);
                                  private int vectorSize=0;
                                  private  Vector outv =new Vector();
                                  private ListIterator iter = v.listIterator();
                                  // Thread transferring remote output stream to our output stream
                                  private Thread outThread = null;
                                  PrintWriter writer;
                                   private int start=0;
                                   private int outindex=0;
                                   private static JButton startB; // Start Button
                                  private static JButton restartB; // Restart Button
                                  private     static JButton          buttonOpen;
                                   private     static JButton          buttonCompile;
                                   private static JList   programList; // TextArea to hold program Code
                                   private static JList   prog;
                                   private DefaultListModel Model1,Model2;
                                   public static JTextArea descriptionArea; // JTextarea to hold program Description
                                   private static JScrollPane  programScrollPane, descScrollPane, outputScrollPane ;// ScrollPane for the program , Description, output
                                   private static JSplitPane splitPane; // JSplitPane to hold the listScrollPane, DescScrollPane     
                                   private static JPanel buttonPanel = new JPanel(); // panel to hold buttons
                                   private     static JPanel topPanel = new JPanel();;
                                   private static String filePath= new String();
                                   private static String classpath= new String();
                                        private static String fileName= new String();
                              
                                   
                                  
                                   public JTextArea output;
                                  private DefaultListModel Model;
                                  
                                  EventThread eventThread;
                                  
                                  File fFile = new File ("default.java");
                                  JFrame frame;
                                  
                                  private JMenuBar menuBar;
                                  private JToolBar toolBar;
                                  private DemoAction loadFile;
                                  private DemoAction compileFile;
                                  private DemoAction exitProgram;
                                  private boolean myFlag = false;
                                  
                                   /////////////////////Constructor //////////////////////////////////////////
                                   JavaTrans()
                                   {
                                  frame = new JFrame("Java");
                                  frame.setSize(800, 600);
                                  Container contentPane = frame.getContentPane();     
                                  contentPane.setLayout(new BorderLayout()); 
                                  Model1 =new DefaultListModel();
                                  Model2 =new DefaultListModel();
                                  programList = new JList(Model1);
                                  prog = new JList(Model2);
                                  programList.setFont(new Font("Tahoma",Font.BOLD,12));
                                
                                  programList.setBorder(BorderFactory.createTitledBorder(" Program "));
                                  programScrollPane = new JScrollPane(programList);
                                  output = new JTextArea(5,40);
                                  descriptionArea = new JTextArea(15,10);
                                 
                                  /////////////////------ Menu ---------///////////////////  
                                  menuBar = new JMenuBar();
                                  // Create a set of actions to use in both the menu and toolbar
                                  loadFile = new DemoAction("Load", new ImageIcon("images/open.jpg"), "Load Program", 'L');
                                  compileFile = new DemoAction("Compile", new ImageIcon("images/compile.gif"), "Compile Program", 'C');
                                  JMenu mainMenu = new JMenu("File");
                                  mainMenu.add(loadFile);
                                  mainMenu.add(compileFile);
                                  menuBar.add(mainMenu);
                                  toolBar = new JToolBar("FileToolBar");
                                  toolBar.add(loadFile);
                                  toolBar.addSeparator();
                                  compileFile.setEnabled(false);
                                  toolBar.add(compileFile);
                                  
                                  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                                  frame.setJMenuBar(menuBar);
                                  menuBar.setBackground(Color.white);
                                  toolBar.setBackground(Color.white);
                                  frame.getContentPane().add(toolBar,BorderLayout.NORTH );
                               
                                  //////////////////////////////////Menu End/////////////////////////////////////
                                  
                                  descriptionArea.setBorder(BorderFactory.createTitledBorder("*** Program Description***"));
                                  output.setBorder(BorderFactory.createTitledBorder("Screen Output"));
                                  output.setEditable(false);
                                
                                  descriptionArea.setFont(new Font("Tahoma",Font.BOLD,12));   
                                  output.setFont(new Font("Tahoma",Font.BOLD,14));
                                 
                                  outputScrollPane = new JScrollPane(output);
                                  descriptionArea.setEditable(false);
                                  descScrollPane = new JScrollPane(descriptionArea);
                                  //Create a split pane with the two scroll panes in it.
                                  splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                                                 programScrollPane, descScrollPane);
                                  splitPane.setOneTouchExpandable(true);
                                  //Provide a preferred size for the split pane.
                                  splitPane.setPreferredSize(new Dimension(800,400));
                                  splitPane.setDividerLocation(400);
                                  //Provide minimum sizes for the two components in the split pane.
                                  Dimension minimumSize = new Dimension(400, 100);
                                  programScrollPane.setMinimumSize(minimumSize);
                                  descScrollPane.setMinimumSize(minimumSize);
                                  //// Start Button ////
                                  startB = new JButton("Start");
                                  startB.setEnabled(false);
                                
                                  startB.setFont(new Font("sansserif",Font.BOLD,12));
                                  /// Restart Button ////
                                  restartB = new JButton("Restart");
                                  restartB.setEnabled(false);
                                  restartB.setFont(new Font("sansserif",Font.BOLD,12));
                                  ///////////////// Adding Buttons to Button Panel //////////////
                                  buttonPanel.add(startB);
                                  buttonPanel.add(restartB);
                                  ///////////////// Adding All to the contentPane ///////////////
                                  
                                  contentPane.add(splitPane, BorderLayout.CENTER);
                                  JPanel bPanel= new JPanel();
                                  bPanel.setLayout(new BorderLayout());
                                  bPanel.add(outputScrollPane, BorderLayout.PAGE_START );
                                  bPanel.add(buttonPanel,  BorderLayout.PAGE_END);
                                  contentPane.add(bPanel, BorderLayout.PAGE_END); 
                                  
                                  ////////////////////////////////////////////////////////////////
                                  
                                  startB.addActionListener(
                                         new ActionListener()
                                         {
                                            public void actionPerformed(ActionEvent event)
                                                 {
                               
                                                      //descriptionArea.append("Start ="+ start+ "  Size ="+v.size()+"\n");
                                                      if (myFlag == true)
                                                      {
                                                           start=0; // intialize program area index
                                                           outindex=0;
                                                         startB.setText("Start");
                                                         programList.ensureIndexIsVisible(0);// Show the beginig of program
                                                         descriptionArea.setText(""); // Empty the Description Area
                                                         output.setText(""); // Empty the output Area  
                                                         myFlag=false;
                                                         
                                                      }
                                                      startB.setText(" Next ");
                                                      start= getProgLocation(start,v);
                                                 StepInfo s = (StepInfo) v.elementAt(start); 
                                                 programList.ensureIndexIsVisible(s.getLocation()-1);
                                                 programList.setSelectedIndex(s.getLocation()-1);
                                                 String verbalDescription = getDescription(v);//,s.getLocation()-1);
                                                 descriptionArea.append("--> "+verbalDescription +"\n");
                                                 start++;
                                                 //descriptionArea.append(" Start = "+ start+ " vect Sise "+vectorSize+"\n");
                                                 }          
                                         }
                                  ); // end of action Listener
                                  // Restart Function helps the user to start over again
                                      restartB.addActionListener(
                                         new ActionListener()
                                         {
                                            public void actionPerformed(ActionEvent event)
                                                 {  
                                                      start=0; // intialize program area index
                                                      outindex=0;
                                                    startB.setText("Start");
                                                    programList.ensureIndexIsVisible(0);// Show the beginig of program
                                                    descriptionArea.setText(""); // Empty the Description Area
                                                    output.setText(""); // Empty the output Area  
                                                    
                                                 }
                                              }
                                              );
                                 
                                  frame.pack();
                                  frame.setVisible(true);
                              
                                   }//
                                   //////////////////////////////////////////////////////////
                                     private boolean openFile () {
                                    
                                    JFileChooser fc = new javax.swing.JFileChooser();
                                    // Choose only files, not directories
                                    fc.setFileSelectionMode ( JFileChooser.FILES_ONLY);
                                   
                                    fc.setDialogTitle ("Open File");
                                    FileNameExtensionFilter filter = new FileNameExtensionFilter("java files", "java");
                                    fc.setFileFilter(filter);
                              
                                    
                                    // Start in current directory
                                    fc.setCurrentDirectory (new File("."));
                              
                                    // Now open chooser
                                    int result = fc.showOpenDialog (this);
                              
                                    if (result == JFileChooser.CANCEL_OPTION) {
                                        return true;
                                    } else if (result == JFileChooser.APPROVE_OPTION) {
                              
                                        fFile = fc.getSelectedFile ();
                                        String file_string = readFile (fFile);
                              
                                        if (file_string == null)
                                           return false;
                                        else
                                        { 
                                             filePath=fFile.toString();
                                             fileName=fFile.getName();
                                             return true;
                                             
                                        }
                                           
                                    } else {
                                        return false;
                                    }    
                                   } 
                                    // close Application
                                    ////////////////////////////////////////////////////////////////
                                        
                                   // openFile
                                   /** Use a BufferedReader wrapped around a FileReader to read
                                  ** the text data from the given file.
                                  **/
                                     public String readFile (File file) {
                                  StringBuffer fileBuffer;
                                  String fileString=null;
                                  String line;
                                      
                                    try {
                                         int lineno=1;
                                         FileReader in = new FileReader (file);
                                         BufferedReader dis = new BufferedReader (in);
                                         fileBuffer = new StringBuffer () ;
                                         ((DefaultListModel) programList.getModel()).clear ();
                                          while ((line = dis.readLine ()) != null) {
                                                   Model2.addElement(line);
                                                   if (lineno>9)
                                                     Model1.addElement(lineno+ "   "+line); // Load file into the program area
                                                else
                                                  Model1.addElement(lineno+ "    "+line);
                                                lineno++;
                                                 
                                         }
                                         in.close ();
                                         programList.ensureIndexIsVisible(0);
                                         v.removeAllElements();    
                                        outv.removeAllElements();
                                        vectorSize=0;
                                        
                                    }
                                       catch  (IOException e ) {
                                    return null;
                                  }
                                  return "Done";
                                } // readFile
                              
                              ////////////////////////////////--MarkLines--////////////////////////////////////
                              /******************** Virtual Machine *****************************/
                                   VirtualMachine launchTarget(String mainArgs) {
                                   LaunchingConnector connector = findLaunchingConnector();
                                   Map arguments = connectorArguments(connector, mainArgs);//mainArgs = Foo
                                   Connector.Argument options = (Connector.Argument)arguments.get("options");
                                  options.setValue(classpath);
                                      try {
                                       return connector.launch(arguments);
                                      } catch (IOException exc) {
                                          throw new Error("Unable to launch target VM: " + exc);
                                      } catch (IllegalConnectorArgumentsException exc) {
                                          throw new Error("Internal error: " + exc);
                                      } catch (VMStartException exc) {
                                          throw new Error("Target VM failed to initialize: " +
                                                 exc.getMessage());
                                      }
                                  }
                                  /*************************************************
                                   * Find a com.sun.jdi.CommandLineLaunch connector
                                   **************************************************/
                                  LaunchingConnector findLaunchingConnector() {
                                      List <Connector> connectors = Bootstrap.virtualMachineManager().allConnectors();
                               
                                      for(Connector connector: connectors)
                                          if (connector.name().equals("com.sun.jdi.CommandLineLaunch"))
                                              return (LaunchingConnector)connector;
                               
                                      throw new Error("No launching connector");
                                    }
                                    /**********************************************
                                   * Return the launching connector's arguments.
                                   **********************************************/
                                  Map connectorArguments(LaunchingConnector connector, String mainArgs) {
                                      Map arguments = connector.defaultArguments();
                                      Connector.Argument mainArg =
                                                      (Connector.Argument)arguments.get("main");
                                      if (mainArg == null) {
                                          throw new Error("Bad launching connector");
                                      }
                                   mainArg.setValue(mainArgs);
                                   // Need a VM that supports watchpoints
                                   Connector.Argument optionArg = (Connector.Argument)arguments.get("options");
                                   if (optionArg == null) {
                                       throw new Error("Bad launching connector");
                                   }
                                   optionArg.setValue("-client");
                                   return arguments;
                                  }
                                  /////////////////////////////// Generate Trace //////////////////////////////////////
                                  void generateTrace(PrintWriter writer) {
                                     
                                      vm.setDebugTraceMode(0);//VirtualMachine.TRACE_NONE
                                      eventThread = new EventThread(vm, writer,fileName);
                                      eventThread.setEventRequests(true);//watchFields
                                      eventThread.start();
                                      redirectOutput();
                                      vm.resume();
                                      //Shutdown begins when event thread terminates
                                       try {
                                       eventThread.join();
                                       errThread.join(); // Make sure output is forwarded
                                       outThread.join(); // before we exit
                                        } catch (InterruptedException exc) {
                                       // we don't interrupt
                                        }
                                        writer.close();
                                      
                                        
                                        
                                  }
                                  /////////////////////////////// Redirect Output //////////////////////////////////////////////
                                  void redirectOutput() {
                                      Process process = vm.process();
                                      // Copy target's output and error to our output and error.
                                      errThread = new StreamRedirectThread("error reader", process.getErrorStream(), System.err);
                                      outThread = new StreamRedirectThread("output reader",process.getInputStream(), System.out); 
                                      errThread.start();
                                      outThread.start();
                                  }
                                   ////////////////////////////////////////////////////////////////////////////////////////////////
                                         public     String getDescription(Vector V)
                                         {
                                              return null;
                                              }
                                    ////////////////////////////////////// Start with Var  ////////////////////////////////////////
                                    Boolean mainTest(Vector d)
                                    {
                                    
                                         for (int k=0;k<d.size();k++)
                                         {
                                              StepInfo s = (StepInfo) d.elementAt(k);
                                              if (s.getMethodName().equals("main"))
                                                   return true; 
                                         }
                                         return false;
                                    }
                                    public Boolean startWithIfElse(String mcode)
                                    {
                                         String temp = new String();
                                         String[] cr = mcode.split(" ");
                                         if ( (cr[0].equals("if") && cr[1].startsWith("else"))|| (cr[0].equals("if") && cr[1].startsWith("else{")))
                                              return true;
                                                   else
                                                        return false;
                                    }
                                    public int StartWithVar(StepInfo s, String mcode )
                                    {
                                         String temp = new String();
                                      temp = mcode.replaceAll("\\W", "").toLowerCase();
                                      descriptionArea.append(" The var i got is " + temp +"\n");
                                      Vector tempv= s.getDataList();
                                         for (int j = 0;j< tempv.size(); j++)
                                                      {
                                                           if (temp.equals(((Info)tempv.elementAt(j)).getlName()))
                                                           {     
                                                                return j;
                                                           }  
                                                      }           
                                         return -1;     
                                         }
                                         ////////////////////// Get the location of the current line data ///////////////
                                         public int getProgLocation(int pos, Vector datalist)
                                         {
                                              Vector currv = datalist;
                                              StepInfo s = (StepInfo) currv.elementAt(pos); 
                                              int datatype=s.getType();     
                                             int currLocation =s.getLocation();
                                              while ((((StepInfo) currv.elementAt(pos+1)).getLocation()== currLocation)&& (datatype ==((StepInfo) currv.elementAt(pos+1)).getType()))
                                              {
                                                pos++;
                                                 datatype =((StepInfo) currv.elementAt(pos)).getType();
                                              }
                                               
                                         return pos;     
                                         }
                                    ///////////////////////////////////////  Compile Loaded Code ///////////////////////////////////
                                 
                                    public void compileProgram()
                                    {
                                         Boolean success= false;
                                        try {     
                                             DiagnosticCollector<JavaFileObject> diagnostics=new DiagnosticCollector<JavaFileObject>();
                                             JavaCompiler jc = ToolProvider.getSystemJavaCompiler();  
                                             StandardJavaFileManager fileManager =jc.getStandardFileManager(diagnostics, null, null);
                                             Iterable<? extends JavaFileObject> compilationUnits =fileManager.getJavaFileObjectsFromStrings(Arrays.asList(filePath));
                                             Iterable<String> options = Arrays.asList(new String[] {"-g" });
                                             JavaCompiler.CompilationTask task = jc.getTask(     null, fileManager, diagnostics, options , null, compilationUnits);
                                                success = task.call();                    
                                                ////////////////////////////
                                             if (!success){
                                                             
                                                            String errors = new String(" Please use your favorite Editor to fix the following errors:\n");          
                                                              for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {
                                                              errors += " Line: " + diagnostic.getLineNumber()+ " Error: " + diagnostic.getMessage(null)+"\n";
                                                                 }
                                                              JOptionPane.showMessageDialog(
                                                                           null,
                                                                           errors, "Compilation Error",
                                                                           JOptionPane.ERROR_MESSAGE
                                                                         );
                                                            
                                                       }                       
                                                    
                                                       // Add more compilation tasks   
                                                       fileManager.close();
                                                        
                                                       }catch (IOException exp) {
                                                            JOptionPane.showMessageDialog(
                                                                           null,
                                                                           "Compilation Error 1!", "IOException",
                                                                           JOptionPane.ERROR_MESSAGE
                                                                         );
                                                            }catch (IllegalStateException ise){
                                                                 JOptionPane.showMessageDialog(
                                                                           null,
                                                                           "Compilation Error 2!", "IllegalStateException",
                                                                           JOptionPane.ERROR_MESSAGE
                                                                         );
                                                            }catch (RuntimeException  rte){
                                                                   
                                                            JOptionPane.showMessageDialog(
                                                                           null,
                                                                           "Compilation Error 3!", "RuntimeException",
                                                                           JOptionPane.ERROR_MESSAGE
                                                                         );
                                                            }
                                                
                                                  /////////////////////
                                                  if (success) 
                                                       {     // Get Trace
                                                       
                                                         String classPath  = filePath.substring(0, filePath.length()-5); // Omit .java from the end to get calss name
                                                      
                                                      // Run My virtual Machine here 
                                                      
                                                      String className=  fileName.substring(0, fileName.length()-5);  
                                                     
                                                      classPath = filePath.replaceAll(fileName,"");
                                                      classPath = classPath.substring(0, classPath.length()-1);  
                                                      
                                                      classpath = "-classpath ";
                                                      classpath=classpath.concat("\"");
                                                      classpath=classpath.concat(classPath);
                                                      classpath=classpath.concat("\"");   
                                                      className=  fileName.substring(0, fileName.length()-5);  
                                                      String cp = ("-classpath "+ classPath+" "+className);
                                                       vm = launchTarget(className);//ClassName
                                                      writer = new PrintWriter(System.out);
                                                      generateTrace(writer);
                                                      vectorSize=v.size();
                                                      Boolean t= mainTest(v);     
                                                      if (t==true) // compilation OK
                                                     {      
                                                         startB.setEnabled(true);
                                                     restartB.setEnabled(true);
                                                     }else
                                                          JOptionPane.showMessageDialog(     null,      "No main method found!", "File execution Error", JOptionPane.ERROR_MESSAGE);       
                                             
                                                  }
                                                  
                                         }
                                    ///////////////////////////////////////////////////////////////////////////////////////////////
                              public static void main(String[] args) {
                                   javax.swing.SwingUtilities.invokeLater(new Runnable() {
                                          public void run() {
                                                   JavaTrans app = new JavaTrans();     
                                                   app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                                          }
                                      });                 
                                     }// End of Main/////////////////////////////////////////
                              class DemoAction extends AbstractAction {
                              
                                  public DemoAction(String text, Icon icon, String description,
                                      char accelerator) {
                                    super(text, icon);
                                    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(accelerator,
                                        Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
                                    putValue(SHORT_DESCRIPTION, description);
                                  }
                              
                                  public void actionPerformed(ActionEvent e) {
                                    try {
                                         
                                         if (getValue(NAME).equals("Load"))
                                         {
                                              boolean status = false;
                                              ((DefaultListModel) programList.getModel ()).clear ();
                                             ((DefaultListModel) prog.getModel ()).clear ();
                                             status = openFile();
                                            if (!status) JOptionPane.showMessageDialog(     null,      "Error opening file!", "File Open Error", JOptionPane.ERROR_MESSAGE);
                                                     else
                                                     {
                                                           compileFile.setEnabled(true);
                                                           startB.setText("Start");
                                                           startB.setEnabled(false);
                                                           restartB.setEnabled(false);
                                                           start=0; // intialize program area index
                                                                 outindex=0;
                                                               programList.ensureIndexIsVisible(0);// Show the beginig of program
                                                               descriptionArea.setText(""); // Empty the Description Area
                                                               output.setText(""); // Empty the output Area  
                                                            
                                                          }     
                                         }
                                      else if (getValue(NAME).equals("Compile"))
                                      {
                                           compileProgram();
                                      }
                                      
                                    } catch (Exception ex) {
                                      ex.printStackTrace();
                                    }
                                  }
                                }
                               ////////++++++++++++++++ Class for the line list +++++++++++//////
                              }
                              The second file: EventThread.java
                              import java.io.*;
                              import java.util.*; 
                              import com.sun.jdi.*;
                              import com.sun.jdi.request.*;
                              import com.sun.jdi.event.*;
                              import com.sun.jdi.connect.*;
                              import java.util.Vector;
                              
                               
                              class EventThread extends Thread {
                                   private final String fileName; // File to be traced fileName.java
                                  private final VirtualMachine vm;   // Running VM
                                  private final PrintWriter writer;  // Where output goes
                                  private boolean connected = true;  // Connected to VM
                                  private boolean vmDied = true;     // VMDeath occurred   
                                  private Map traceMap = new HashMap();// Maps ThreadReference to ThreadTrace instances
                                  private static Vector v = new Vector(5); // victor of objects that contains trace result
                                  private StepInfo si;
                                  private String[] excludes = {"java.*", "javax.*", "sun.*", "com.sun.*"};
                                  EventThread(VirtualMachine vm, PrintWriter writer, String fileName) {
                                      super("Events-Handler");
                                      this.vm = vm;
                                      this.writer = writer;
                                      this.fileName = fileName;
                                  }
                               
                                  /**
                                   * Run the event handling thread.
                                   * As long as we are connected, get event sets off
                                   * the queue and dispatch the events within them.
                                   */
                                  public  void  run() {
                                       //
                                       final EventQueue queue = vm.eventQueue(); 
                                       while (connected) {
                                          try {
                                              EventSet eventSet = queue.remove();
                                                  for(Event e: eventSet)
                                                                          handleEvent(e);
                                               eventSet.resume();
                                               } catch (InterruptedException exc) {
                                                   //System.out.println("3");// Ignore
                                               } catch (VMDisconnectedException discExc) {
                                                    //System.out.println("4 ------------- VM Disconnected --------------");                 
                                                   break;
                                               } catch (Throwable exc) {
                                                    //System.out.println("Throwable exception...");
                                                    exc.printStackTrace (System.err);
                                                    break;
                                       }
                                      }
                                     // printMyVector();     
                                  }
                                 
                                ///////////////////////////////////////////////////////////////////////////////
                                 void setEventRequests(boolean watchFields) {
                                      EventRequestManager mgr = vm.eventRequestManager();
                              
                                      // want all exceptions
                                      ExceptionRequest excReq = mgr.createExceptionRequest(null, 
                                                                                           true, true); 
                                      // suspend so we can step
                                      excReq.setSuspendPolicy(EventRequest.SUSPEND_ALL);
                                      excReq.enable();
                              
                                      MethodEntryRequest menr = mgr.createMethodEntryRequest();
                                      for (int i=0; i<excludes.length; ++i) {
                                          menr.addClassExclusionFilter(excludes);
                              }
                              menr.setSuspendPolicy(EventRequest.SUSPEND_NONE); // change from NONE to ALL
                              menr.enable();

                              MethodExitRequest mexr = mgr.createMethodExitRequest();
                              for (int i=0; i<excludes.length; ++i) {
                              mexr.addClassExclusionFilter(excludes[i]);
                              }
                              mexr.setSuspendPolicy(EventRequest.SUSPEND_NONE);
                              mexr.enable();

                              ThreadDeathRequest tdr = mgr.createThreadDeathRequest();
                                   // Make sure we sync on thread death
                              tdr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
                              tdr.enable();

                                   if (watchFields) {
                                   ClassPrepareRequest cpr = mgr.createClassPrepareRequest();
                                   for (int i=0; i<excludes.length; ++i) {
                                        cpr.addClassExclusionFilter(excludes[i]);
                                   }
                                   cpr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
                                   cpr.enable();
                                   }
                              }

                              /*********************** Method Entry ******************/
                              /*** Forward event for thread specific processing*******/
                              private void methodEntryEvent(MethodEntryEvent event) {
                              threadTrace(event.thread()).methodEntryEvent(event);
                              }
                              /*********************** Method Exit ******************/
                              /* Forward event for thread specific processing *******/
                              private void methodExitEvent(MethodExitEvent event) {
                              threadTrace(event.thread()).methodExitEvent(event);
                              }
                              /////////////////////////////////////////////////////////////////
                                   /**
                              * This class keeps context on events in one thread.
                              * In this implementation, context is the indentation prefix.
                              **/
                              class ThreadTrace {
                              final ThreadReference thread;

                                   ThreadTrace(final ThreadReference thread) {
                              this.thread = thread;

                              // Create step event which will step through all lines

                              EventRequestManager mgr = vm.eventRequestManager();
                              StepRequest req = mgr.createStepRequest(thread,StepRequest.STEP_MIN, StepRequest.STEP_INTO);
                                                                      //StepRequest.STEP_INTO);//STEP_MIN
                                                                                //StepRequest.STEP_MIN, StepRequest.STEP_INTO);
                              // //STEP_MIN
                              //StepRequest.STEP_INTO StepRequest.STEP_OVER
                              req.setSuspendPolicy(EventRequest.SUSPEND_ALL);
                              String className= fileName.substring(0, fileName.length()-5);
                                   req.addClassFilter(className);
                              req.enable();

                                   }
                                   
                                   private void println(String str) {
                                        // for now do nothing
                                             writer.println(">> "+str);
                                        //TemplateApp.descriptionArea.append("Window output = "+str+"\n");     
                                   
                                   }
                              /////////////////////////////////////printStackFrame///////////////////////////////////////
                              void printStackFrame(StackFrame sf, StepInfo s) {
                                   try {
                                   
                                        for(LocalVariable localvar: sf.visibleVariables()) {
                                        Info i = new Info();
                                        i.setlType(localvar.typeName());
                                        i.setlName(localvar.name());
                                        i.setlVal(sf.getValue(localvar));
                                        
                                        s.addInfo(i);
                                        }
                                   } catch(AbsentInformationException e) {
                                        
                                   }
                                   
                                   }
                                   
                                   ///////////////////////////////////ThreadTrace-stepEvent////////////////////////////////////
                                   void stepEvent(StepEvent event) {
                                        
                                        //     println(" Method Step");
                                   try {
                                        if(!event.thread().frame(0).location().sourceName().equals(fileName))
                                        return;
                                   } catch(Exception e) {
                                        return;
                                   }
                                   
                                   si = new StepInfo();
                                   si.setType(0);
                                   si.setLocation(event.location().lineNumber());
                                   //println( "Event Location ="+event.location());
                                   try {
                                        StackFrame sf = event.thread().frame(0);
                                        si.setsfLineNumber(sf.location().lineNumber());
                                        si.setMethodName(sf.location().method().name());
                                        si.setSourceName(sf.location().sourceName());
                                        printStackFrame(sf, si);
                                        v.addElement(si);
                                   } catch(Exception e) {
                                        //println("Exception 1 "+ e);
                                   }
                                   }
                                   ///////////////////////////////////ThreadTrace-methodEntryEvent////////////////////////////////////
                                   void methodEntryEvent (MethodEntryEvent event) {
                                   //println(" Method Enter");
                              final Method method = event.method();
                              si = new StepInfo();
                                   si.setType(1); // method entry
                                   si.setLocation(event.location().lineNumber());
                                   si.setMethodName(event.method().name());
                                   si.setsfLineNumber(event.location().lineNumber());
                                   v.addElement(si);
                              }
                                   ///////////////////////////////////ThreadTrace-methodExitEvent////////////////////////////////////
                              void methodExitEvent (MethodExitEvent event) {
                              //println(" Method Exit");
                              final Method method = event.method();
                              si = new StepInfo();
                                   si.setType(2); // method entry
                                   si.setLocation(event.location().lineNumber());
                                   si.setMethodName(event.method().name());
                                   si.setsfLineNumber(event.location().lineNumber());
                                        v.addElement(si);
                              }
                              ///////////////////////////////////ThreadTrace-fieldWatchEvent////////////////////////////////////
                                   void fieldWatchEvent(ModificationWatchpointEvent event) {
                              Field field = event.field();
                              Value value = event.valueToBe();
                                   
                                   }
                                   
                              }
                              ////////////////////////////// end of ThreadTrace class ///////////////////////////////////////////////

                              /************************************************************
                              * Returns the ThreadTrace instance for the specified thread,
                              * creating one if needed.
                              ************************************************************/
                              ThreadTrace threadTrace(ThreadReference thread) {

                                   return (ThreadTrace)traceMap.get(thread);
                              }

                              /***************************
                              * Dispatch incoming events
                              **************************/
                              private void handleEvent(Event event) {
                                   //TemplateApp.descriptionArea.append(" ** ----------------** Anew Event **--------------------**\n");
                                   if (event instanceof MethodEntryEvent) {
                              methodEntryEvent((MethodEntryEvent)event);
                                   } else
                              • 27. Re: Error in creating JAR file ( Code Provided ) Please help
                                793982
                                I've already told you about this on reply 9. Where is the package line on all your classes?
                                package transpackage;
                                /**
                                 * @(#)JavaTrans.java
                                 * JavaTransTest application
                                 * @author I. Alansari
                                 * @version 1.00 2008/3/12
                                 */
                                 
                                 
                                import java.io.*; 
                                import java.text.*;
                                package transpackage;
                                import java.io.*;
                                import java.util.*; 
                                import com.sun.jdi.*;
                                import com.sun.jdi.request.*;
                                import com.sun.jdi.event.*;
                                import com.sun.jdi.connect.*;
                                import java.util.Vector;
                                 
                                 
                                class EventThread extends Thread {
                                package transpackage;
                                import com.sun.jdi.*;
                                 
                                class Info{
                                     String ltype;
                                package transpackage;
                                import java.util.*; 
                                class StepInfo{
                                     private int type;
                                package transpackage;
                                /**
                                 * StreamRedirectThread is a thread which copies it's input to
                                 * it's output and terminates when it completes.
                                 */
                                 
                                 
                                import java.io.*;
                                Insert the "package line" as the 1st line of all your files, as I showed. Save, compile and jar it again.

                                Regards,
                                Henrique Abreu
                                • 28. Re: Error in creating JAR file (Steps Taken)
                                  807589
                                  Thanks a lot for taking the effort to help me. I really appricate it. I did removed the package to make it simple.
                                  Any way the reality is I did every step you have told me and until the last step, Every step worked fine, but did not to work. I do not know why?

                                  Here is what I did, please take a look at it and let me know if I missed anything:

                                  1- I have did 2 different dirs and one called source ( for source files ) and the other called classes and under each directory I put transpackage dir
                                  2- I did the compiltion part and it worked perfectly and the classes is generated through the compilation under the command line.
                                  3- I moved the dos prompt to the C:\myproject\classes\ dir and typed

                                     jar -cvf mj.jar trandpackage.JavaTrans 
                                  The output was:
                                     added manifest
                                     a dding: trandpackage.JavaTrans(in = 345) (out= 189)(deflated 45%)
                                  4- the jar file created, but the error is
                                  Failed to Load Main-Class manifest attribute from c:\myproject\classes mj.jar
                                  5- I wrote my own with the main class name on it manifest.mft and update the jar manifest with the command
                                   jar cmf mj.jar manifest.mft
                                  I cheked the updated manifest and it contains the following: ( I used jar -xf mj.jar to see it )
                                      Manifest-Version: 1.0
                                      Class-Path: C:\Program Files\Java\jdk1.6.0_05\lib\tools.jar C:\Program
                                      Files\Java\jdk1.6.0_05\demo\jpda\com\sun\tools\example\debug\bdi C:\
                                      Program Files\Java\jdk1.6.0_05\demo\jpda\examples.jar C:\Program File
                                      s\Java\jdk1.6.0_05\jre\lib\ext\localedata.jar C:\Program Files\Java\j
                                      dk1.6.0_05\jre\lib\ext\sunjce_provider.jar C:\Program Files\Java\jdk1
                                      .6.0_05\jre\lib\ext\sunmscapi.jar C:\Program Files\Java\jdk1.6.0_05\j
                                      re\lib\ext\sunpkcs11.jar
                                      Created-By: 1.5.0_07 (Sun Microsystems Inc.)
                                      Main-Class: transpackage.JavaTrans
                                  6- Now with double click on the mj.jar the error is:
                                  Could not find the main class, the program will exit
                                  Any idea why this happen!
                                  • 29. Re: Error in creating JAR file (Steps Taken)
                                    793982
                                    Iman_S wrote:
                                    Thanks a lot for taking the effort to help me. I really appricate it. I did removed the package to make it simple.
                                    Your post has *1108 lines* and you removed _5 lines_ to "make it simple"?

                                    Anyway, I did copied all of your code, compiled and jar it successfully.
                                    My commands and classpath are a bit different because I'm using Linux.
                                    But it seems that your manifest file is wrong, there is no semicolon between jars.
                                    Take a look at [Sun's tutorial|http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html].

                                    Regards,
                                    Henrique Abreu

                                    Edited by: henrique.abreu on 17/10/2008 13:38