Giter Site home page Giter Site logo

CLI about patentpublicdata HOT 4 CLOSED

uspto avatar uspto commented on August 12, 2024
CLI

from patentpublicdata.

Comments (4)

patricknee avatar patricknee commented on August 12, 2024

I can be a bit more precise on the error: it appears I am missing a dependency:

PatentPublicData patrick$ java -cp BulkDownloader/target/BulkDownloader-0.0.1-SNAPSHOT.jar gov.uspto.bulkdata.cli2.BulkData -cp BulkDownloader/target/dependency-jars/

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: joptsimple/OptionParser
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: joptsimple.OptionParser
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more

from patentpublicdata.

bgfeldm avatar bgfeldm commented on August 12, 2024

The error you received "NoClassDefFoundError" states that java can not find the class file, might be other classes it can not find but java will complain on the first class it can not initiate. The usual cause is the jar holding the class file is not in your classpath. This particular class is located within jar file dependency-jars/jopt-simple . Check that the jar file exists. If it does your classpath is not setup correctly. Since I chose not to package the third party jars into the main jar, the classpath must include the third party dependency jars on the classpath as well as the application jar.

Classspath should contain both:
target*
target\dependency-jars*

Windows classpath, note semicolon as separator:
BulkDownloader\target*;BulkDownloader\target\dependency-jars*

Linux classpath, colon as separator:
BulkDownloader/target/:BulkDownloader/target/dependency-jars/

Correct Classpath in Use:
java -cp BulkDownloader/target/:BulkDownloader/target/dependency-jars/ gov.uspto.bulkdata.cli2.BulkData --type application --years="2016" --limit=1 --outdir="download"

Example scripts can be located here.
https://github.com/USPTO/PatentPublicData/tree/master/resources/scripts

Also as a suggestion, might be easiest to package as a zip file using"mvn clean package", the generated zip file PatentPublicData/target/PatentPublicData-0.0.1.SNAPSHOT.zip will contain the typical directory structure and setup for an application.

Hope this helps, if you are still having issues feel free to contact me again.

Brian

from patentpublicdata.

bgfeldm avatar bgfeldm commented on August 12, 2024

Updated comment the star symbol was not showing up

from patentpublicdata.

patricknee avatar patricknee commented on August 12, 2024

Brian,

Thank you for the rapid response!

OK, I got it working. I knew I was in classpath hell, the very reason I use Java infrequently enough to never remember how to resolve it. I didn't realize I needed both directories in the CP.

For my Mac I had to do a couple of minor changes to your download.sh script (lib->target; Project path was up two, down one; the parameters were for .cli not .cli2), but those were easy to investigate. If it is useful, I can send the resulting file.

But the core insight was how to get the two directories in the CP.

Thanks again. (You can resolve this.)

from patentpublicdata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.