views:

301

answers:

2

I have a package called studentServer which contains two sub packages student and common. The common folder has references to the student package and i would like to be able to compile this. How could i do this?

javac student\*.java - compiles the student package

but when i try something similar with the common package errors are thrown - I understand it's something to do with the classpath

javac -verbose -classpath "\student" common\*.java

But i couldn't get this working. Any help would be great.

http://pastebin.com/m2a2f5d5d - here's the output from the compiler

+1  A: 

This is a bit vague, but I suspect the classpath for the student code is wrong. Try without the leading backslash.

unwind
+1  A: 

If you have a directory structure

source/
      studentServer/
                   student/
                   common/
classes/

And you're in the directory above source, then you want to set the source path to 'source' with the -sourcepath option. You probably also want to use the -d option to tell javac where to put the compiled classes, so they aren't all mixed up with the source:

java -d classes -sourcepath source source/studentServer/student/*.java source/studentServer/common/*.java
Pete Kirkham