Three years ago (or so) I did experimental project named J-SMILE to prove that it is possible.
Main idea of it is simple – to create as small as possible Java (Virtual Machine) that can be attached to compiled Java bytecode (.class files).
Physically J-SMILE VM is an .exe file of size 200k. These 200k include:
- Waba VM extended to support Java 1.2 language specification pretty much in full – green threads, copying GC, float support.
- Set of native GUI functions (Graphics, Font, Window, etc).
- Special class loader capable to load class files from trailer – .class files packaged and attached to the end of the exe file of J-SMILE VM.
I have designed mini set of GUI primitives (Widgets) like listbox, editbox, etc. and created this simple demo application:
This demo application is about 400k = 200k of J-SMILE VM + all classes needed to run it ( mini version of java.lang.* and smile.* ). Source code of class files used in this application is here.
No JRE/VM version checks, no installation step needed, self-sufficient… Cool, eh?
And now goes the question: why all Java GUI solutions so monstrous and heavy?
Premature Generalization, eh? Got Deja Vu reading excellent Eric Gunnerson’s C# Compendium.
12 Replies to “Java GUI executable without JRE… Are you kidding me?”
ok. so how do you build the .exe?
Building process is simple: after compilation we get .class files of application.
I also have vm.exe – pure vm and runtime.
Assembling final exe file is a matter of simple concatenation of the .class files with the vm.exe.
Native class loader that I have in vm.exe is aware of the attached class files.
That is really simple.
Where can I find this vm.exe and instructions on how to properly concatenate class files to it ?
vm.exe (to be precise j-smile-vm.exe) is my VM compiled into EXE.
I did not publish it as a standalone thing.
j-smile-vm was derived from
http://waba.sourceforge.net/. I’ve made there couple additions to support Java 1.2 and added set of native GUI primitives.
That was experimental project – proof that it is feasible to make a) small and b)self-sufficient exe’s with Java.
Project was frozen as it was not too much interest to it at that moment. For some reasons.
This is very interesting. Is there a way I can get my hands on vm.exe? I have developed a few applications I would like to let people use, but asking people to install the JRE is too much burden on them. My apps are designed for the not-so-computer-savvy (the general population). Because my apps are so simple, It would not be too much trouble to port back to Java 1.2 and make any adjustments to use your UI. Thanks.
This is GREAT!
Why not release the source or even make it into a commercial product?
I know I could use it.
To -josh: I simply do not know how Sun will react on such JavaVM if it would be a commercial project. Microsoft tried to change Java runtime model once… I simply do not have enough money to deal with such things.
About source code: article above has a link on the Waba VM on SourceForge. It can be used by anyone to implement something close to this.
You’ll have no problems as long as you don’t call it Java. You can call it “Java Like” or “Java Syntax Compatibly” or “Java Style”. You just can’t call it Java(TM) unless you are a Sun licencee. Microsoft was a Sun licencee, so they had signed a contract about what they were allowed to do and not do while still calling it Java. This is where they got into trouble.
Check out here for more info…
Ok, let’s say it will be named as JavaVM alike something. But JavaVM per se is just a part of the iceberg. There is also its class library that actually makes Java Java. Yes, I’ve implemented very small subset of the class library for the demo. But it is not enough for something real.
By the way it is in principle possible to implement the same idea with the Sciter. It is not hard to do such a compiler that will take html/css/scripting files of the application, compile and assemble them with the SciterVM/runtime into single executable. I think this will have more chances to fly.
Sciter already allows to do pretty complex things as e.g. /screenshots/scide2.png – ScIDE scapp.
i’ve created the exe file of java but it runs only in java environment, i just want my executable file to be run in any system without installing the javaEnvironment, please send me steps to run the exe file in any machine.
There are tools that package everything in an exe file, embedding the JVM if necessary. Launch4J is one. Of course, you would need to provide the jre, or let the .exe ask the user to download and install a specific JRE.
As for J-SMILE, it is quite nice, something different from other AOT compilers, that btw you can use to package your Java application (up to 1.4 and with SWT for free) using GCJ, or pay for Excelsior JET.
Comments are closed.