The import org.apache.commons.httpclient can not be resolved - java

I have downloaded the library
added the library
refreshed the project
imported the library to project
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.params.HttpMethodParams;
However i still get the error
The import org.apache.commons.httpclient can not be resolved
can you please tell what is the problem with it?

Related

where to get java SDK for BusinessObjects

I want to import the packages, for example:
import java.io.PrintWriter;
import java.text.DateFormat;
import java.util.Date;
these packages have already existed so it doesn't pop up any error messages.
When I want to import others packages:
import com.businessobjects.rebean.wi.DocumentInstance;
import com.businessobjects.rebean.wi.Prompt;
import com.businessobjects.rebean.wi.Prompts;
import com.businessobjects.rebean.wi.ReportEngine;
import com.businessobjects.rebean.wi.ReportEngines;
import com.crystaldecisions.enterprise.ocaframework.ServiceNames;
import com.crystaldecisions.sdk.exception.SDKException;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.framework.ISessionMgr;
import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
import com.crystaldecisions.sdk.plugin.desktop.folder.IFolder;
It will say "the import cannot be resolved", but where I can get the jar files to resolve these problems?
I tried to search these jar files in the java lib folder but was not able to get them.
Can anyone tell the exact folder path for these jar files, if it is there?
Or where can I download those packages.....
I found the website (https://help.sap.com/doc/javadocs_bip_42/4.2/en-US/bip/en/com/crystaldecisions/sdk/exception/package-summary.html) but I still don't know how to import it......
You'll need rebean.wi.adapter.jar and cecore.jar. They are located in the following directory with BO client or server software is installed:
C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\lib
Note that these are not available publicly -- you will need to install the software.

Eclipse, Java, import suddenly stopped being recognize

I have a java project with several packages.
com.xxx.simulator
ThreadManager.java
Simulator.java
com.example
Config.java
Simulator and Config both import ThreadManager. I did not have any problem until now. I opened Eclipse and had this errors showing:
The import com.xxx.simulator.ThreadManager cannot be resolved
and
ThreadManager cannot be resolved
This is ThreadManager:
package com.xxx.simulator;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ThreadFactory;
import org.json.JSONObject;
public class ThreadManager implements ThreadFactory { }
This is Config
package com.example;
import java.math.BigDecimal;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.json.JSONObject;
import com.xxx.simulator.Simulator;
import com.xxx.simulator.ThreadManager; <----- The import cannot be resolved
import com.xxx.simulator.config.Configuration;
#Path("config")
public class Config {
// some stuff
ThreadManager.getInstance().getAllThreadStatus(); <----- ThreadManager cannot be resolved (on ThreadManager only)
}
To fix ThreadManager cannot be resolved, I am proposed to import ThreadManager from com.xxx.simulator. But it already is imported with the Import cannot be resolved error.
How can I solve this ? Any solution proposed by Eclipse is not working.
Edit: The problem is for Config.java AND Simulator.java.
Edit 2: ThreadManager is the only class causing this problem from com.xxx.simulator.
Try a clean build of the project in eclipse. If it is a maven project, then try running mvn eclipse:eclipse through command line.
Reasoning:
Sometimes eclipse lands in a state where it is no longer able to identify / find the generated class files / jars. So, we usually do a clean build or mvn eclipse:eclipse to get all the dependencies (classes/jars) correctly set up. This is essentially rebuilding the project so that all relationships, dependencies, metadata is correctly set up to recognize the dependencies successfully.

import of java classes cannot be resolved

I am using eclipse for core java and its working fine. Now I downloaded another eclipse for java ee and I am using tomcat server but in my new eclipse java files are not getting loaded
Below mentioned imports are showing the error of import cannot be resolved while they are working fine in my old eclipse(I think there is some problem with build path ) -
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
While the below-mentioned imports do not show any error-
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.mysql.jdbc.ResultSet;
Sample Image of error:
A package at the top should be used, a deep src sub-directory like: src/aaa/bbb/ccc.
package aaa.bbb.ccc;
import ...
Reason: using the default package (immediately under the root) is actually
never done since java 1.2. For that I find the missing package suspicious.
The following is wrong:
import com.mysql.jdbc.ResultSet;
It should be:
import java.sql.ResultSet;
Reason for JDBC using database vendor specific libraries is bad style.
Entirely sure on a cause for your errors in eclipse I am not sure. A refresh, Alt+F5 might be useful if the error was a fluke.
If the JDK is actually java 9 I would expect import problems too, as then you would need to gather the JDK modules piecewise. That does not seem to be the case here.
Check if you have set the JDKs correctly in your IDE and in the project.

The import com.eta cannot be resolved

What do I have to do to resolve this?
import com.eta.db.connection.HibernateSession;
import com.eta.db.connection.Save;
these are my imports in Eclipse. I work on Windows

jar files used for the below imports

Anyone used these imports in your files...?
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.params.HttpMethodParams;
I have an example that uses these imports. I have commons-codec-1.6.jar/httpclient-4.1.2.jar/httpcore-4.1.2.jar/commons-logging.jar in my classpath. Still the import fails. any inputs?
That's Apache commons-httpclient. And the Javadocs for that library.

Categories