Skip to content

basic docs on jbang usage #9

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

Merged
merged 2 commits into from
Feb 18, 2023

Conversation

maxandersen
Copy link
Contributor

here is a readme documenting how to use ap-loader jbang alias.

I would still encourage to create jvm-profilng-tools/jbang-catalog then instead of:

jbang ap-loader@jvm-profiling-tools/ap-loader it would just be jbang ap-laoder@jvm-profiling-tools.

But anyhow - here is the doc for how it works with the alias inside the main repo.

Copy link
Member

@parttimenerd parttimenerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to run it on my M1 mac book and it did not work properly.

After installing JBang and installing ap-loader on it, I got:

> jbang ap-loader@jvm-profiling-tools/ap-loader
/Users/I560383/.sdkman/candidates/java/20.ea.30-open/bin/java -classpath /Users/I560383/.jbang/cache/urls/8973817683a5f7eb03077bb812b49bf64b6d296ee3986c4208a97cde9850027f/ap-loader-all.jar one.profiler.AsyncProfilerLoader

Be aware that it is recommended to use run the JVM with the
To run with JBang you can do `jbang ap-loader@jvm-profiling-tools/ap-loader` or install it as an application:

```sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make it a single command and the whole JBang part one paragraph

jbang app install ap-loader@jvm-profiling-tools/ap-loader
```

and run it directly with `ap-loader` instead of `java -jar ap-loader.jar`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing, or I can just run ap-loader directly in my shell?

README.md Outdated
With JBang you can do:

```sh
java -javaagent:ap-loader@jvm-profiling-tools/ap-loader=start,event=cpu,file=profile.html <java arguments>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it and it failed, but maybe I haven't setup JBang correctly.

The README would suggest that the user would be getting more information on running ap-loader with JBang at the async-profiler GitHub page.

Maybe leave out this paragraph?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh - i typed it wrong ;)

@maxandersen
Copy link
Contributor Author

Hmm. How did you install it?

I think you hit the issue that someone (not me) submitted a bad formula to the main brew repo. Make sure to use one of the installs documented at jbang.dev/downloads

@parttimenerd
Copy link
Member

I used brew, but now I used the sdkman version, but after installing, the javaagent still did not work:

> java -javaagent:ap-loader@jvm-profiling-tools/ap-loader=start,event=cpu,file=profile.html -jar ~/Downloads/ap-loader-2.8.3-all.jar
Error opening zip file or JAR manifest missing : ap-loader@jvm-profiling-tools/ap-loader
Error occurred during initialization of VM
agent library failed to init: instrument

Any ideas? Being able to use ap-loader directly is really cool.

@maxandersen
Copy link
Contributor Author

maxandersen commented Feb 17, 2023

you need to follow the docs and use jbang not java :)

This should do it:

jbang --javaagent:ap-loader@jvm-profiling-tools/ap-loader=start,event=cpu,file=profile.html ~/Downloads/ap-loader-2.8.3-all.jar

@parttimenerd
Copy link
Member

I will merge it and modify the text afterward to fix the other issues I pointed out myself.

@parttimenerd parttimenerd merged commit 3e7fe32 into jvm-profiling-tools:main Feb 18, 2023
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

Successfully merging this pull request may close these issues.

2 participants