When i decided to import com.sun.pdfview.* to my program it marked an error where it specified that I should create a package for it but when I did it still gave me an error, should I download a library to be able to use it? Which one?
ps.Im using eclipse as my IDE
Related
I am working on a Java fx application and I need to import some libraries from com.google.maps.
I imported these libraries :
import com.google.maps.GeoApiContext;
import com.google.maps.PlaceDetailsRequest;
import com.google.maps.PlacesApi;
import com.google.maps.QueryAutocompleteRequest;
import com.google.maps.errors.ApiException;
import com.google.maps.model.AddressComponent;
import com.google.maps.model.AddressComponentType;
import com.google.maps.model.AutocompletePrediction;
import com.google.maps.model.PlaceDetails;
The java import statement is a little bit misnamed, it really means alias. import com.google.maps.GeoApiContext; really just means: Any time you find the type GeoApiContext anywhere in this source file, assume I meant to write com.google.maps.GeoApiContext.
Crucially, it does not 'invoke' any code in that class whatsoever, nor does it find or download any dependencies from the internet for you.
You will need to find the jar(s) that provide these classes and put them on the classpath of this project.
It can be as simple as downloading the relevant jar (perhaps com.google.maps-google-maps-services.jar?), put it in a lib dir someplace inside this project, finding that in the package explorer, right clicking it, and selecting 'add to classpath'.
Or, more likely, you want to use gradle or maven to take care of this for you: These tools turn simply mentioning the dependency in a list of libraries you require into automatically finding that on the internet, downloading it, configuring your IDE so that it knows where it is, and using that dependency during build and run steps.
I am working through the RabbitMQ Java tutorial found here: https://www.rabbitmq.com/tutorials/tutorial-one-java.html
I have downloaded the Java Client Library package, and copied the JAR files to my project in Eclipse, but the import statements
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
all yield the error
The import "com.rabbitmq" cannot be resolved.
The instructions are unclear how to incorporate the JAR files from the Java Client Library package, how should I proceed?
You can download the rabbitmq-java-client-bin-3.5.4.zip from official link here . Then extract the rabbitmq-client.jar from the zip & add it to your class path in project. Then you will be able to resolve The import "com.rabbitmq". Give it a try.
Since the verified answer doesn't work anymore, here is my solution:
You can download the amqp-client-5.8.0.jar from here . Then add it to your class path, like any other jar.
In case that the link doesn't work, you can manually download it from here or even add the required dependency to your maven/gradle project.
For Visual studio code(vscode) we need to add the library file under Referenced Libraries enter image description here under the Java projects section.
enter image description here.imgur.com/txB2s.png
Following a reboot my Eclipse Android project was damaged, with the vast majority of my import statements being removed. I've managed to recover it using the "Source...Organize Imports" option, but now I get the above error in a previously-working piece of code which uses NotificationCompat.
I found and followed the advice from this question:
Could not find class 'android.app.Notification$Builder
I have import android.support.v4.app.NotificationCompat; at the top of my class, and have both android-support-v4.jar and android-support-v7-appcompat.jar in the lib folder of my project. I still get the error above however.
What else can I try to resolve this?
I am trying to create a sip protocol handler. I am facing some difficulties to create this. I am trying to use stun4j but i can not import it. Whenever I import it shows an error package java.net.stun4j does not exist.
import net.java.stun4j.StunAddress;
import net.java.stun4j.client.NetworkConfigurationDiscoveryProcess;
import net.java.stun4j.client.StunDiscoveryReport;
I have tried different library jar files but it is always showing error. I have used java sip api. But import is always showing error. If I have to get rid of this error, what jar file should I use?
You should put jar files to your classpath.
When I develop an RMI server, I use:
import java.rmi.server.UnicastRemoteServer;
import java.rmi.server.StubSecurityManager;
import chat.server.*;
But when I compile the Java file, an error occurs that says:
Class java.rmi.server.UnicastRemoteServer not found in import. import
java.rmi.server.UnicastRemoteServer
and also error with StubSecurityManager. Please help me work out this problem.
It appears that you are using an old code written in JDK1.1 trying to compile using newer version of JDK.
You need to make following changes.
java.rmi.server.UnicastRemoteServer -> java.rmi.server.UnicastRemoteObject
java.rmi.server.StubSecurityManager -> java.rmi.RMISecurityManager
Source:
http://groups.google.com/group/comp.lang.java.api/browse_thread/thread/c768d6617f80eedd/4edf4acebd2ce575