Issue with importing com.sun.jersey.api.client.ClientResponse; - java

I have a basic java project wherein I have imported the jersey-client-1.19.jar externally in my java build (using eclipse). I am trying to write a basic jersey client to make a RESTful call to a web service. As soon as I try to import the ClientResponse class, eclipse complains about -
the type javax.ws.rs.ext.runtimedelegate$headerdelegate cannot be resolved. It is indirectly referenced from required .class files.
Eclipse auto correct takes me to my build paths. But I have had no luck fixing this. Googled for this but did not find anything.
I am missing something basic here. Any help is appreciated.

Never mind. Fixed it by trying to import jars from jersey library. The jsr311-api-1.1.1.jar import fixed the issue.

Related

The import org.eclipse.ui.internal.ShowViewAction cannot be resolved

I can not figure out what I am missing solve this import error. I have org.eclipse.ui_3.107.0.v20150507-1945.jar included in my build path, but it does not seem to be what is required. I've tried including all the other org.eclipse.ui.* jar files in my build path but none seem to be resolving the import error. Does any one know what is needed for this?
I'm a relatively new java developer, but have run into the "The import * cannot be resolved" quite a bit and the only way I've found to fix it, if it can't be auto resolved with eclipse's quick fix, is to try and guess what jar needs to be added to the build path. Is there a more reliable method or is trial and error what it comes down to?
This is an internal class (the package name includes 'internal'). You should not be trying to use it. Internal classes are often created / changed / deleted without warning between Eclipse releases.
See Eclipse API Rules of Engagement for more information about the Eclipse API.
This particular action existed in Eclipse 3.x but is no longer present in Eclipse 4. The action essentially calls IWorkbenchPage.showView, you will have to write your own action to do the same.

Twilio API issue

Hello stackoverflow,
This might be a really easy question but I am having issues with building a basic sms reply application in java. I googled around and couldn't find a solution for my problem. The issue occurs when I do the following imports:
import com.twilio.sdk.verbs.TwiMLResponse;
import com.twilio.sdk.verbs.TwiMLException;
import com.twilio.sdk.verbs.Message;
Eclipse throws an error when I try calling and implementing the Message class sayingThe import com.twilio.sdk.verbs.Message cannot be resolved . I have no issues with the other classes, just the Message class. And I have used Maven to compile the project.
Anybody have any solutions and/or solutions for this issue?
You need to specify external libraries in the Build Path.
In Eclipse right click on your project > Build Path > Configure Build Path > Libraries > Add JARs (or "Add External JARs" if you didn't copy it into your project folder).
If it still doesn't work there might be dependencies you are missing, so you need those as well. To save the headache you could also use Maven to download them automatically.
I was using the wrong Twilio SDK version in my maven dependency. I was using 3.3.15 and I updated it to 4.4.2 and it solved my issue. Thanks for all the comments and replies

Cannot locate Freebase Java API libraries

I'm new to using freebase, so I'm going through the java sample provided on the Developers page. But when I run the code, I get errors because eclipse cannot recognize the packages that I'm importing. Does anyone know where I can download these packages in order to import them without errors. So my question is, where can I download the package com.freebase.samples
I've looked everywhere for the package but can't find it anywhere, is it discontinued and replaced by a newer package, if so does anyone know the name of the new package and where I can find it.
I don't know if this is what you are looking for, but the files have the package com.freebase.samples.
https://github.com/fatschi/FreebaseCrawl/tree/master/src/main/java/com/freebase/samples

Add Google Translate API in eclipse

I want to make a simple program using google translate API. I have an account and key already,but I am having trouble with the imports.
import com.google.api.GoogleAPI;
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
They cannot be resolved. I am trying to follow these instructions:
https://code.google.com/p/google-api-java-client/wiki/Setup#google-api-client
but after extracting the google-api-java-client-1.17.0-rc.zip file and trying to add only the jar files I need, I cannot find the following:
jackson-core-asl-1.9.4.jar
protobuf-java-2.2.0.jar
xpp3-1.1.4c.jar
I have tried adding the entire google-api-services-translate-v2-rev27-1.17.0-rc-sources.jar file with maven and manually without maven. It shows up under referenced libraries and in the build configuration, but still does not achieve anything. I do not know if I am missing something important. I want to use it in a simple application, not having to do with android or google app engine. Please help! Thank you so much in advance!
You have to download this: http://google-api-java-client.googlecode.com/files/google-api-java-client-1.17.0-rc.zip
It contains the required libraries.

NetBeans 7.4 cannot find symbol error when importing java.net.URLEncoder

I am using NetBeans 7.4 with JDK 7u51.
When I try to compile the below statement:
package userclasses;
import java.net.URLEncoder;
etc... Other imports.
etc... Normal class definition.
I get this compile error message:
error: cannot find symbol
import java.net.URLEncoder;
symbol: class URLEncoder
location: package java.net
If I take the import java.net.URLEncoder out of the file then it compiles fine.
I have tried clearing the NetBeans cache.
The only thing I can think of is that the compiler is searching the wrong java.net library.
I am using codenameone libraries and one of them contains a java.net definition with only a few classes in it. I am not sure if this is legal? Seems like that could obscure the JDK's java.net library? However, I completely removed that library from the project and still get the same error, so that discredits my theory a bit, though it could be defined somewhere else that I am unaware of.
I am open to any suggestions?
BTW does any know which physical library file java.net classes are located in?
I was thinking of adding that .jar to my project and placing it first on the classpath (I know that it is included with the JDK by default), that way I would know for sure that the correct java.net was being searched.
This is frustrating stuff as my development work has ground to a complete halt because of this.
Sam
It turns out that java.net.URLEncoder is not supported with codenameone platform, at least not as of version 2.0. Codenameone has a class called com.codename1.io.Util.encodeUrl that works.

Categories

Resources