How to use Avian on Windows?? Need help compiling a Swing app

75 views
Skip to first unread message

Aquilus

unread,
Sep 14, 2017, 9:50:50 AM9/14/17
to Avian
Hi to all, i'm complitely new to this and i didn't understand pretty much how it works...
I have made a pretty simple program using Swing and i now i want to compile it to an exe that DOESN'T require external dependecies, so searching on the internet i found Avian and i saw that it can do this by packing itself that is a VM and the app in an exe, and that is perfect for me! But i don't understand how to use it, how can i pack my .jar/.class/.java in an exe that use Avian and not the installed Jre (like the example on the website but using Swing instahead of SWT)? 
i don't know if this can help but i'm on NetBeans.

Sorry for my pretty bad english, and thanks to anyone who will help me :)

Joel Dice .

unread,
Sep 14, 2017, 10:07:18 AM9/14/17
to Avian
Hi Andrea,

Unfortunately, Avian doesn't support Swing very well, and it won't
work at all when building a standalone (i.e. dependency-free) exe.
We've always focused on SWT, since it has far fewer dependencies on
the rest of the Java standard library. If, as you say, your program
is pretty simple, I would suggest rewriting the UI using SWT if you
want to use Avian.

Cheers,
Joel
> --
> You received this message because you are subscribed to the Google Groups
> "Avian" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to avian+un...@googlegroups.com.
> To post to this group, send email to av...@googlegroups.com.
> Visit this group at https://groups.google.com/group/avian.
> For more options, visit https://groups.google.com/d/optout.

Aquilus

unread,
Sep 14, 2017, 10:10:31 AM9/14/17
to Avian
Thank you Joel! Once i have rewrite the program using SWT how can i compile to a dependecy-less exe like the example?

PS even Java FX doesn't work? 

Joel Dice .

unread,
Sep 14, 2017, 10:25:55 AM9/14/17
to Avian
I would recommend cloning
https://github.com/ReadyTalk/avian-swt-examples and modifying it for
your app. You'll probably need to customize app.mk in that project
according to your needs. Unfortunately, there's no simple, one-step
process to make an exe out of a Java app -- there's always a bit of
custom makefile and C++ code involved since there are so many
different kinds of apps, dependencies, and platforms to consider.

I've never used JavaFX on Avian, so I don't know if it works.

Panayotis

unread,
Sep 14, 2017, 10:27:53 AM9/14/17
to av...@googlegroups.com
Based on this question, is there any technical reason why Swing won't be compatible with Avian?


> To post to this group, send email to av...@googlegroups.com.
> Visit this group at https://groups.google.com/group/avian.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Avian" group.
To unsubscribe from this group and stop receiving emails from it, send an email to avian+unsubscribe@googlegroups.com.

Joel Dice .

unread,
Sep 14, 2017, 10:43:35 AM9/14/17
to Avian
Last time I checked, Swing does work with Avian, assuming you build
with the OpenJDK class library (i.e. pass the openjdk=$JDK_HOME) flag
to make). However, it doesn't work when you pass the
openjdk-src=$JDK_SRC_PATH flag to make, which is required to make a
stand-alone executable. The reason is that the openjdk-src build
compiles the OpenJDK JNI code from source and statically links it into
the final executable, and currently that only includes the source
files needed to make basic SWT and headless apps work.

To make Swing work with openjdk-src, someone would need to add the
Swing JNI source files to the openjdk-src build. The first step is
adding the needed filenames to openjdk-src.mk. That probably won't be
sufficient, though, since there's usually extra work involved in
tricking the OpenJDK class library into thinking there's an installed
JRE on the system when there really isn't. For example, it will try
to load locale data from a directory under the JRE root directory, so
the VM has to intercept those file open and read operations and
fulfill them using an embedded resource. See classpath-openjdk.cpp
for details.

Short answer: no, there's no technical reason why Avian couldn't
support Swing in a standalone exe AFAIK, but it's probably not easy to
do.
>> > email to avian+un...@googlegroups.com.
>> > To post to this group, send email to av...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/avian.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Avian" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to avian+un...@googlegroups.com.
>> To post to this group, send email to av...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/avian.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Avian" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to avian+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages