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

fix jbang integration #184

Open
sandys opened this issue Aug 5, 2023 · 1 comment
Open

fix jbang integration #184

sandys opened this issue Aug 5, 2023 · 1 comment

Comments

@sandys
Copy link
Contributor

sandys commented Aug 5, 2023

java -cp jbang.jar dev.jbang.Main info tools hello.java
{
  "originalResource": "hello.java",
  "backingResource": "/home/user/Code/arakoo/jbang/hello.java",
  "applicationJar": "/home/user/.jbang/cache/jars/hello.java.0234d05aa80b3b31434cce770a25541dc13d2a1a0dd5aa759978fd16fd2091f5.jar",
  "dependencies": [
    "com.databricks:sjsonnet_2.13:0.4.2",
    "ch.qos.reload4j:reload4j:1.2.19",
    "com.google.code.gson:gson:2.8.8"
  ],
  "resolvedDependencies": [
    "/home/user/.m2/repository/com/databricks/sjsonnet_2.13/0.4.2/sjsonnet_2.13-0.4.2.jar",
    "/home/user/.m2/repository/com/lihaoyi/fastparse_2.13/2.3.1/fastparse_2.13-2.3.1.jar",
    "/home/user/.m2/repository/com/lihaoyi/sourcecode_2.13/0.2.3/sourcecode_2.13-0.2.3.jar",
    "/home/user/.m2/repository/com/lihaoyi/geny_2.13/0.6.5/geny_2.13-0.6.5.jar",
    "/home/user/.m2/repository/com/lihaoyi/pprint_2.13/0.6.1/pprint_2.13-0.6.1.jar",
    "/home/user/.m2/repository/com/lihaoyi/fansi_2.13/0.2.10/fansi_2.13-0.2.10.jar",
    "/home/user/.m2/repository/com/lihaoyi/ujson_2.13/1.3.7/ujson_2.13-1.3.7.jar",
    "/home/user/.m2/repository/com/lihaoyi/upickle-core_2.13/1.3.7/upickle-core_2.13-1.3.7.jar",
    "/home/user/.m2/repository/com/lihaoyi/scalatags_2.13/0.9.3/scalatags_2.13-0.9.3.jar",
    "/home/user/.m2/repository/org/scala-lang/modules/scala-collection-compat_2.13/2.4.0/scala-collection-compat_2.13-2.4.0.jar",
    "/home/user/.m2/repository/org/scala-lang/scala-library/2.13.4/scala-library-2.13.4.jar",
    "/home/user/.m2/repository/com/lihaoyi/os-lib_2.13/0.7.2/os-lib_2.13-0.7.2.jar",
    "/home/user/.m2/repository/com/lihaoyi/mainargs_2.13/0.2.0/mainargs_2.13-0.2.0.jar",
    "/home/user/.m2/repository/org/tukaani/xz/1.8/xz-1.8.jar",
    "/home/user/.m2/repository/ch/qos/reload4j/reload4j/1.2.19/reload4j-1.2.19.jar",
    "/home/user/.m2/repository/com/google/code/gson/gson/2.8.8/gson-2.8.8.jar"
  ],
  "availableJdkPath": "/home/user/.sdkman/candidates/java/22.3.r17-grl",
  "compileOptions": [
    "-g"
  ],
  "sources": [
    {
      "originalResource": "hello.java",
      "backingResource": "/home/user/Code/arakoo/jbang/hello.java"
    }
  ]
}%```

instead of the way we are doing right now (in https://github.com/arakoodev/EdgeChains/blob/main/FlySpring/flyfly/src/main/java/com/flyspring/flyfly/commands/jbang/JbangCommand.java), use the `info tools` command to get classpath and jar to execute it. 
@sandys
Copy link
Contributor Author

sandys commented Aug 5, 2023

otherwise, in mac, we get this error

Extracted ClassPath = null
java.lang.NullPointerException: Cannot invoke "String.split(String)" because "classPath" is null
        at com.edgechain.lib.flyfly.commands.jbang.JbangCommand.runJbang(JbangCommand.java:77)
        at com.edgechain.lib.flyfly.commands.jbang.JbangCommand.run(JbangCommand.java:26)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at com.edgechain.lib.flyfly.CustomApplicationRunner.run(CustomApplicationRunner.java:26)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:770)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:318)
        at com.edgechain.EdgeChainApplication.main(EdgeChainApplication.java:34)
2023-08-05T09:17:05.295Z  INFO 5414 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

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

1 participant