1

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?

1
  • 1
    It's hard to tell without even knowing anything about the java and scala code in question. You'll want to provide more information if you expect any ojective answer. Commented Mar 7, 2013 at 21:17

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. It looks like that worked. I'm a bit embarrassed because I checked all the classes for private and didn't see it before asking the question, but they were all set to default visibility.
no problem here, i finally get some points, quite a few questions answered few accepted. thx for accepting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.