I tried to run the sample code shown here but it's complaining that SLF4J is missing, so I downloaded the zip archive from the official website.
The tutorial video shows that 3 of the jar files are used (log4j-over-slf4j, slf4j-api & slf4j-log4j12) but if I add all 3 of them to the build path of my project (I'm not using Maven!), it complains that both "log4j-over..." and the api are there.
If I get rid of the "over" file, it says "Failed to instantiate SLF4J LoggerFactory".
So, which jar files do I need exactly to stop the complaints and run the sample code?
There is a tutorial showing all the dependencies needed for the sample code. Try this please: https://developers.itextpdf.com/content/itext-7-jump-start-tutorial/installing-itext-7
It basically gives you a list of the exact maven dependencies your project will need to run. You'll also find some indications how to make it work with the IDE like eclipse, netbeans and intelliJ
By using
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.18</version>
</dependency>
Edit:
you could manually download these 3 dependencies. They get any slf4j with log4j project going:
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
log4j-1.2.16.jar
if you don't trust 3rd party site go the slf4j site and the log4j homepage.
We simply need the slf4j api, its log4j implementation and log4j itself.
Try removing log4j12. You cannot use both over and log4j12 at the same time. link
If you wish to use log4j 1.2.x as the logging back-end with slf4j, you need log4j-1.2.17.jar, slf4j-api-1.7.25.jar and slf4j-log4j12-1.7.25.jar.
Related
I tried to run the sample code shown here but it's complaining that SLF4J is missing, so I downloaded the zip archive from the official website.
The tutorial video shows that 3 of the jar files are used (log4j-over-slf4j, slf4j-api & slf4j-log4j12) but if I add all 3 of them to the build path of my project (I'm not using Maven!), it complains that both "log4j-over..." and the api are there.
If I get rid of the "over" file, it says "Failed to instantiate SLF4J LoggerFactory".
So, which jar files do I need exactly to stop the complaints and run the sample code?
There is a tutorial showing all the dependencies needed for the sample code. Try this please: https://developers.itextpdf.com/content/itext-7-jump-start-tutorial/installing-itext-7
It basically gives you a list of the exact maven dependencies your project will need to run. You'll also find some indications how to make it work with the IDE like eclipse, netbeans and intelliJ
By using
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.18</version>
</dependency>
Edit:
you could manually download these 3 dependencies. They get any slf4j with log4j project going:
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
log4j-1.2.16.jar
if you don't trust 3rd party site go the slf4j site and the log4j homepage.
We simply need the slf4j api, its log4j implementation and log4j itself.
Try removing log4j12. You cannot use both over and log4j12 at the same time. link
If you wish to use log4j 1.2.x as the logging back-end with slf4j, you need log4j-1.2.17.jar, slf4j-api-1.7.25.jar and slf4j-log4j12-1.7.25.jar.
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.
I want to use Log4J into my application. I have a limited resources and I want to use just the basic part of Log4J. Can you tell which package I need to use just for basic logging.
P.S In order to use just basic Log4J which packages I can remove?
You need the first two, and if it's Maven-based build then only the second, Log4j Core and the first will be added as a transitive dependency.
You could also use this entry in pom.xml if you're using Maven or similar:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0-beta9</version>
</dependency>
Agree with Andrey, you need the core and the api jars. Note that the OSGi stuff is still a work in progress. About wich packages could be removed from the core jar: I see you also posted your question to the log4j mailing list. I'll answer there so that the whole log4j team can chip in.
Be aware though the the core jar contains config files in addition to .class files. If you rebuild a jar with a custom subset you must include those config files or the api will not recognize your jar as an implementation.
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.
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