SWT Examples Don't Run

111 views
Skip to first unread message

Martynas Petkevičius

unread,
Jul 15, 2016, 4:50:43 AM7/15/16
to Avian
I have built SWT Avian examples as described here using the latest source code from avian, avian-swt-examples and win32 repositories. The dependency download links no longer worked, so I've downloaded ProGruard, LZMA from official websites.

I downloaded ProGuard 5.2.1 and modified version number in app.mk. I tried ProGuard 4.11 too, but the build failed saying that some class has version number 52.0 and only up to 51.0 is supported.

I downloaded version 9.20 of LZMA as suggested in Avian's documentation. LZMA 16.02 didn't work.

I couldn't find version 4.3 of SWT, thus used 4.5. I built the examples from avian-swt-examples repository with SWT 4.5 using Oracle JDK to see if there are any compatibility issues, but it worked fine.

I built SWT examples using the setup described and the command make lzma=$(pwd)/lzma920 full-platform=windows-i386. Build succeeded, but I'm unable to run any of the examples. example.exe returns instantly without outputting a single line to the console. What am I doing wrong?

Joel Dice .

unread,
Jul 15, 2016, 11:53:38 PM7/15/16
to Avian
Hi Martynas,

Sorry you ran into all those issues trying to build the examples. The
class file version issue is probably due to using JDK 8 to compile,
whereas ProGuard 4.11 only works with class files compiled with JDK 7
or earlier.

You might have better luck with these, more up-to-date instructions:

http://readytalk.github.io/avian/#-xamples

When I have time this weekend, I'll go through the build process
myself and fix any problems I find, and I'll make sure the
avian-swt-examples README.md is updated.
> --
> 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.

ad...@tec.hn

unread,
Jul 16, 2016, 4:38:06 AM7/16/16
to Avian
Thanks for the help, Joel. This time I used the exact instructions from here. I downloaded all dependencies from URLs provided and I used Oracle JDK 7u79. Results are the same – the build process succeeds, but when I try to run example.exe, it exits instantly with no output.

Joel Dice .

unread,
Jul 17, 2016, 9:21:42 PM7/17/16
to Avian
I was able to reproduce the issue, and it seems to be due to how the
LZMA-enabled executable works.

When you build using LZMA, the application (i.e. the VM and all the
class and resource files) is compiled into a DLL file which is then
compressed with LZMA and embedded into an executable whose job is to
extract the DLL, decompress it into a temporary file, load it, and
start the application.

However, on Windows 10, we get this:

$ ./build/windows-i386-lzma/example/example.exe
unable to load C:\cygwin64\tmp\223580F.tmp: unknown error

Apparently the OS won't let us load the DLL from its temporary
location on disk, perhaps as a security measure.

The workaround is to omit the lzma=... flag from your make command.
The resulting executable will be large, but it will run.

Meanwhile, if anyone on this list happens to know why loading from a
temporary DLL as described above does not work on Windows 10, I'd be
interested to know. We used to use UPX for executable compression,
but it got so buggy and out of date that I gave that up and made my
own hacky alternative. Apparently neither option works reliably, so
perhaps we should just give up and leave the executables uncompressed.

BTW, you also have the option of compressing only the embedded Java
code with LZMA (and leaving the native code uncompressed). The total
executable size won't be as small as when everything is compressed,
but it's far more reliable since it doesn't rely on temporary DLLs or
any OS-specific tricks. See the documentation for the lzma option in
the Avian README.md for more details and let me know if you need help
using it.

Also BTW, you can use JDK 8 to build the examples, but you have to
edit avian/makefile and avian-swt-examples/app.mk to add the "-target
1.7 -source 1.7" options to javac.

Martynas Petkevičius

unread,
Jul 18, 2016, 2:08:42 AM7/18/16
to Avian
 I'm afraid you're experiencing a completely different issue. On my setup, example.exe produces no error messages and doesn't start either. Removing LZMA changes nothing:

Joel Dice .

unread,
Jul 18, 2016, 8:21:06 PM7/18/16
to Avian
Hmm, I don't know what the problem is, then.  It's working fine on my machine without LZMA.

You might want to try running it in a debugger like the one in Visual Studio Express.  Otherwise, you could try adding a printf statement to main.cpp to determine if the executable is starting at all, or if the process is executing before the main function is even called.

Also, I've uploaded the version I built here: http://concelo.io/example.exe.  Try downloading that and see if it works.  If not, there's something different about your Windows machine compared to mine.  Perhaps there's some kind of anti-virus software that's silently preventing it from running?

On Mon, Jul 18, 2016 at 12:08 AM, Martynas Petkevičius <ad...@tec.hn> wrote:
 I'm afraid you're experiencing a completely different issue. On my setup, example.exe produces no error messages and doesn't start either. Removing LZMA changes nothing:

--

Martynas Petkevičius

unread,
Jul 20, 2016, 12:26:25 PM7/20/16
to Avian
I've found another PC to try the build on, but got exactly the same results – the program exits instantly on any machine. I also tried adding a printf() statement right after main(), but didn't get any output to the console. The executable you uploaded, however, works fine.

Can you tell me more about your development environment? What's the OS and how many bits? I saw you are using 64 bit version of Cygwin, right? What exact version of JDK are you using? Also, are you doing anything besides what's in the instructions?

I also attached the output I get when building. It has lots of warning, maybe they give some clues? Also, here's the resulting exe.
example.log

Joel Dice .

unread,
Jul 21, 2016, 12:27:14 AM7/21/16
to Avian
I'm using 64-bit Windows 10 and the 64 bit version of Cygwin.

$ ${JAVA_HOME}/bin/java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

Here are the commands I used, exactly:

mkdir work
cd work
curl -Of http://readytalk.github.io/avian-web/proguard4.11.tar.gz
tar xzf proguard4.11.tar.gz
export swt_zip=swt-4.3-win32-win32-x86.zip
export platform=windows-i386
curl -Of http://readytalk.github.io/avian-web/${swt_zip}
mkdir -p swt/${platform}
unzip -d swt/${platform} ${swt_zip}
curl -Of http://readytalk.github.io/avian-web/avian-1.2.0.tar.bz2
tar xjf avian-1.2.0.tar.bz2
curl -Of http://readytalk.github.io/avian-web/avian-swt-examples-1.2.0.tar.bz2
tar xjf avian-swt-examples-1.2.0.tar.bz2
git clone https://github.com/ReadyTalk/win32.git
cd avian-swt-examples
make full-platform=$platform javac="${JAVA_HOME}/bin/javac -target 1.7
-source 1.7" example
./build/windows-i386/example/example.exe

Joel Dice .

unread,
Jul 21, 2016, 12:30:12 AM7/21/16
to Avian
Here's what I get when I run the exe you provided:

$ ./example.exe
java/lang/ExceptionInInitializerError
at org/eclipse/swt/examples/controlexample/ControlExample.main (line 203)
caused by: java/lang/RuntimeException: Parse error @5:
\r?\n\z|[\p{Punct}]+[\t ]*\z|[^\p{Punct}\s\n\r]*[\t ]*\z
at dc.a (line 410)
at dn.a (line 49)
at dn.a (line 42)
at org/eclipse/swt/widgets/Scrollable.<clinit> (unknown line)
at org/eclipse/swt/examples/controlexample/ControlExample.main (line 203)
Entered main()Creating JVMExiting

On Wed, Jul 20, 2016 at 8:23 AM, Martynas Petkevičius
<mpetke...@gmail.com> wrote:

ad...@tec.hn

unread,
Jul 21, 2016, 1:58:07 AM7/21/16
to Avian
Thanks, I'll retry with the exact setup you have.

What's odd is that you get error messages and printf() statements I put in. I tried running the same EXE on three different machines and didn't output anything.

ad...@tec.hn

unread,
Aug 1, 2016, 3:15:49 AM8/1/16
to Avian
I finally managed to build the project on a VM. In case somebody else has the same issue I had, I attached Vagrant config that worked for me. The only things it is missing are JAVA_HOME setup and running of build.sh via Cygwin console.
config.ps1
Vagrantfile
Reply all
Reply to author
Forward
0 new messages