What do I need to do to use Guice? - java

I want to learn Guice. I use eclipse.
What to download? What to install? What to do in eclipse to use guice?
Thanks.

You could start by following the installation guide for GuicePlugin (although that project doesn't seem very active sine April 2009):
peaberry is more up-to-date, and comes with a "Guide for using the peaberry bundle with OSGi".
If you don't need a special integration with Eclipse, all you need is the Guice2.0 release, referenced in the libraries of your project to get started.
alt text http://img682.imageshack.us/img682/2853/eclipseguice.png

Just download guice-2.0.zip from here and add guice-2.0.jar and aopalliance.jar to a project's classpath. Don't need anything special to use Guice.

I think you could have a look to peaberry
http://code.google.com/p/peaberry/

Related

There is a library on GitHub I would like to use in Java, It says I can use it by adding "dependency in your pom", what does this mean?

I am new to Java and would like to use this https://github.com/fintrace/tspl2-driver
What is a pom? I've seen some things online about it being related to Maven but I am confused on how I actually can get and use this library and how to use Maven. Do I need to install Maven to use this library?
Thank you,

Info about version dependancies of enterprise java libraries

I am new to enterprise application developement and trying to create a REST server with Spring REST, JPA taking to mySQL database and Javascript on the client side. As I see loads of opensource libraries doing specific task, I started off with using 'maven project' with different 'arch type' (which is nothing but predefined POM with relevent libraries as I understand) provided by Eclipse. But I often run into version mismatch issues, in many cases found specific solution to that perticular libraries in StackOverflow or other sites.
Hence I started looking for a information these version dependancies such as, this version of JPA works with that version of Hibernate library and so on. I checked maven repository of major libraries, I did not find such information so far.
My queries are:
Where can I find these information about the versions dependancies?
Are these pre defined POM in eclipse reliable? Who owns them, where can I get last modified dates on these maven 'arch types'? (I find the ones I choose having fairly old version of libraries).
If I have to start off on my own creating a Maven dependacies, where will I get information about what are the dependent libraries, for example, if I need spring MVC, for sure it needs java servlet library. I am worried becuase the maven 'spring-mvc-jap' arch type whooping 50 libaries as dependancies.(Coming from embeded domain, I find to too hard to digest :D). So not sure if it is the right way.
Please correct if I am missing anything in my understanding.
You can find this information, if you are using maven and some IDE you can go to the dependancy and make click un > and this will show the librarys used for this dependancy or if you want to use the console you have http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html this will show the same that the IDE.
After normally in the documentation of the library used, you can find some doc about the dependancy about this.
Other solution is get the .jar and use 7zip to see the POM and know the dependancy used.
And for finish my answer if the IDE tell you that you dont have x dependancy normally you have to add this because any of the other dependancy used have it (they used only for the compiling task), but sometime somes projet change a lots of code between the version .a to .b so you will have some problem using the version .b, at this moment i didnt find one good and easy way to fix this, only using the way that i told you (only if i found some problem in the compilation)
3> I am not sure how it works in eclipse but in IntelliJ IDEA when you start using some class without proper dependency IDEA suggest you to add proper dependency automatically. The same approach should be in eclipse.

Eclipse Plugin-Project bundle cannot be resolved [duplicate]

I've downloaded the code for an Eclipse plugin. The code uses log4j, but it doesn't just use it as a library (referred jar), but as a "bundle". So it doesn't compile because of the following reason:
Bundle 'org.apache.log4j' cannot be resolved
I'm not really sure what's the correct approach to solve this. I know how to add jars to a project, but how do I add "bundles"? Is it something I need to add to the entire Eclipse host?
I "solved" this by creating a new plugin project with no code but with the log4j jar included... but that doesn't feel like the right solution.
I've also found some places where "log4j bundles" are published, e.g.:
http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.log4j&version=1.2.16
http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/
But I'm not sure if that's what I need, if it matters where I get it from, and how to "install" it.
I assume you are using the Eclipse Plugin Development Environment (PDE). In this case, the log4j bundle needs to be imported into the "Target Platform".
The Target Platform is like a repository of bundles (i.e. plug-ins) that replaces the "classpath" in traditional Java development. You can find the location of the target platform and modify it by going to Preferences -> Plug-in Development -> Target Platform.
HOWEVER before doing this I strongly recommend you take some time to learn a bit about what you are working on! If you want to develop an Eclipse Plug-in you should at least learn what a plug-in is, and how its dependencies work. If you read a bit about the subject you should not have to ask such an extremely basic question on Stack Overflow... it is covered in all the introductory tutorials and FAQs.

netbeans find usages does not seem to scan xml files

Can anyone confirm this, or do I miss a check in a checkbox somewhere?
Example: When I go to a Java class and do a "Find Usages", it does not find a referance to the class, though it exists in a spring related xml-context file.
Can confirm this for Netbeans 7.2. And that's why some prefer Java spring config.
Try with this plugin: JohnBaker FindUsages, Spring Support for Find usages. Stock "find usages" from Netbeans doesn't support Spring.
There is also a generic Netbeans-Spring plugin.
Personally I use Eclipse with STS.

Implement Growl in Java Application

I want my Java application to make a growl notification. My IDEs are Eclipse and Netbeans, and I am trying to implement a library in either (so far it worked it neither). How can I just add the library to my project and then reference the classes from within my own classes? Moreover, where can I find an appropriate library?
Thanks in advance!
EDIT: Ok, now I have somehow managed to implement the library ^^ However: the following command fails:
System.loadLibrary("growl");
It returns following error:
Message: no growl in java.library.path
How can I fix this?
About an appropriate library you should just google it. I found this one (that is tested on 10.5 so maybe it will need some tweaks): http://www.cocoaforge.com/viewtopic.php?f=6&t=17320
To add the library to your project in Eclipse copy it into the project folder (this is not necessary, you could just copy it wherever you want, also in extension folder of the JDK) and then add it through the project settings:
open project properties by right clicking the project and choosing Properties
go to Java Build Path option
go to Libraries and add it
It's possible to use AppleScript script engine in Java 6 on OS X to communicate with Growl. Here's a blog post describing how to do it.
You can use the network binding like in https://github.com/chamerling/JavaGrowl or https://github.com/aerofs/growljavabindings
Maybe this can help you.
If your classes are packaged in a JAR file, just like a 3rd party library, you should be able to put it in your project /lib directory and add it to the CLASSPATH using the IDE. That should be all you have to do (if I understand your question correctly).

Categories

Resources