Stanford CoreNLP doesn't exist - java

I have the following at the start of my code:
import twitter4j.*;
import java.util.List;
import java.util.Properties;
import java.io.*;
import java.util.*;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.neural.rnn.RNNCoreAnnotations;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.sentiment.SentimentCoreAnnotations;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.util.CoreMap;
The problem is, I get the errors like this below:
Twitter_Project.java:8: error: package edu.stanford.nlp.ling does not exist
import edu.stanford.nlp.ling.CoreAnnotations;
It seems like I didn't place my files in the same folder as I should have, but I don't understand how to rearrange my folder...
The only problem is, I don't really understand where to relocate my java files so that I don't return this error anymore.
And this is everything inside the stanford corenlp folder:
Please help—this is my first time using stanford corenlp and also using these kinds of integrated programs (if that's the right word), and I'm very confused.

Hi you need to make sure all of the jar files from the distribution are on your CLASSPATH. How you do that will vary depending on if you are running from the command line or in an IDE.
This link explains the idea of CLASSPATH: https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

I had much difficulty installing Stanford CoreNLP until I installed it inside a Docker container. Now you can install and run it in two steps:
Pull the image from Dockerhub:
$ docker pull anwala/stanfordcorenlp
To run the CoreNLP server:
$ docker run --rm -d -p 9000:9000 --name stanfordcorenlp anwala/stanfordcorenlp
To use the server via Browser/command-line/custom python script etc:
https://ws-dl.blogspot.com/2018/03/2018-03-04-installing-stanford-corenlp.html

Related

getting a import cannot be resolved error for import org.apache.http.client.methods.HttpGet

Im using eclipse Photon. The code worcked fine on old computer. When I got a new computer and tried to run the program The following imports are give me a import cannot be resolved error
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
I'm assuming im missing some jar files. Could some one tell me what jar files I need and whare i can find them? Also why does it work find on ole computer with same jars being added?
Those two classes are part of Apache HTTP Components which you can access from https://hc.apache.org/index.html.

I added the javax.mail, but it keeps saying the class does not exist

Here's the thing: I've downloaded the javax.mail API, added it under Libraries->Add Jar/Folder. I've compiled the code, but it keeps yielding an error on the 'import javax.mail;' sentence, saying that the package does not exist. What is going wrong?
You've mentioned this line:
import javax.mail;
This won't work, because mail is a package and not a class. Either use:
import javax.mail.*;
to import the whole package or import specific classes using:
import javax.mail.Header;
import javax.mail.Message;
import javax.mail.Session;
(the classes are randomly selected and should only show how to import a specific class)
you commented
I've extracted the javax.mail JAR file to the netbeans8.0.2 folder
you dont need to do that,
it should be enough to put the jar in your project's lib folder and maybe reference it in the build path.
cheers

Importing javax package in Java without an IDE

I'm developing a project in Java using Vim, and I need to use some classes from the javax package. What should I install and configure to be able to import any of them?
I already installed the JDK 7 and also put it as my default using update-alternative command.
For example, when I compile a class (for example one called GUI) that uses the javax package, the compiler displays:
> javac GUI.java
GUI.java:1: error: package javax does not exists
import javax.swing;
^
1 error
I think it is related to the $CLASSPATH environment variable, but I'm not sure how to tell the compiler where the package is (since it is inside the JDK 7).
Instead of trying to import javax.swing, which does not actually specify anything specific, you should import javax.swing.*. This imports everything in the javax.swing package.
import javax.swing.*;
You can also import specific swing components and utilities:
import javax.swing.JButton;
See The Java Tutorials page on Using Package Members for more information about importing package members.
You should be importing as:
import javax.swing.*;
or else for example
import javax.swing.JFrame;

Where do I download com.rackspacecloud.client.cloudfiles.* package

I follow the steps to use java to connect swift
http://ceph.com/docs/master/radosgw/swift/java/#setup
but I can find the packages:
import com.rackspacecloud.client.cloudfiles.FilesClient;
import com.rackspacecloud.client.cloudfiles.FilesConstants;
import com.rackspacecloud.client.cloudfiles.FilesContainer;
import com.rackspacecloud.client.cloudfiles.FilesContainerExistsException;
import com.rackspacecloud.client.cloudfiles.FilesObject;
import com.rackspacecloud.client.cloudfiles.FilesObjectMetaData;
where can I get them??
The source for that package (officially referred to as the Rackspace Cloud Files Java API) is available on github here.
download this jar aws-java-sdk-1.1.7.1.jar
there are lot of sites providing to search Class file.
Ex : findjar.com and jarvana.com ...

org.apache.hadoop.mapreduce Not Found-- Hadoop

I am working on Hadoop. I need to process images using the power of Big Data. To play around with it, I have referred this example.
I need to create Sequence file prior working on the image duplicates.
So i used this source code for creating sequence file.
When i compile this in Hadoop environment i am missing some packages. I am using Hadoop-0.18.0.
/tmp/BinaryFilesToHadoopSequenceFile.java:12: package org.apache.hadoop.mapreduce does not exist
import org.apache.hadoop.mapreduce.Job;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:13: package org.apache.hadoop.mapreduce does not exist
import org.apache.hadoop.mapreduce.Mapper;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:14: package org.apache.hadoop.mapreduce.lib.input does not exist
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:15: package org.apache.hadoop.mapreduce.lib.input does not exist
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:16: package org.apache.hadoop.mapreduce.lib.output does not exist
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:17: package org.apache.hadoop.mapreduce.lib.output does not exist
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
Whether am i doing anything wrong?? Or is it not available in 0.18.0.
I know this version is very old version. Due to some restrictions i am using an already configured VM to work with ,which is having this version of hadoop.
Any Help would be appreciated!!
I can't easily find a copy of 0.18.0 to download anymore, but it looks like the mapreduce package was not available in this version (or 0.19):
http://www.java2s.com/Code/Jar/h/Downloadhadoop0180corejar.htm
http://www.java2s.com/Code/Jar/h/Downloadhadoop0190corejar.htm
It's definately in 0.20.2 though
try using 0.20.X hadoop core package version to make use of org.apache.hadoop.mapreduce.* classes

Categories