Tombstone
Tombstone

Reputation: 177

Scala cannot reference Java classes

I have a Java framework for a chess AI server. I'm planning on using Scala to write the logic for my chess AI. So I need to edit the "AI" class of the framework to call my Scala code.

My problem occurs when I try to reference a class from the java framework in Scala and I get an error that follows this pattern:

class * in package * cannot be accessed in package *

the most relevant thing I could find was this: What are the guarantees for scala access qualifiers? , however that doesn't help me at all.

next I found this: is it possible to have a circular dependency between .java and .scala classes? I'll try setting up a maven solution, but eventually I'll need to compile it using make, and run it using a shell script

Creating dummy classes seems like a poor solution. I don't want to keep editing the framework, recompiling it, and fixing any complaints it has about calling my Scala classes.

I'm a bit confused as to why this is a problem. I can call any native Java function using Java syntax, no problem. Why does this happen, even when I've put the framework in a jar and referenced it that way?

Upvotes: 1

Views: 207

Answers (1)

WestCoastProjects
WestCoastProjects

Reputation: 63032

It appears the particular class(es) are package private. Please make them public and then report back.

Upvotes: 3

Related Questions