Integrating a open source java lib on grails application - java

I want to intergate the apache tika jar or source files into my grail application and how can i do it please ...
what about access source files into my groovy controller or something

There are a lot's of way to include jar on a grails project, however i think that te best way is using maven.
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>...</version>
</dependency>
add on your BuildConfig.groovy file
dependencies {
...
compile'org.apache.tika:tika-core:1.7'
...
}

try grails apache tika plugin http://grails.org/plugin/tika-parser

there is a thrird option. you can put the downloaded .jar file into the /lib dir of your grails project. do grails package and it should get picked up. this of course is a much inferior solution, than just using a plug-in or dependencies, but might come handy.

Related

How to connect Java Applocation to JIRA?

I want my java application to communicate with JIRA how can i achieve this functinality. I mean what configuratons are need to add, what are jar files etc ?
You actually don't need Jar files if your java project is using Maven. Just add maven dependency
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${atlassian.product.version}</version>
<scope>provided</scope>
</dependency>
If you are not using maven as build system to your project. Download jar from maven directly and add it to your project.
Follow the documentation https://developer.atlassian.com/server/jira/platform/java-apis/ and start development

How to import Processing libraries into Java application

I am calling Processing functions from Java code.
This works fine for the standard Processing classes, but how to you import other Processing libraries; e.g. gicentre?
I've actually got it working by extracting the jar file from the processing library and then manually installing the artifact into the maven project.
Is there a proper way to do it?
Add this dependancy in your maven pom.xml file.
<!-- mvnrepository.com/artifact/org.processing/core -->
<dependency>
<groupId>org.processing</groupId>
<artifactId>core</artifactId>
<version>2.2.1</version>
</dependency>
Sandip's answer will work for the core Processing library (with the caveat that you should use the latest version, not version 2.2.1), but like you've discovered, gicentre doesn't have a maven repository.
You can download the various gicentre libraries from this page. Each of those libraries comes as a .zip file that contains a .jar file.
Now that you have the .jar file, it's just a matter of adding that .jar to your classpath. How you do that depends on how you've set up your project. The simplest way to do it is to use the command line to compile your project, and then you'd use the -cp argument. You've said you're using Maven, so Googling "maven local jar" will lead to a ton of results, including this one: How to add local jar files to a Maven project?
But note that you don't have to use Maven. You could just set the classpath yourself, either via the command line or via your IDE settings. For simple projects, this can be a better option, especially if Maven is giving you trouble.

Apache and Thrift installed but Netbeans can't see import org.apache.thrift

I'm using Archlinux with both Thrift 0.9.3 and Apache installed. In my Netbeans project, when I import org.apache.thrift.*; I got "package org.apache.thrift does not exist". This answer didn't solved the problem because I got not /lib/java folder neither the other answer. Until the moment I couldn't find an answer on the internet. Thanks in advance.
You need the libthrift JAR file in order to use java code generated by the Thrift compiler.
If your project is set up to be able to use Maven repositories, you can add this artifact to your project:
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.3</version>
</dependency>
Alternatively you could just download the JAR file from Maven central and add it to your project:
http://central.maven.org/maven2/org/apache/thrift/libthrift/0.9.3/libthrift-0.9.3.jar
Also important to note is that the version of the JAR you use should match the version of the Thrift compiler that you use for code generation; so if you upgrade the Thrift compiler used for your project, you should upgrade the version of the JAR file as well.

Where do I get a proper Cassandra Thrift API jar file?

Refer to Is there a Java interface to Cassandra database that works out of the box? for my original issue.
I determined that the cassandra thrift API jar file I downloade was incomplete or out of sync with the Hector API. Where can I download it? I haven't been able to find a download for it from the official site.
The Maven repository are always a good choice for precompiled libs:
http://mvnrepository.com/artifact/org.apache.cassandra/cassandra-thrift
It also lists all dependencies. You could also use a Maven file (or another compatible build system) to download the lib with all it's dependencies automatically.
As far as I know there isn't an official jar that you can download. But you can grab the source-code here and compile it yourself:
http://thrift.apache.org/download/
If you use maven then you can just include the following in your pom:
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>x.y.z</version>
</dependency>
If you download one of the release tgz files from https://github.com/rantav/hector/downloads it has the correct cassandra thrift to match the version of hector.

how to include javax.jms.* in eclipse?

Iam trying to implement JMS using eclipse.But when I tried to save the code, it showed that javax.jms.* cannot be resolved and there are no suggestions as well recommended by it.
How can I include it and use it? when I googled I found that javax.jms.* is not a part of java API,then how can I use it in eclipse and get my program run successfully?
I would like to implement JMS with the help of activemq,what all do I need to download and include in code?
Iam a newbie to this JMS, please suggest some references or sample code that can implement JMS using activemq.
When you download the activemq archive file from Internet. Extract this archive: /apache-activemq-x.x.x
cd into this apache... directory.
You will see activemq-all-x.x.x jar file.
Include this in your build path.
This should resolve your issue.
If it is a maven project, add the following dependency to your pom.xml and it should start working as expected.
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
There are actually many ways to fix this. As already stated in the comment you need the Java Enterprise Edition API. Java EE is an abstract specification so what you need is an implementation of the JMS API. Since JMS is part of the Java EE specification the easiest thing is to download a application server such as GlassFish (which is the reference implementation) or JBoss.
I assume you already got the Java compiler so you only need the SDK, not the JDK.
Java EE 6 SDK Update 4 A free integrated development kit used to
build, test, and deploy Java EE 6 applications.
http://www.oracle.com/technetwork/java/javaee/downloads/index.html
Then after you have downloaded GlassFish you will end up with a lot of files that is an implementation of the different Java EE specification API's. You will probably want to download the plugin that I linked to beneath so that you can start, deploy and do many other administration task of your server from Eclipse. I do not use Eclipse so I don't remember if you want this version of Eclipse as well.
http://marketplace.eclipse.org/node/867
At last you want to add GlassFish to your buildpath.
I found this blog post (Scroll to "Create projects in Eclipse") if you are unsure what to add, but there are several blog posts on how to add GlassFish to the build path in Eclipse so I won't list them here.
http://www.webagesolutions.com/knowledgebase/javakb/jkb005/index.html
In addition to the answers already provided, if you are using Maven you can add the following dependency (available from Maven2 Central repo):
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</dependency>
When you have downloaded activemq zip file from http://activemq.apache.org then when you extract it, head on to .jar file of activemq(This jar file is required). Now from Eclipse do as follows:
RightClick on Project and go to Properties
Java Build Path tab
Libraries tab
Add External JARs...
Get that .jar file from activemq folder
I fixed this problem by including the dependency of Activemq.
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.15.0</version>
</dependency>
It can be found in jboss-jms-api.jar
If you are using/Testing ActiveMQ.
Then configure your build path and add external jar activemq-all-.jar. (Path:In )
Clean and Build.
This will helped me , will do same to you as well.
Danke,
Rahul.
If you want to resolve this issue using maven, then the correct maven dependency, available in maven repository, is the following:
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms-api</artifactId>
<version>1.1-rev-1</version>
</dependency>
See post: The following artifacts could not be resolved: javax.jms:jms:jar:1.1

Categories

Resources