USPTO / PatentPublicData

Utility tools to help download and parse patent data made available to the public
Other
182 stars 80 forks source link

Error: Could not find or load main class gov.uspto.bulkdata.cli.ExtractPatent #56

Closed jfbarthe-sls closed 7 years ago

jfbarthe-sls commented 7 years ago

Hi, Java-challenged here... So I was able to build the project fine under Linux with IntelliJ, bar some warnings. Yet, when I try your examples in #4 like: java gov.uspto.bulkdata.cli.ExtractPatent --source="download/ipa150101.zip" --skip 0 --limit 5 --outdir="download" --aps=false I get this Error: Could not find or load main class gov.uspto.bulkdata.cli.ExtractPatent.

I suspect an obvious issue with how to set my Classpaths. In my system, I have:

~$ echo $JAVA_HOME
/usr/lib/jvm/default-java
~$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-0ubuntu1.16.04.2-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
~$ mvn --version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-75-generic", arch: "amd64", family: "unix"

Thank you for bearing with me. JF

bgfeldm commented 7 years ago

The java classpath using command line argument "cp" or "classpath" needs to point to the java jar file.

java -cp "/path/to/file.jar" gov.uspto.bulkdata.cli.ExtractPatent

jfbarthe-sls commented 7 years ago

My bad, with your example java -cp BulkDownloader/target/:BulkDownloader/target/dependency-jars/ gov.uspto.bulkdata.cli2.BulkData --type application --years="2016" --limit=1 --outdir="download" I still get the Error: Could not find or load main class gov.uspto.bulkdata.cli2.BulkData. Question: for "/path/to/file.jar", where can I find the jar file? BulkDownloader/target/ shows no jars.

jfbarthe-sls commented 7 years ago

Hi Brian, Quick update: 1) I had no jars because my Maven build was failing. Changing the plugin in the pom.xml from maven-assembly-plugin to maven-shade-plugin help me with the dependencies. 2) You're right, the -cp needed to point to the jar file (without a space) and changing the --years=2016 to --date=20160101-20161231. Successful command was: java -cp BulkDownloader/target/*:BulkDownloader/target/dependency-jars/*:BulkDownloader/target/BulkDownloader-0.0.1-SNAPSHOT.jar gov.uspto.bulkdata.cli2.BulkData --type=grant --date=20160101-20161231 --limit=0 --outdir="download"