Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this to instrument a java application? #11

Closed
PasinduTennage opened this issue Sep 18, 2021 · 2 comments
Closed

How to use this to instrument a java application? #11

PasinduTennage opened this issue Sep 18, 2021 · 2 comments

Comments

@PasinduTennage
Copy link

I am following this using the tutorial. It works fine for the given .js example.

I tried to use the same approach to instrument some java application, but it fails as follows.


class GFG {
  
    // Main driver method
    public static void main(String[] args)
    {
  
        // Print statement
        int a = 1+2;
    }
}
graalvm-ce-java11-21.2.0/bin/java --vm.Dtruffle.class.path.append=target/simpletool.jar --vm.Dtruffle.class.path.append=target/simpletool.jar --simple-code-coverage ../GFG

Output:

Unrecognized option: --jvm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I removed -jvm flag, and the corresponding output is:

Unrecognized option: --vm.Dtruffle.class.path.append=target/simpletool.jar
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Can you give a java example?

Thanks

@boris-spas
Copy link
Member

You can only use truffle instruments when you are running a truffle language - which running directly on the GraalVM JVM is not.

You should be able to use this instrument with "Java on truffle" (https://www.graalvm.org/reference-manual/java-on-truffle/). Instruction are in the link but in short - install espresso into your GraalVM and add -truffle to your java command line.

@saardev
Copy link

saardev commented Oct 31, 2023

Hi, I'm trying the same thing you mentioned but it doesn't work. Is there anything else needed to enable the tool for Java on Truffle? Also running --version:graalvm doesn't seem to work at all in the Espresso standalone downloaded from https://www.graalvm.org/latest/reference-manual/java-on-truffle/ (and so I can't see the installed tools).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants