A lightweight cross-platform GUI application framework based on Avian and SWT
(these pictures show an example application made upon Zetes framework)
Zetes is a crossplatform lightweight framework which allows the user to develop console or native-looking GUI programs, written in Java, that could run on a machine without any JVM installed.
The core of Zetes is built upon Avian Java machine implementation which would be embedded into every target binary thus your program could run without any dependencies except the system API. Imagine your program that has been written in Java and it even could run external jars, but it doesn't need any JRE or JDK installed at all. Really. It's just an exe file. And in addition it has a beautiful GUI (based upon SWT).
The main feature of the library is that it makes a thin wrapper on SWT and basic system libraries that makes it possible to make an app which has a native look-and-feel under different platforms. For example, the "Exit" item is in system menu on OS X, but in "File" menu under Windows; about box has "OK" button in Windows, but doesn't have any on OS X and so on...
The user of the library shouldn't think about such differences. That's why Zetes could be useful.
If you want to see some demo applications that show up zetes features, take a look at zetes-examples project.
Operating systems supported at the moment:
Hopefully it should work under any Intel-based Linux, Windows or Mac platform and on everything compatible with Raspberry Pi.
At first you should prepare the environment. Although Zetes is a crossplatform library and its building process is the same on any supported platform, at first you need to prepare environment and this preparation is a different process on different platforms.
Since Windows isn't a POSIX platform, the environment preparation isn't completely trivial. In Windows it would take about 10-15 minutes.
Download and install Oracle JDK 7 (it isn't needed to run the target binaries, but it's used to build them and the framework itself, cause it doesn't contain any Java compiler tool). You can get it from the official download site.
This framework is made crossplatform and it needs Unix compilers and tools to work, so under Windows you need
mingw-w64 to build (and use) it. If you have a 32-bit OS, don't worry – mingw-w64 is equipped with 32-bit tools as well as 64-bit ones.
Go to http://mingw-w64.sourceforge.net site, find Mingw-builds title there. Under this title you will find a list of implementations for different Windows platforms and a small link to the universal installer (the direct link to the installer). Download this installer, run it and install any mingw toolchain suitable for your system. Avoid installing it to a default "Program Files" folder cause you could have problems with configuration (caused by spaces in $PATH). I'd recommend c:\mingw\mingw-builds<i>nameoftoolchain\
Now you have gcc compiler, but don't have a proper unix environment for it. You should take it from the same place. It's called MSYS and located in the same sourceforge repo as mingw-w64.
Open http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/ and download the latest msys+7za+wget+svn+git+mercurial+cvs-rev??.7z version. The direct link to the current version is msys+7za+wget+svn+git+mercurial+cvs-rev13.7z
Extract the archive contents to some folder next to your mingw compiler toolchain (I'd recommend c:\mingw\mingw-builds\msys).
Enter the subdirectory
etc under the newly created directory
There you'll find a file named
fstab. Open it with your favorite plain-text editor (notepad++ or something else supporting Unix EOLNs) and insert there
where the path should be changed to your path and XX is "32" on i686 system and "64" on x86_64. The entered path should exist and contain the compiler toolchain. for example, on my machine this line looks like this:
And the last preparation. You should set a couple of variables for your MSYS profile to connect it to your JDK.
In the same directory as
fstab there is a file named
profile. Open it. It contains many commands used to initialize MSYS environment. You should add a one or two lines to its end.
On 32-bit system write one line:
On 64-bit system you should write two lines
export JAVA_HOME="" export ARCH=x86_64
For example, on my machine it looks like
export JAVA_HOME="C:\Program Files\Java\jdk1.7.0_17" export ARCH=x86_64
The last thing. The default Git configuration on Windows includes an option to change all line endings to CRLF (Windoes). But the native line ending for MSYS utils and text processors is LF (Unix). So if Git change the line endings on checkout, some files will be broken - that influences installation process. So we are turning the conversion option off.
git config --global core.autocrlf input
This is a global option. If you need to turn it back (for other tasks), just type
git config --global core.autocrlf true.
Now let's check the configuration. Make sure you've saved all the files you've edited recently. Go to your
msys directory and run
msys.bat script there. It will open a terminal window for you. This terminal isn't a simple one. It's an MSYS terminal. You will use it to work with Zetes framework and your projects dependent on it.
Let's do two tests to ensure everything's configured fine:
Enter this command in MSYS terminal:
If you see something like
gcc.exe: fatal error: no input files
gcc compiler (and all the toolchain) is installed properly. If the response is like "command not found", something's gone wrong.
Enter this command to MSYS terminal:
Notice this quote marks. They are necessary. As a response you should see a long "usage" instruction for
javac Java Compiler tool. If not, something's gone wrong.
Congratulations! You have configured your environment successfully.
There are many deb-packaged distros out there and the preparation of the most part of them to build Zetes should be alike. I'm using Mint 16. First of all let's install all the dependencies:
sudo apt-get install git openjdk-7-jdk libglu-dev libz-dev g++
Here we are installing OpenJDK for Java, libGLU and libGL for graphic API (used in some example programs), zlib development package and GNU C++ compiler for building native bindings.
Next step - setting Java Home location:
On OS X you should install Command Line Tools for Developers. Go to https://developer.apple.com/opensource/, click "Command Line Tools" there. Login with your Apple ID, select the latest version of the tools for your OS version (I selected April 2014 for Mavericks). When the image file is downloaded, mount it and install the package inside.
Then go to the Oracle site for downloading JDK. Open http://www.oracle.com/technetwork/java/javase/downloads/index.html, select JDK 7 there, download it and install.
Enter this command in a terminal window:
You should see:
clang: error: no input files
Yeah, that's Clang pretending being GCC. If the response is like "command not found", something's gone wrong - you need to check your Command Line Tools.
Enter this command:
As a response you should receive something like
That's your JDK path. If its name looks suspicious, you could check its version by typing
The answer should contain a line
java version "1.7."
If the version is 1.6 - you downloaded a wrong Java version, or install Apple Java instead of Oracle Java.
If everything's ok, let's proceed.
This part is much easier then the previous one.
On Windows open the MSYS terminal (with msys.bat). On other platforms a simple terminal window would be sufficient.
Enter your Projects folder. Now you should get Zetes source (you may already have got one with "Zetes Examples" source). Let's check for its existence:
If you see
zetes folder, it's already here, so skip the next command. Otherwise input the following:
git clone https://github.com/bigfatbrowncat/zetes.git
Wait till it ends downloading the repo and enter the newly created
Now let's clone every dependent repository with:
git submodule update --init --recursive
That will take a couple of minutes.
Then a very important step - we should choose which version of Java classpath we are using - Avian or Android. Avian classpath isn't complete, it lacks many useful features, but it's designed specially to work with Avian and it has a GPL-compatible BSD license. On the other hand, Android classpath is almost full and compatible with the original Oracle classpath. But it's not native for Avian and especially for Windows (but we are working on its better integration). Additionally, it's quite heavy - there is a pretty high overhead (about 20 Megabytes of extra resulting binary size).
If you are building the demo applications, Avian classpath would be enough (and recommended).
For Avian classpath type:
For Android classpath type:
Then finally execute
Zetes will be built completely (if no errors occured during the building process).
If you are building zetes-examples, proceed with the instruction published here.