Git Product home page Git Product logo

gradlejnisample's People

Contributors

vladsoroka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gradlejnisample's Issues

finished with non-zero exit value 1

My java file

public class HelloWorld {
public native void print();

static {
    System.loadLibrary("hello");
}

public static void main(String[] args) {
    new HelloWorld().print();
}

}

OUTPUT

10:30:26: Executing task 'HelloWorld.main()'...

> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes

> Task :HelloWorld.main() FAILED
2 actionable tasks: 2 executed
java.lang.UnsatisfiedLinkError: no hello in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1124)
at HelloWorld.<clinit>(HelloWorld.java:5)
Exception in thread "main" 
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':HelloWorld.main()'.
> Process 'command 'C:/Program Files/OpenJDK/openjdk-8u292-b10/bin/java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to 
get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
 10:30:33: Task execution finished 'HelloWorld.main()'.

How can I solve this ?

How to run this project ?

When I run I have the following error.

C:\Users\pja\Documents\GradleJniSample-master>gradlew test
> Task :hello:compileDebugCpp FAILED

FAILURE: Build failed with an exception.

 * What went wrong:
 Execution failed for task ':hello:compileDebugCpp'.
 > No tool chain is available to build C++ for host operating system 'Windows 10' architecture 'x86-64':
 - Tool chain 'visualCpp' (Visual Studio):
    - Could not locate a Visual Studio installation, using the command line tool, Windows registry or system path.
 - Tool chain 'gcc' (GNU GCC):
    - Could not find C++ compiler 'g++' in system path.
 - Tool chain 'clang' (Clang):
    - Could not find C++ compiler 'clang++' in system path.

   * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with -- 
    scan to get full insights.

    * Get more help at https://help.gradle.org

  BUILD FAILED in 1s
  3 actionable tasks: 1 executed, 2 up-to-date

How can I solve this error ?

Run HelloWorld In Main Class

Hello, I have successfully run this project with ./gradlew test.
Then when I try to run new HelloWorld().print() in java main class using IntelliJ's Run button, it failed with the following message:

Execution failed for task ':Script.main()'.
> Process 'command '/Users/frank/Library/Java/JavaVirtualMachines/adopt-openjdk-11.0.8/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Here is my Script.java file definition in the same folder of HelloWorld.java:

public class Script {
    public static void main(String[] args) {
        new HelloWorld().print();
    }
}

Do you know how do fix it? Thanks for your reply!

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.