package org.apache.hadoop does not exist - java

I'm trying to compile a java file which is importing hadoop packages.
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
But it fails with a message
error: package org.apache.hadoop.fs does not exist
I googled for this error and it seems that I have to edit $PATH
But I have no idea to what I have to fix the path.
How can I solve this import error?

You have bad import, its
import org.apache.hadoop.fs.Path;
Not
import org.apahce.hadoop.fs.Path;
The other posibility its you have bad import, can show how import the library of hadoop.

Related

Java external package not founded by using php to run the java program

This is my first web application project and I was required to run the java code using php but this error occurs.
src\Convertion.java:12: error: package org.apache.poi.examples.ss does not exist
import org.apache.poi.examples.ss.ToCSV;
I have included all the jar files needed to run the program also the classpath is already set in the system variable but the error is display i haven't included the org.apache.poi.examples.ss package.
So here is my code for my php and java
test.php
<?php
exec('javac -cp "poi-bin-5.2.3/poi-5.2.3.jar; poi-bin-5.2.3/poi-examples-5.2.3.jar; poi-bin-5.2.3/lib/commons-io-2.11.0.jar; poi-bin-5.2.3/lib/log4j-api-2.18.0.jar; " src/Convertion.java', $output);
exec('java -cp "poi-bin-5.2.3/poi-5.2.3.jar; poi-bin-5.2.3/poi-examples-5.2.3.jar; poi-bin-5.2.3/lib/commons-io-2.11.0.jar; poi-bin-5.2.3/lib/log4j-api-2.18.0.jar; " src/Convertion.java', $output);
?>
Convertion.java
package src;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
//Error here
import org.apache.poi.examples.ss.ToCSV;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
//
public class Convertion {
///code//
}
I go through all the articles but still unable to solve the error
Any idea what is wrong with my code?

Google Analytics API 4 Java client running from command com.google.analyticsreporting.v4 package does not exist

I'm running the API 3 with Java from Windows command using javac and java to compile, no problem. I'm trying the API 4 but can't make even the basic example to run. I understand my problem must be in the classpath but can't pinpoint on the problem. Can't see the com.google packages
I downloaded the API 4 Java Client, copied all .jar in libs to a folder libs in my project. Also copied google-api-services-analyticsreporting-v4-rev110-1.22.0.jar to the libs
I'm testing the service account example as in
https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-java
I setup the compiler as (I know the path exists)
javac -classpath ".;C:\Java\GAnalytics\libs\*" HelloAnalytics4.java
I also tried adding the subdirectories in the client
Error Package does not exit:
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.analyticsreporting.v4.AnalyticsreportingScopes;
import com.google.analyticsreporting.v4.Analyticsreporting;
import com.google.analyticsreporting.v4.model.ColumnHeader;
import com.google.analyticsreporting.v4.model.DateRange;
import com.google.analyticsreporting.v4.model.DateRangeValues;
import com.google.analyticsreporting.v4.model.Dimension;
import com.google.analyticsreporting.v4.model.GetReportsRequest;
import com.google.analyticsreporting.v4.model.GetReportsResponse;
import com.google.analyticsreporting.v4.model.Metric;
import com.google.analyticsreporting.v4.model.MetricHeaderEntry;
import com.google.analyticsreporting.v4.model.Report;
import com.google.analyticsreporting.v4.model.ReportRequest;
import com.google.analyticsreporting.v4.model.ReportRow;
What am I missing?
Same problem for me, I solved by substituting all
"com.google.analyticsreporting.v4" ---> "com.google.api.services.analyticsreporting.v4"
and also:
Analyticsreporting --> AnalyticsReporting
Here the screen of the google-api-services-analyticsreporting-v4-rev111-1.22.0.jar unzipped

StanfordCoreNLP compiler errors using javac

I have just started looking into the Stanford NLP libraries. I downloaded and uncompressed the core file that includes everything, then tried to run the demo file (StanfordCoreNlpDemo.java).
import edu.stanford.nlp.io.*;
import edu.stanford.nlp.ling.*;
import edu.stanford.nlp.pipeline.*;
import edu.stanford.nlp.semgraph.SemanticGraph;
import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations;
import edu.stanford.nlp.trees.*;
import edu.stanford.nlp.util.*;
All of the import lines trigger an "error: package edu.stanford.nlp. does not exist" message.
Can anyone tell me what I need to do to make the demo work?
Include the class path while compiling the core java file by
javac -cp stanford-corenlp-3.5.0.jar filename.java

org.apache canot be resolved in eclipse

import org.apache.poi.hssf.usermodel.*;
import org.w3c.dom.*;
import java.io.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
Please anyone tell me what does this error tells. and how to solve it.
I hope you would get the jar files from distribution files.
Here is the link Apache POI
Reason for the error is Your program cannot find org.apache.poi.hssf.usermodel.*; class so for this you to download jar containing org.apache.poi.hssf.usermodel.* and then set your classpath.
Here is the link to download jar

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.

Categories

Resources