Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error running sample program in jGRASP

843785Sep 7 2008 — edited Sep 8 2008
My data structures teacher posted a sample program for our first assignment, however I'm having a problem running it. I'm using jGRASP and when I run it, I get this error:
 ----jGRASP exec: java Vendor

java.lang.NoClassDefFoundError: Vendor
Caused by: java.lang.ClassNotFoundException: Vendor
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Exception in thread "main" 
 ----jGRASP wedge2: exit code for process is 1.
 ----jGRASP: operation complete.
He ran it in class in the command line along with some qualifiers that I don't remember and it worked. Here's the main class, I don't know if I should post the rest of the code because it's pretty long but if anyone needs it, tell me and I will post it.
public class Vendor 
{ Item something; 

  public static void main(String[] args) throws Exception
  {  
    String name = "";
    double price = 0;
    int quantity = 0;
    Item something;
    LinkedList<Item> products = new LinkedList<Item>(); // create an empty list of Items 
    try {   
            FileReader fr = new FileReader("input.txt");
            BufferedReader br = new BufferedReader(fr);
            String inLine = br.readLine();
            System.out.println("\n Reading and Echo-printing the input file\n");

            while ( inLine != null)
              { StringTokenizer st = new StringTokenizer(inLine);           
                name = st.nextToken();
                price = Double.parseDouble(st.nextToken());
                quantity = Integer.parseInt(st.nextToken());
                something = new Item(name, price, quantity);
		something.showItem();
                products.addElement(something);
                inLine = br.readLine();
              }         
            fr.close();
         } catch (FileNotFoundException fnfe)
            { System.out.println ("Cannot find input file.");
            }
           catch (IOException ioe)
            { System.out.println(ioe.toString ());
            }

     LinkedListIterator<Item> scanner = new LinkedListIterator(products);
     System.out.println("\n Here are the products stored in the Linked List\n");
     while (scanner.hasNext())
       { scanner.nextElement().showItem();
       }

     System.out.println("\n *** Program Finished ***");
How can I get this to run in jGRASP?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 6 2008
Added on Sep 7 2008
6 comments
4,035 views