GithubHelp home page GithubHelp logo

Comments (9)

erip avatar erip commented on August 18, 2024 1

Wow, incredible debugging skills with very little info. Adding the $JAVA_OPTS before -jar seems to have worked!

from java-demo.

dreiss avatar dreiss commented on August 18, 2024 1

I think anything after -jar foo.jar is treated as an argument to your Java program. Any arguments to the JVM need to be before. Glad you got it working. Please provide feedback on the Java bindings and let us know how you're using them!

from java-demo.

dreiss avatar dreiss commented on August 18, 2024

Can you paste the command you are running? Did you remember to export LIBTORCH_HOME? Did you remember to export USE_LIBTORCH_NIGHTLY=1? Can you run ./gradlew --info run and paste the logging output?

from java-demo.

erip avatar erip commented on August 18, 2024

@dreiss I'm not running the exact demo but something representative with a jar build, so the export of USE_LIBTORCH_NIGHTLY isn't necessary. My exact command is:

java -jar MyApplication.jar -Djava.library.path=$LIBTORCH_HOME/lib

$LIBTORCH_HOME is exported appropriately (see above find output), and my gradle build file has the following:

dependencies {
   // ...
   compile 'org.pytorch:pytorch_java_only:1.5.0-SNAPSHOT'
}
def LIBTORCH_HOME = System.getenv('LIBTORCH_HOME')
applicationDefaultJvmArgs = ["-Djava.library.path=$LIBTORCH_HOME/lib"]

from java-demo.

dreiss avatar dreiss commented on August 18, 2024

What if you put -Djava.library.path=$LIBTORCH_HOME/lib before -jar on the command line?

from java-demo.

dreiss avatar dreiss commented on August 18, 2024

$LIBTORCH_HOME is exported appropriately (see above find output)

That find command would still work even if LIBTORCH_HOME was not exported. But your command also doesn't require it to be exported, so shrug.

from java-demo.

erip avatar erip commented on August 18, 2024

I'm a bit curious why the $JAVA_OPTS need to be present in jar invocation given the build.gradle already forces the java args in the application run, but that's likely a separate thing altogether.

from java-demo.

dreiss avatar dreiss commented on August 18, 2024

I'm a bit curious why the $JAVA_OPTS need to be present in jar invocation given the build.gradle already forces the java args in the application run, but that's likely a separate thing altogether.

I think applicationDefaultJvmArgs only applies when using gradle run.

from java-demo.

erip avatar erip commented on August 18, 2024

Makes perfect sense and this seems to agree with you. Thanks for the remote rubberducking!

from java-demo.

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.