How to import com.sun.tools.javac.code.Attribute to kotlin module? - annotations

I'm writing annotation processor in Kotlin. It works, but I can not import com.sun.tools.javac.code.Attribute class: Andtoid Strudio shows me it correctly, but during compilation I get Unresolved reference: tools at import line.
What I need to import?
Now this module imports only kotlin-stdlib and kotlinpoet.

You need to add tools.jar from the JDK to the dependencies of your module:
compile files("${System.properties['java.home']}/../lib/tools.jar")

Related

Scala + Playframework 2.3.X importing dependencies

I am having problems importing two dependencies here is the import
import io.GooglePlayClient
import io.GooglePlayError
and I get this error
object GooglePlayError is not a member of package akka.io
[error] import io.GooglePlayError
object GooglePlayClient is not a member of package akka.io
[error] import io.GooglePlayClient
It seems it is prefixing the package where I am trying to import (akka) to this imports, and the is not able to import.
Thank you
You already have akka.io imported in scope. So, akka.io.GooglePlayError is tried. Instead use import _root_.io.GooglePlayError.
Another option is to import using the fully qualified name of the dependencies if available, that is
import com.yourcompany.io.GooglePlayClient
import com.yourcompany.io.GooglePlayError
If the io package is really a root package, you could consider refactoring your package structure to something like the above.

import scala.swing._ in eclipse giving an error that it is not a member of package scala

Does anybody have any experience with trying to get swing to work in eclipse, I can import it fine into scala using the command line interface, but when i try and use it in an eclipse scala project I get the following error:
import scala.swing._
"object swing is not a member of package scala"
Any help would be much appreciated.
If you are missing the library (as RĂ¼diger said, it is a separate dependency now), you can find how to add it to your build system here (for Scala 2.11):
http://search.maven.org/#artifactdetails|org.scala-lang.modules|scala-swing_2.11|1.0.1|bundle
Look under "Dependency Information", e.g. for sbt if you use that.

Can't find some Akka libs in Eclips

I have recently started exploring Scala.
I have installed Eclips and I integrated Akka-Actors Libs in the Build-Path Project.
But whenever I try compiling the project, I got an erorr. I can't resolve such libraries.
import akka.routing.{Routing, CyclicIterator}
import Routing._
Any idea how to configure Akka to work perfectly with Eclips ?
AFAICT, there's no such class in Akka.
Router, yes - Routing, no.
I have the same problem, I have Added the akka-actor_2.10-2.3.0.jar and the config-1.0.2.jar libraries but the error persists.
In the webpage of akka (akka.io) they use both imports in a example proyect.
http://doc.akka.io/docs/akka/1.3/intro/getting-started-first-scala.html
package akka.tutorial.first.scala
import akka.actor.{Actor, PoisonPill}
import Actor._
import akka.routing.{Routing, CyclicIterator}
import Routing._
.....
.....
....
ANSWER: You should use spray and the spray's library, it has a routing method you can use aswell.
import spray.routing._
You have to download the spray-routing-1.2.0.jar if you want to use it (http://repo.spray.io/io/spray/spray-routing/)

Cannot import Appengine modules in Eclipse

In my Eclipse project (GWT) I am trying to import the modules below, in order to add some Blobstore code.
import com.google.appengine.api.files.FileService;
import com.google.appengine.api.files.FileServiceFactory;
I don't get any error or warning from the Eclipse build function. Nevertheless, when I do "GWT compile" from Eclipse, I get the error messages below:
[ERROR] Line 3: The import com.google.appengine.api.files cannot be resolved
[ERROR] Line 4: The import com.google.appengine.api.files cannot be resolved
How can I sort it out? Thanks!
You cannot reference non-client code from your GWT client. Remember that your GWT client code will be compiled to Javascript, so any references to actual Java can't be compiled out.
Make sure any reference to the blobstore api is done in server code, not client. Those imports should never be necessary in code that must be compilable to javascript.

"is not a member of package" error when importing package in Scala with SBT

(Relative beginner here, please be gentle...)
I've got a Scala program that I can build with sbt. I can (from within sbt) run compile and test-compile with no errors. I've defined a package by putting package com.mycompany.mypackagename at the top of several .scala files. When I do console to get a Scala REPL, this happens:
scala> import com.mycompany.mypackagename._
<console>:5: error: value mypackagename is not a member of package com.mycompany
import com.mycompany.mypackagename._
Any variation of this also fails. When I just do import com.mycompany I get no problems.
I thought that running the Scala console from within sbt would properly set the classpath based on the current projects? What (completely obvious) thing am I missing?
I ran into this same problem, and then I realized I was running scala 2.10.0 on commandline, and IDEA was using Scala 2.9.2. So the fix was to change both to use the same version, and:
sbt clean
What will happen if you import actual class name instead of wildcard.
import com.mycompany.mypackagename.ActualClassName