play framework 2.1.1 - package com.restfb does not exist - eclipse

I'm using play framework 2.1.1, and I want to add to a project restfb in order to use Facebook graph.
I added restfb-1.9.0.JAR to eclipse, then I right clicked on it, and chose build path->add to build path.
However when I'm trying to write some code, and use the restfb package, I'm getting an error code on the browser.
This is the error:
error: package com.restfb does not exist
On the line:
import com.restfb.FacebookClient;
Any idea on how I can fix this?
Thanks

Copy your libraries into the lib folder in your project folder. If the lib-folder does not exist, create it.
The Play Framework includes all jars in the lib-folder when building/compiling your app. Adding it to the eclipse-build-path is not enough.

Related

how to add .bundle file to a nativescript plugin

I have some thirdparty code I want to add to my nativescript (iOS) project. The code consists of a .framework file and a .bundle file which contains a .momd file. I was thinking of adding this via a custom plugin, the docs are pretty clear on how to add the .framework file, but am not sure how I add and reference the bundle and underlying .momd file. Does anyone have any experience of this that they can share please?
I spent a lot of time poring over the iOS interop documentation while working on my nativescript-midi plugin, but I don't recall seeing anything specifically on adding bundles or .momd files. If possible, I suggest you create a new "container" iOS framework project in which you can import your desired framework, bundle, and .momd file, and then import that combined framework project into your plugin via a Podfile. That's essentially the approach I took to import a C library in my project (the cocoa-midi-message-parser repo referenced by the Podfile in my plugin).
In case anyone else needs to do this. I ended up using cocoapods xcodeproj gem to inject my file into my workspace file. A gist of the working code is here.

Resolving Controllers via routes for imported Play 2.4.x project in IntelliJ

I'm trying to import any Play project (usually from activator) into IntelliJ and each time I end up with Controllers not being resolved, i.e. you go to conf/routes and routes.ApplicationController shows up red and inside any Controller completion for routes. shows no controllers.
The projects do compile in, and even run from IntelliJ, but compiled routes just aren't picked up.
I don't know if it's related, but on project load I always get the following message:
SBT compilation for play framework 2.x disabled by default
But even if I go into the Languages & Frameworks setup and tell it to use the Play 2 compiler, the routes are not affected.
Hüseyin Zengin is right. The activator plugin which generates the .idea directory and metadata is no longer 'the way'.
The truth is it doesn't work perfectly out of the box and your best bet is to get on the latest versions of all three. This means using the Early Access Program version of Intellij.
This largely depends on the versions of Play!, Intellij and the Scala (formerly Play) plugin.
If you can't do that or still get the problem anyway then following these steps might help:
Open your Play! 2.x project in Intellij
Open Module Settings F4
In the Root Source Settings navigate the directory structure.
Add the main directory at
target/scala-/routes/main
to the Source Folders list. Right clicking the main folder and selecting Sources is one way to do this.

Intellij IDEA 14.1: Play Framework 2.3.8 Scala project import issue

I have created a Play framework 2.3.8 (Scala) project successfully, and ran it successfully as well. I just installed Intellij IDEA 14.1 and installed the Scala plugin during installation too. I am now trying to import the created project into the IDE; but I just can't find any guides to get me through it. I am stuck here, as the images there show you. Any comprehensive help would be very much appreciated. Should I download anything further than what the default procedure does during the project creation with the Play Framework? If not, how do I set up the settings on the screen shown in the images on the page at the link provided above.
See the "\bin\bin" in the error message? It looks like you should remove the \bin from the path to the JVM - it should be just c:\program files\java\jdk1.8.0_40.

Errors in Eclipse for Scala project generated by Play Framework

I would like to use Eclipse as IDE for a Scala web application using Play Framework. I downloaded Eclipse 3.6.2. Then I installed Scala IDE 2.0 (beta) for Eclipse. I downloaded Play Framework 1.2.2RC1 and installed the Scala Module using play install scala-0.9.1 and generated a new site with play new mysite. Then I eclipsified it with play eclipsify mysite and imported the project in Eclipse.
But now I get many errors in Eclipse. Is this anything I can fix or are the different projects incompatible?
This is the generated code that contains errors in Eclipse (but it works when I run the application).
package controllers
import play._
import play.mvc._
object Application extends Controller {
import views.Application._
def index = {
html.index("Your Scala application is ready to go home!")
}
}
And this is how it looks like in Eclipse:
The error shown highlighted in your screenshot is caused by the new Scala template sources not being in the project Build Path. The eclipsify command doesn't currently do this for you.
Manually add tmp/classes to the Build Path to resolve it.
But please note that new Scala template files are not generated from within Eclipse. So if you add a new template/page to your project, you must run 'play run' (or equivalent) first to have the file appear there. Also note that if you run the eclipsify command again in the future you will need to re-add this folder to your Build Path.
It seems that eclipse thinks that your views package is empty. Did you try to refresh project via F5 command?

Eclipse cannot find Twitter class in twitter4j

I'm using the twitter4j 2.1.11 jar, but Eclipse doesn't seem to be able to find classes within it. I added the jar as a referenced library, but get Twitter cannot be resolved to a type when trying to use it. I can add imports like import twitter4j.* but not import twitter4j.Twitter.
I can tell the class is available as it is present when I open the jar in an archive viewer. How can I get Eclipse to behave?
The problem I was having was that I was importing the wrong archive, specifically the sources archive rather than the one found in /lib of the twitter4j download.