I have gotten my program to compile but it will not run: here is the error:
init:
deps-jar:
Compiling 1 source file to C:\NetBeansProjects\SCHOOL1\JavaApplication27\build\classes
compile-single:
run-single:
java.lang.NoClassDefFoundError: javaapplication27/FGInventory2
Caused by: java.lang.ClassNotFoundException: javaapplication27.FGInventory2
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"
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

class Product implements Comparable
{
		private long itemNumber;    // class variable that stores the item number
		private String itemName;    // class variable that stores the item name
		private long invQuantity;   // class variable that stores the quantity in stock
		private double itemPrice;   // class variable that stores the item price
			
			public Product(long number, String name, long quantity, double price) // Constructor for the Supplies class
				{
					itemNumber = number;
					itemName = name;
					invQuantity = quantity;
					itemPrice = price;
				}
				
			public void setItemNumber(long number)  // Method to set the item number
				{
					this.itemNumber = number;
				}
				
			public long getItemNumber()  // Method to get the item number
				{
					return itemNumber;
				}
				
			public void setItemName(String name)  // Method to set the item name
				{
					this.itemName = name;
				}
				
			public String getItemName()  // Method to get the item name
				{
					return itemName;
				}
				
			public void setinvQuantity(long quantity)  // Method to set the quantity in stock
				{
					invQuantity = quantity;
				}
				
			public long getInvQuantity()  // Method to get the quantity in stock
				{
					return invQuantity;
				}
				
			public void setItemPrice(double price)  // Method to set the item price
				{
					this.itemPrice = price;
				}
				
			public double getItemPrice()  // Method to get the item price
				{
					return itemPrice;
				}
				
			public double calculateInventoryValue()  // Method to calculate the value of the inventory
				{
					return itemPrice * invQuantity;
				}
			
			public int compareTo(Object o)
				{
					Product p = null;
						try
							{
								p = (Product) o;
							}
						
						catch (ClassCastException cE)
							{
								cE.printStackTrace();
							}
						
						return itemName.compareTo(p.getItemName());
				}
 
			public String toString()
				{
					return "Item #: " + itemNumber + "\nName: " + itemName + "\nQuantity: " + invQuantity + "\nPrice: $" + itemPrice + "\nValue: $" + calculateInventoryValue();
				}
}  //end class Product



		
 class FGInventory

	{
		Product[] supplies;
		
		public static void main(String[] args)
			{
				FGInventory inventory = new FGInventory();
                                
				inventory.addProduct (new Product (1001, "Megaforce", 10, 18.95));
				inventory.addProduct(new Product(502, "Abyss", 25, 12.95));
				inventory.addProduct(new Product(1003, "Deep Impact", 65, 21.95));
				inventory.addProduct(new Product(750, "Forest Gump", 28, 7.95));
 
				System.out.println(); // blank line
				System.out.println("Welcome to DVD Inventory 1.0"); //display header
				inventory.sortByName(); //sort list by name
				System.out.println(); // blank line
				inventory.showInventory(); //display inventory
 
				double total = inventory.calculateTotalInventory();
				System.out.println("Total Value is: $" + total);
 
			}
 
		public void sortByName()
			{
				for (int i = 1; i < supplies.length; i++)
					{
						int j;
						Product val = supplies[i];
						for (j = i - 1; j > -1; j--)
							{
								Product temp = supplies[j];
								if (temp.compareTo(val) <= 0)
									{
									break;
									}
								supplies[j + 1] = temp;
							}
						supplies[j + 1] = val;
					}
			}
 
		public String toString() //creates a String representation of the array of products
			{
				String s = "";
				for (Product p : supplies)
					{
						s = s + p.toString();
						s = s + "\n\n";
					}
				return s;
			}
 
		public void addProduct(Product p1) //Increases the size of the array
			{
				if (supplies == null)
					{
						supplies = new Product[0];
					}
				Product[] p = supplies; //Copy all products into p first
				Product[] temp = new Product[p.length + 1]; //create bigger array
				for (int i = 0; i < p.length; i++)
					{
						temp[i] = p[i];
					}
				temp[(temp.length - 1)] = p1; //add the new product at the last position
				supplies = temp;
			}
 
		public double calculateTotalInventory() //sorting the array using Bubble Sort
			{
				double total = 0.0;
				for (int i = 0; i < supplies.length; i++)
					{
						total = total + supplies[i].calculateInventoryValue();
					}
				return total;
			}
 
		public void showInventory()
		{
			System.out.println(toString()); //call our toString method
		}
		
	} //end Class FGInventory2

could you use the code tags a bit better? it's easier to read if we know where one file ends an the other begins

ran fine for me, i made one change so i could run it from Bluej i left it all in one file, but i made FGInventory public, and it didn't throw any errors when i ran main()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.