Compiling scala files inside their package folder from Command Line -
i trying compile scala files inside package folders. have 3 files, patient.scala, patientmonitor.scala, , vitalsigns.scala, reside in following path gasguru/patient/
here file vitalsigns.scala
// /gasguru/patient/vitalsigns.scala package gasguru.patient class vitalsigns () { var heartrate = 0; } and compile following line: scalac -d ../.. vitalsigns.scala results in vitalsigns.class file being created in same directory in.
now if go compile patient.scala contains this:
// /gasguru/patient/patient.scala import gasguru.patient.vitalsigns; package gasguru.patient { class patient ( val firstname:string, val lastname:string) { val vitalsigns = new vitalsigns(); } } and if try , compile following line: scalac -d ../.. patient.scala following error
patient.scala:2: error: vitalsigns not member of gasguru.patient import gasguru.patient.vitalsigns; ^ error: error while loading vitalsigns, missing dependency 'class gasguru.patient.vitalsigns', required ./vitalsigns.class patient.scala:6: error: vitalsigns not have constructor val vitalsigns = new vitalsigns(); ^ 3 errors found why getting error when vitalsigns.class resides inside of same directory compiling file? shouldn't importing suffice?
thanks!
edit:
chs@ubuntu:~/gasguru/gasguru/patient$ ls exceptions patient.scala vitalsigns.scala patientmonitor.scala vitalsigns.class
you not passing source file of vitalsigns.scala parameter, try search classfile. classfile of class in package x.y under directory x/y, means trying find gasguru/patient/vitalsigns.class, not exist in current directory at.
if add -classpath ../.., should find file.
Comments
Post a Comment