kbirk
kbirk

Reputation: 4022

Adding jar to scala classpath, object is not member of package

I'm trying to use kyro serialization with scala. I've included the .jar in the classpath.

scalac -classpath *.jar *.scala

Which gave me an error about dependency libraries:

$ scalac -classpath "*.jar" *.scala
warning: Class org.objenesis.strategy.InstantiatorStrategy not found - continuing with a stub.
error: error while loading Kryo, class file 'kryo-2.23.1-SNAPSHOT.jar(com/esotericsoftware/kryo/Kryo.class)' is broken
(class java.lang.NullPointerException/null)
one warning found
one error found

I included those as well:

scalac -classpath "*.jar:lib/*.jar" *.scala

Now I have this error:

$ scalac -classpath "*.jar:lib/*.jar" *.scala
test.scala:2: error: object esotericsoftware is not a member of package com
import com.esotericsoftware.kryo.Kryo
       ^
test.scala:7: error: not found: type Kryo
        val kryo = new Kryo
                       ^
two errors found

Attempting to compile a java file using the .jar is fine:

javac -classpath *.jar *.java

Why is scala giving me so much trouble?

Upvotes: 1

Views: 1202

Answers (1)

som-snytt
som-snytt

Reputation: 39577

Use -verbose to see the class path seen by scalac, and where classes are loaded from.

More of a suggestion than an answer.

Upvotes: 2

Related Questions