Google Cloud Messaging Smack Library - java

I am attempting to implement the Google Cloud Messaging CCS server written in Java, and I have downloaded the Smack library from here. My question is, which files do I place within my project in order to use these import statement?
import java.io.IOException;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.PacketInterceptor;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.DefaultPacketExtension;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.util.StringUtils;
import org.xmlpull.v1.XmlPullParser;
import org.jivesoftware.smack.SmackException;

You need to download the required libraries and import them into your project
I needed
Smack
JsonSimple
XmlPull 1.1.4.c
(Click for download links)
Once you've downloaded each library you need to import them into netbeans
Open your projects properties
Select Libraries
Select Add Library
Select Create
Add a name that indicates which library this is i.e Smack or JsonSimple so on
Add the jar, javadoc and sources if you downloaded them for each library
Rinse and repeat till all three libraries are added to your project

Related

How to upgrade javax.naming.* and javax.xml.* imports to be compatible with java 10

I have a java project built with maven and jdk 1.8. Some classes use javax.naming.* and javax.xml.* classes in the jdk.
From Java 9 onwards those javax packages have been removed from the jdk. So how do I upgrade the project to run on java 9 or later?
Here are the classes,
import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NameClassPair;
import javax.naming.NameParser;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.NoInitialContextException;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.event.EventContext;
import javax.naming.event.EventDirContext;
import javax.naming.event.NamingListener;
import javax.naming.ldap.Control;
import javax.naming.ldap.ExtendedRequest;
import javax.naming.ldap.ExtendedResponse;
import javax.naming.ldap.LdapContext;
import javax.naming.spi.InitialContextFactory;
import javax.naming.spi.InitialContextFactoryBuilder;
import javax.naming.spi.NamingManager;
import javax.xml.namespace.QName;
I have found out jndi contains javax.naming.* classes. But I am not sure how to include them. Just adding as a maven dependency does not work.
These classes have not been removed, see the JavaDoc for javax.naming and javax.xml.namespace. Unless you are building a module and forgot to add the modules java.xml and java.naming as dependencies, the mistake lies outside of Java, most likely with the tooling.
To convince yourself, compile a simple class on the command line with javac and watch it work. Then make sure you are running recent versions of the involved tools (particularly build tool and IDE). If that's the case and the error persists, improve your question with a more detailed description of the error.

find neo4j libraries for java api

I want to use neo4j libraries to connect my java app with neo4j database and follow the tutorials from http://neo4j.com/docs/stable/tutorials-java-embedded-hello-world.html.
At the beginning I copied the sources code from https://github.com/neo4j/neo4j/blob/2.2.2/community/embedded-examples/src/main/java/org/neo4j/examples/EmbeddedNeo4j.java and netbeans complains about missing libraries like:
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.io.fs.FileUtils;
I have searched libraries from http://search.maven.org/#search|ga|2|g%3A%22org.neo4j%22 site for example:
org.neo4j.graphdb
But can not find anywhere. Where can I find libraries?
You need the neo4j-kernel artifact and all of its (transitive) dependencies, see http://mvnrepository.com/artifact/org.neo4j/neo4j-kernel.
Have you looked at http://search.Maven.org and searched Neo4j?

Old netbeans web app with woodstock

I am having pretty much this same issue:
JavaEE/NetBeans Library Referencing
I have done what is suggested by downloading Netbeans 6.7 and Glassfish 2, but I still don't have the libraries needed.
Here's what one of my files looks like:
import com.sun.data.provider.RowKey;
import com.sun.data.provider.impl.CachedRowSetDataProvider;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.sql.rowset.CachedRowSetXImpl;
import com.sun.webui.jsf.component.Body;
import com.sun.webui.jsf.component.Button;
import com.sun.webui.jsf.component.DropDown;
import com.sun.webui.jsf.component.Form;
import com.sun.webui.jsf.component.Head;
import com.sun.webui.jsf.component.Html;
import com.sun.webui.jsf.component.Label;
import com.sun.webui.jsf.component.Link;
import com.sun.webui.jsf.component.MessageGroup;
import com.sun.webui.jsf.component.Page;
import com.sun.webui.jsf.component.StaticText;
import com.sun.webui.jsf.component.TextField;
import com.sun.webui.jsf.model.SingleSelectOptionsList;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.FacesException;
import javax.faces.component.UISelectItems;
import javax.faces.component.html.HtmlSelectOneMenu;
import javax.faces.event.ValueChangeEvent;
import javax.sql.rowset.CachedRowSet;
I do not have any of the com.sun... packages and can't seem to find them anywhere.
I don't have very much experience with web apps/netbeans so any help would be appreciated. I realize that this is very outdated and should probably be migrated to something else, but for now I'd like to just make a few small edits and would rather not rewrite everything.
Thanks!
I originally had opened the project in a newer version of Netbeans that didn't have Wodostock/JSF. For some reason, it wouldn't work when opening with the older version of Netbeans. However, after deleting it and opening it again with the old version first, it worked.

elasticsearch package import error

I am trying to import following packages in my .java file:-
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
I am getting error that the above mentioned packages do not exist.
You need to download elastic search jar to make it work. Download it from here.
And add it to your classpath.

Where to install the import modules used in a java program?

For a program the import headers are showing errors. From where can i download the importing packages? The import instance of the program is shown below..
package com.larmor.opencv.samples;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Panel;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import javax.media.Buffer;
import javax.media.CaptureDeviceInfo;
import javax.media.CaptureDeviceManager;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.Player;
import javax.media.control.FrameGrabbingControl;
import javax.media.format.VideoFormat;
import javax.media.util.BufferToImage;
import javax.swing.JButton;
import javax.swing.JComponent;
import com.larmor.opencv.MatchTemplate;
would this all be in the java library? Even if yes pls tell me how to install packages/modules that are not in the java library..
Most of those classes are available in JSE, but it looks like it's also using JMF. You can download JMF from here:
JMF Download
You don't install modules, you just add jars/classes to the classpath. How you do that depends on if you are using an IDE or not. This article can give you some insight on how things work:
PATH and CLASSPATH
All the java.awt and javax.swing classes are part of the standard Java platform.
The javax.media classes are part of the Java Media Framework. You'd have to download and install that separately.
The MatchTemplate thing seems to come from here.
To find where a package come from, look through the Java SE API documentation or search for the package name on Google.
You need to put the relevant JAR files to your classpath while compiling and running your application which uses these classes (except if they are classes in the standard Java platform; these will be automatically available).

Categories

Resources