I am facing problems compiling and running classes, I have created in
packages.
I have the following files, in the same package knowledgebase.
All the 3 files have the package call. (package knowledgebase ;)
1. KnowledgeBase.java (main class)
2. MyPanel.java
3. TestPanel.java
The directory structure is: C:\java\KnowledgeBase\knowledgebase\
Query-1:
=========
I am trying to compile and run the classes using
javac -classpath \knowledgebase knowledgebase\KnowledgeBase.java ,
- but it is giving error for all the instances of the other classes:
MyPanel and TestPanel.
I was able to make this work using:
javac -classpath \knowledgebase knowledgebase\*.java
Does anyone know why this is happening, what is the correct way to
compile it.
Query-2:
========
java -classpath \knowledgebase knowledgebase\KnowledgeBase - gives a
runtime exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
KnowledgeBase (wrongname: knowledgebase/KnowledgeBase)
[Loaded java.lang.StackTraceElement from C:\Program
Files\Java\j2re1.4.2_05\lib\
rt.jar]