class - ClassNotFoundException Sandwich.Java... where is it? -


Ok then I have a file named 'Sandwich.java' in the root folder and one named 'SandwichType.java' The file is [root] / a folder on MyFrstPkg for whatever reason it will not be claimed that the sandwich. Java can not be found. Here is the directory structure:

  root - | | - sandwich.java | | -MyFirstPkg | | SandwichType.Java   

Here is Sandwich.java:

  // Note I also tried to add a package MyFrstPkg; Also in this file and the removal of the major MyFrstPkg is imported from the import statement below, there is still no luck importing MyFrstPkg.SandwichType; // part of 'MyFrustPCG' is outlined as an error class sandwich (sandwich type type; // text 'sandwich type'), an error was highlighted as public static zero main (string [] args {Sandwich sndwch1 = new sandwich (); Sndwch1.type = sandwich type. Ham; // text 'sandwich type' is outlined as an error System.out.println ("AHM cost $" + Sndwch1.type .getCost ()); System.out.println ("and" + sndwch1.type.getSlices () + "slice.")}}}   

And here is SandwichType.java:

  Package MyFrstPkg; Enum Sandwich Type (HAM (0,0 F); Sandwich Type (Intro Nuslides, Float Cost) {// Constructor - Ryan 'numslices' in 'numSlices' Changed.NumSlices = numSlices; This.cost = cost;} // and constructor private intranets; // These are specific for private float costs; // enum class ... public int getSlices () {return numSlices;} Public Float getCost () {Return Cost; /}>   

I browse CMD at the root area and Java sandwich. Java 'and what I get is a class notfound aception sandwich. Java, why not get it? IT ISLL D:

To compile your class,

  Javac sandwich.java   

If it does not return an error message, you should be able to call

  Java sandwich  < / Pre> 

> To start your program.


If works without prior error, we are one step forward. If the other does not work, try it instead:

  java -cp Sandwich   

If it works in this way, then you have set some incorrect classpoints. Type resonance% CLASSPATH% and post results. (Normally you should not need the CLASSPATH variable at all for simple projects.)

Comments