Skip to content

Question: could this be combined via graalvm in theory? #6

Closed

Description

@rubyFeedback

Question: could this be combined via graalvm in theory?

i am asking because graalvm is pretty cool, and others have managed to get SWING applications to run.

My use case would be more like taking an existing python or ruby code base, commandline stuff,
and add a simple GUI around it. I don't really want to write in C though (Java is ok but Swing is
ugly, and JavaFX does not seem to be supported via Graalvm; also the graalvm team focuses
not so much on GUIs)

Activity

  1. JCWasmx86 commented on Nov 29, 2022

    @JCWasmx86
    Contributor

    Yes, got it working: (Albeit quick and CLI-only, would be probably easier with Gradle/Maven)

    git clone https://github.com/bailuk/java-gtk
    cd java-gtk
    make gen && make && make run
    gradle assemble
    java -agentlib:native-image-agent=config-output-dir=foo -cp ./examples/build/libs/examples.jar:./java-gtk/build/libs/java-gtk.jar:$HOME/.m2/repository/net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar examples.App
    # Play around a bit with every button of the image, otherwise you get (non-critical) errors at runtime of the native image
    native-image -cp ./examples/build/libs/examples.jar:./java-gtk/build/libs/java-gtk.jar:$HOME/.m2/repository/net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar examples.App -H:ConfigurationFileDirectories=foo
    

    After around 90 seconds you get an executable called examples.app with around 22MB. It is not comfortable, especially the generation of the metadata for GraalVM, but it works

  2. Repository owner locked and limited conversation to collaborators on Mar 21, 2023
  3. converted this issue into a discussion #13 on Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions