Reputation:
I have Java files structure like:
Gadget.java
GadgetShop.java
Mobile.java
MP3Player.java
GadgetShop.java
file contains main method
package thegadgetshop;
import java.awt.Font;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
public class GadgetShop extends JFrame implements ActionListener
{
....
I used this command to run the file:
javac GadgetShop.java
And I got these errors:
GadgetShop.java:44: error: cannot find symbol
private ArrayList listGadgets;
^
symbol: class Gadget
location: class GadgetShop
GadgetShop.java:332: error: cannot find symbol
private Gadget getGadget(int displayNumber) {
^
symbol: class Gadget
location: class GadgetShop
GadgetShop.java:265: error: cannot find symbol
Mobile mobile = new Mobile(model, size, dPrice, iWeight, iCredit);
^
symbol: class Mobile
location: class GadgetShop
GadgetShop.java:265: error: cannot find symbol
Mobile mobile = new Mobile(model, size, dPrice, iWeight, iCredit);
^
symbol: class Mobile
location: class GadgetShop
GadgetShop.java:297: error: cannot find symbol
MP3Player mp3Payer = new MP3Player(model, size, dPrice, iWeight, iMemory);
^
symbol: class MP3Player
location: class GadgetShop
GadgetShop.java:297: error: cannot find symbol
MP3Player mp3Payer = new MP3Player(model, size, dPrice, iWeight, iMemory);
^
symbol: class MP3Player
location: class GadgetShop
GadgetShop.java:333: error: cannot find symbol
Gadget gadget = null;
^
symbol: class Gadget
location: class GadgetShop
GadgetShop.java:363: error: cannot find symbol
Gadget gadget = getGadget(iDisplayNumber);
^
symbol: class Gadget
location: class GadgetShop
GadgetShop.java:375: error: cannot find symbol
if (gadget instanceof Mobile) {
^
symbol: class Mobile
location: class GadgetShop
GadgetShop.java:376: error: cannot find symbol
Mobile mobile = (Mobile) gadget;
^
symbol: class Mobile
location: class GadgetShop
GadgetShop.java:376: error: cannot find symbol
Mobile mobile = (Mobile) gadget;
^
symbol: class Mobile
location: class GadgetShop
GadgetShop.java:382: error: cannot find symbol
if (gadget instanceof MP3Player) {
^
symbol: class MP3Player
location: class GadgetShop
GadgetShop.java:383: error: cannot find symbol
MP3Player mP3Player = (MP3Player) gadget;
^
symbol: class MP3Player
location: class GadgetShop
GadgetShop.java:383: error: cannot find symbol
MP3Player mP3Player = (MP3Player) gadget;
^
symbol: class MP3Player
location: class GadgetShop
GadgetShop.java:419: error: cannot find symbol
Gadget gadget = getGadget(iDisplayNumber);
^
symbol: class Gadget
location: class GadgetShop
GadgetShop.java:423: error: cannot find symbol
if(gadget instanceof Mobile) {
^
symbol: class Mobile
location: class GadgetShop
GadgetShop.java:425: error: cannot find symbol
Mobile mobile = (Mobile) gadget;
^
symbol: class Mobile
location: class GadgetShop
GadgetShop.java:425: error: cannot find symbol
Mobile mobile = (Mobile) gadget;
^
symbol: class Mobile
location: class GadgetShop
GadgetShop.java:466: error: cannot find symbol
Gadget gadget = getGadget(iDisplayNumber);
^
symbol: class Gadget
location: class GadgetShop
GadgetShop.java:470: error: cannot find symbol
if(gadget instanceof MP3Player) {
^
symbol: class MP3Player
location: class GadgetShop
GadgetShop.java:472: error: cannot find symbol
MP3Player mP3Player = (MP3Player) gadget;
^
symbol: class MP3Player
location: class GadgetShop
GadgetShop.java:472: error: cannot find symbol
MP3Player mP3Player = (MP3Player) gadget;
^
symbol: class MP3Player
location: class GadgetShop
Note: GadgetShop.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
22 errors
I don't know why its not compiling and running from CMD while its running fine in Netbeans. I really need to run it from CMD.
I also used this command but got same error:
javac -Xlint GadgetShop.java
I have this files structure in Netbeans:
And files and classes structure in folder directory:
Upvotes: 0
Views: 585