StanfordCoreNLP compiler errors using javac - java

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

Related

Java- Cannot import JIprolog packages

In Java I use these imports:
import com.ugos.jiprolog.engine.JIPEngine;
import com.ugos.jiprolog.engine.JIPQuery;
import com.ugos.jiprolog.engine.JIPSyntaxErrorException;
import com.ugos.jiprolog.engine.JIPTerm;
import com.ugos.jiprolog.engine.JIPTermParser;
And I have downloaded JIProlog and exported it in my project directory.
However when I try to compile my java file (Communicator.java) like this:
javac -cp JIProlog/jipconsole.jar:. Communicator.java
I get an error:
package com.ugos.jiprolog.engine does not exist
Have I skipped a step or something?

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

I am trying to use PDFbox on the IBM Domino server, getting NoClassDefFoundError

I can run my IBM Notes agent locally without error, however when I run the agent on the server I get the following error.
LS2J Error: Threw java.lang.NoClassDefFoundError: org.apache.pdfbox.pdmodel.PDDocument in procedure GETTEMPLATE, line 79
My LotusScript agent calls a java class using LS2J.
The java class using the following libraries:
import java.io.File;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDField;
import org.w3c.dom.Document;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
I have had the following JAR files added to to Domino server, and had it restarted.
pdfbox-1.8.jar,
commons-lang-2.1.jar,
commons-logging-1.2.jar
Are there other JAR files I need copied to: \notes\jvm\lib\ext
or is there something else wrong?
There are two ways to get it to run on server:
specify variable JavaUserClasses (or JavaUserClassesExt) in server's notes.ini like
JavaUserClasses=C:\...\jvm\lib\ext
and restart server or
create a Script Library of type Java, import the jars as Archives and "use" the Script Library in Lotus Script code
Use "pdfBox"

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.

How to add 3rd party JAR's to compile time classpath in jGRASP?

What do I need to do to successfully the import ij package? I get an error:
ITCN_.java:1: package ij does not exist
The imports are:
import ij.*;
import ij.io.*;
import ij.gui.*;
import ij.process.*;
import ij.measure.*;
import ij.plugin.*;
import ij.plugin.frame.*;
import ij.plugin.filter.PlugInFilter;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.lang.*;
import java.text.*;
I also used Jgrasp back in the day.
I highly recommend moving to eclipse although jGrasp is very simple and works.
To Add to the Build Path you go to Settings -> PATH/CLASSPATH -> Workspace
Click on the "Path" tab, and then the "CLASSPATHS" subtab.
Then Click "New" and where it says Path or Jar file, enter in the path to the ij jar file. Do this for each file if there are more than one.
And then click "apply" and you should be able to use import ij.* and the subsequent functions
It's the ImageJ API. The API docs are available here. You can download it here. Once downloaded, just add the JAR(s) to the compiletime and runtime classpath.

Categories

Resources