ClassNotFound Error when compiling multiple object classes

I have a Store class which is an array of Person; I have a Person, Date, Student, Undergraduate and Postgraduate classes. Everything runs in Eclipse, and I have to run this from the Command Line. I've copied the src files and tried to run the main program, but it's just saying it can't find any of my classes. They are all in the same folder and in every class I have assigned the package. I've looked up importing classes and I tried:

    import oopinterface.Person;

etc for all classes.

Is there any way I can compile the main program so it will recognise the class files that are very clearly there!? I'm on Windows, but it would help if I could have the 'other' way for Linux?

This is the Compiler error:

   C:\Users\Liloka\Source\oopinterface>javac cannot find symbol
   symbol  : class Store
   location: class oopinterface.ContainerInterface
            Store myList = new Store();

   //Instance of Store
                    ^ cannot find symbol
   symbol  : class Person
   location: class oopinterface.ContainerInterface
            public Person getSupervisor()

.. it goes on to pick at every method in other classes.. (39) Thank you in advance!


It looks like your classes are in the package oopinterface. Compile the source files from the base directory of the package, like this:

C:\Users\Liloka\Source> javac oopinterface\

If you have the CLASSPATH environment variable set, then make sure that it is not set, or add the base directory of the package where the compiled class files can be found to the classpath. You can also use the -cp or -classpath option to tell javac where to find the compiled class files.

Do all your source files have a package oopinterface; at the top of the file?

After compiling, to run the program from the command line do something like this:

java -cp C:\Users\Liloka\Source oopinterface.MainClass

where MainClass is the class that contains the public static void main(String[] args) method. (This assumes that your compiled class files are in the same directory as the sources).

Need Your Help

command not found error on MacOS

java osx google-app-engine terminal

When I do ls , my command is listed. So it means I'm on correct path.

SQL Server: How to convert column into one row?

sql sql-server sql-server-2005 sql-server-2008 pivot

I have one column with different values depending on result.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.