Lift Framework with Eclipse IDE errors - scala

I am trying out Lift Framework, however I am unable to get it working properly with eclipse.
I get the following error:
import org.eclipse.jetty.server.handler.ContextHandler
import org.eclipse.jetty.server.nio.SelectChannelConnector
import org.eclipse.jetty.server.{Handler, Server}
import org.eclipse.jetty.webapp.WebAppContext
object eclipse is not a member of package org on resource: RunWebApp.scala

Your classpath is incomplete. How do you import the project in Eclipse? Are you using Sbt and one of the plugins for exporting an Eclipse project?
Check out this tutorial on the Scala IDE website: Setup and use Lift framework 2.4 in Scala IDE 2.0.

Related

Cannot import external JAVA library using Jython in Eclipse

I'm new to Jython and to Eclipse. I'm trying to use the JGraphX JAVA library. I've created a new PyDev project and package. I've right-clicked on the project properties in Eclipse, selected "PyDev - PYTHONPATH" and added jgraphx.jar. In the init.py file, I've tried:
import jgraphx as jgx
from jgraphx import *
Neither approach works. The code is underlined as an error in Eclipse. When I run, I get "ImportError: No module named jgraphx". What am I doing wrong?
Thank you,
-david
I'm not familiar with the JGraphX library.
To import a java class
you need to use from my.project.package import someclass

Scala IDE: method XXXX is defined twice conflicting symbols both originated in file

I just downloaded the Scala eclipse IDE but am getting some errors after importing my project
method getTableConfig is defined twice conflicting symbols both originated in file '....'
Here is the sample code, any reason why this error pops up - code compiled successfully though
package com.mavencode.app.config
import java.io.{BufferedReader, File, InputStream, InputStreamReader}
import ...
object ConfigUtil
{
def getTableConfig(configKey:String) (implicit config: Config) : ConnectionConfig = {
val report: Config = config.getConfig(s"tables.$configKey")
val db: Config = config.getConfig(s"db.${report.getString("db")}")
ConnectionConfig(
db.getString("host"),
db.getInt("port"),
db.getString("database"),
similarity.getString("table"),
db.getString("user"),
db.getString("password"),
report.getInt("lowerBound"),
report.getInt("upperBound"),
report.getInt("numPartitions")
)
}
I think it's a bug in the latest version of Scala IDE I downloaded, I opened my project on an older scala IDE and it worked fine
Bug with this version
Scala IDE build of Eclipse SDK
Build id: 4.5.0-vfinal-2016-12-13T10:59:29Z-Typesafe
Worked on older version
Scala IDE build of Eclipse SDK
Build id: 4.4.1-vfinal-2016-05-04T11:16:00Z-Typesafe
There is a Scala project creating wizard coming with the Scala-ide. This does not work so well with SBT. If you are using SBT you are better off creating the Scala project yourself. You can use Giter8 for that. Here are the Giter8 templates:
https://github.com/foundweekends/giter8/wiki/giter8-templates
Then generate the Eclipse project using the Sbt Eclipse plugin:
https://github.com/typesafehub/sbteclipse
Run
sbt eclipse
Import the existing project into Eclipse
Here is a more detailed description of the process:
http://www.nodalpoint.com/development-and-deployment-of-spark-applications-with-scala-eclipse-and-sbt-part-1-installation-configuration/

Eclipse says "apache is not a member of package org"

I am using Scala on Eclipse Luna and trying to connect to Cassandra. My code is showing the error apache object is not a member of package org on the following line:
import org.apache.spark.SparkConf
I already imported the Scala and Spark libraries into the project. Does someone know how can I make my program import Spark libraries?

import scala.io.StdIn

I'm using Eclipse ScalaIDE and for some reason I'm not able to
import scala.io.StdIn
I'm getting a red squiggly that tells me:
object StdIn is not a member of package io
And I'm seeing that it's not in that scala.io jar file. The ScalaDoc, however says it should be there. I've tried both scala 2.10.4 and 2.11.5. I've used the Eclipse ScalaIDE to create the scala project and I've also created an sbt eclipse project directly using the scalasbt.plugin which I use all the time to manage ScalaIDE dependencies.
sbt "eclipse with-source=true"
Neither way is getting it.
I'm currently taking the Coursera Reactive Programming course and an assignment file has this import. I'm able do compile the project with sbt directly, but Eclipse ScalaIDE is not doing the job. Any clues? There may be good reason why not to use scala.io.StdIn, but my question is why can I not get it to import in the ScalaIDE?
thank you
scala.io.StdIn is new in scala 2.11.x and does not exist in previous versions.
The problem you are likely encountering is that ScalaIDE is not picking up the scala version you are specifying. Since you say that you tried it with 2.10.4, it probably still has that cached or set somewhere and it's failing because it cannot find the specified class.

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.