I created a List.java
file in folder UtilityPack
which contains this code
package Utilities;
public class List
{
private class
You need the fully qualified name e.g.
java -cp . Utilities.List
i.e. you're telling the JVM to look from the current direct (-cp .
) for a class Utilities.List
, which it will expect in the file Utilities\List.class
.
To be more consistent you should put the .java file under a Utilities
directory (yes - this is tautologous - the package specifies this, but it's consistent practise).
I would also avoid calling your class List
. At some stage you're going to import a java.util.List
and it'll all get very confusing!
Finally, as soon as you get more than a couple of classes, investigate ant or another build tool, and separate your source
and target
directories.