Alan Coromano
Alan Coromano

Reputation: 26008

The name of a package conflicts with imported package

I have named my package in Scala application as 'org.myname.myproject'. Here is what I have in one of the source files:

package org.myname.myproject

import org.json.JSONObject
import org.myname.myproject.subnamespace.Class123
import scala.Exception

And sbt says that object json is not a member of package org, probably, because of first org in my package name.

What do I do about it? I don't want to rename the package just because I'd like to use org as a prefix in all my Scala/Java projects.

UPDATE:

build.sbt

name := "myproject"

version := "0.1"

scalaVersion := "2.10.1"

libraryDependencies += "org.json" % "json" % "20090211"

Upvotes: 1

Views: 707

Answers (1)

castarco
castarco

Reputation: 1376

I think the org.json.JSONObject is not in the main java packages. You should put the class in your classpath, using a jar or using directly the source code.

Upvotes: 1

Related Questions