The book of inspiration

July 23, 2010

Error loading jvm

Filed under: jsc — Tags: , , — zproxy @ 9:24 am

When I was trying to use jsc to build a flash component the mxmlc compiler failed to launch with this message:

[exec] Error loading: C:\Program Files\Java\jre6\bin\client\jvm.dll

Error loading: C:\Program Files\Java\jre6\bin\client\jvm.dll

To fix that I copied from:

“C:\Program Files\Java\jre6\bin\msvcr71.dll”

to (x86)


to (x86) on 64bit windows


Then I ran the generated swf file in the flash player which told me the following:

VerifyError: Error #1014: Class mx.core::BitmapAsset could not be found.

As this component was not part of the new BrowserApplication project template it had a custom build.bat which needed a new flag to be passed mxmlc.


Update from the future: While setting up a build environment in Amazon EC the same problem occurs.

See also:

February 22, 2010

JSC Ultra to reuse native source code

Filed under: jsc — Tags: , , , , , — zproxy @ 9:48 am

As advertised the developers will be able to seamlessly create flash sprites and java objects inside their javascript applications in C# via the jsc ultra offering. What if they could just drop some native source code and be able to reuse them in C#?

At the moment only the HTML web page is converted to DOM building code which looks like this under reflector.

In the future releases the native source codes could be parsed and placed in the correct location based on their namespace for their respective back-end compilers.

Seems like I will need source code parsers to pull it off. First step is to generate a stub. The next step would be to convert the native source to IL. If we go just for the first step, then one can surely benefit from some native language specific syntax constructs.

Update: The second pass would mean that the native back-end compiler does it’s job and jsc will go and decompile JVM or AVM to IL as jsc is not about compiling source to IL.

Then you could consume the  in your javascript code like this:

42 var Applet1 = new AboutApplet();


44 Applet1.Method1(“hello world”);


46 var Applet1Element = Applet1.AttachAppletToDocument();


48 = “1px solid red”;

This will create a red java applet in your browser.

The should could look something like this:

1 // PromotionWebApplication1.AboutApplet.dll

2 package PromotionWebApplication1;


4 import java.applet.Applet;

5 import java.awt.Component;

6 import java.awt.Container;

7 import java.awt.image.ImageObserver;

8 import java.awt.Panel;


10 public final class AboutApplet extends Applet implements ImageObserver

11 {



14 public AboutApplet()

15 {

16 super();

17 }



20 public final void Method1(String p)

21 {

22 }


24 }


Cool features ahead. Including HTML5 🙂 Including an actual installer!

jsc has now a twitter feed!

PS. What about .class, .jar, .swf, .swc? 🙂 I surely would like to pull media from online .swf files just to be able to recompile them into my own application.

Hey Compiler that flash game there has nice logo and sound, could you go ahead and make them accessible for me in the code? Thanks! 🙂

December 29, 2009


Filed under: jsc — Tags: , , , , — zproxy @ 2:11 pm

Let’s build some muscle on jsc.

OrcasMetaWebService. Crosscompiled from C# to Java for Google App Engine and PHP.

The idea is that your little cute Web Service will be running on PHP and Google App Engine. See the C# source code used in this example over here.

  • See live example running on PHP.
  • See live example running on Google App Engine java

There are features missing. But you sure can see where it is going 🙂

PS. Video parameters “&w=800&h=500&fmt=18″


I had this idea to publish the web services via WSDL with HTTP Protocol. But it seems this scenario isn’t exactly supported by the big old Microsoft just yet. So the next step would be to implement xml-soap?

See also:

October 1, 2009

jsc is awesome

Filed under: jsc — Tags: , , , , , — zproxy @ 7:40 am

Now that I got your attention:

There is a new release for jsc with two new screencasts. This time around you are able to omit [Script] attribute and ditch the tools/build.bat. The jsc solution now includes  the jsc.meta compiler which will talk to the other compilers for you.

I am also experimenting with pre compilers. For example the Forms example makes use of TextualUserControl and TextComponent. Without getting too technical they generate a new assembly and add the reference to your csproj file. This opens up some really interesting possibilities. I will talk more about this in future posts.

Future pre compilers in jsc solution could include automatic stub generators for java jar files and for flash swf and swc files.

Open javascript version.

Open actionscript version.

Open javascript version.

Open java version:


PS. Video parameters “&w=800&fmt=18”

August 31, 2009

Delaunay triangulation

Filed under: jsc — Tags: , , , , — zproxy @ 6:28 am

There is a new example in town and it is about Delaunay triangulation. The original java source code can be found here.



With this example I had to add a significant bit of awt and swing classes to ScriptCoreLibJava which ofcourse will deem helpful once it is time to start implementing Windows Forms for java.

PS. Did you know? javax.swing.plaf stands for platform look and feel 🙂

Problems at porting which should be fixed in the future versions:

  • C# won’t allow nested classes in interface. Workaround is to use “sattelite” nesting parent class.
  • Calling base method from a virtual method seems to be broken and will cause stack overflow. fixed
  • The is operator in if expression was missing parenthesis. Workaround is to use local variable.
  • The boolean comparision in if expression should be optimized. Workaround is to use local variable.

July 28, 2009

Stress testing Google App Engine

Filed under: jsc — Tags: , , — zproxy @ 6:29 am

So I have this idea to utilize Google App Engine as a multiplayer game lobby. Flash games tend to peak high upon the very first days of the release. As there are quotas for free service I had to run some tests to get an idea what to expect. At this time I am using memcache as a game server registrar. The registration was set to expire within 1 minute. I prepared a stressor program to issue game server registrations an a continuous loop.



In 12 hours I had issued about 40000 game server registrations.  It seems the CPU time is quite high. The average response time was also 22 seconds. Now I need to implement the logic that a game would first try to connect another game before promoting itself as a server.

Update: You can use a naked domain with google app engine with an URL redirect.

July 13, 2009

Nobody likes the records that I play

Filed under: jsc — Tags: , , — zproxy @ 7:02 am

It is time to make yet another release of my jsc compiler. This time around you can finally use anonymous non generic delegates with java. Coolness! Subscribing to events and threading is now much easier. For applets you’d need to write a delegate to interface wrapper tho…

In the release you have a project template at C:\util\jsc\templates\

At this time I modified it to show off the anonymous delegate support. In debug build mode this project can be debugged using F5 in Visual Studio on .net. If release build was selected the jsc compiler will be invoked as a post build event to generate java source code then javac and jar will be invoked. To run the new java package you need to start the tools/run.jar.bat.

javaevents by you.

How will that delegate keyword work out in java source code you ask? Here is the for you to inspect.

javaevents2 by you.

As you can see there is some magic involved, where magic is the compile time code generation. While jsc has been around for years – it took just that long to actually implement the delegate support. It is running via reflection and as such not really that performant, but at this time we cannot take a function pointer in java can we.

PS. It seems sourceforge is not showing statistics for me anymore – whats up with that?

June 9, 2009


Filed under: games — Tags: , , — zproxy @ 7:01 pm

Check out this cool java game 🙂

minecraft by you.

See also:

April 8, 2009

Google App Engine SDK for Java

Filed under: life — Tags: , , , , , — zproxy @ 10:05 am

Powered by Google App Engine

App Engine runs Java applications using the Java 6 virtual machine (JVM).

  • CPU Time: 6.5 hours of CPU time per day
  • Bandwidth: 1 gigabyte of data transferred in and out of the application per day
  • Stored Data & Email Recipients: unchanged

I think I will create an example how to write for Google App Engine in C# via my jsc compiler within this month.

Unless ofcourse they will support MSIL natively which I dont think will happen…

You may wonder whatever happened to MS Java or maybe J#

Some feedback from Slashdot on the Google App Engine topic:

[…] It’s not the restrictions, it’s the implementation. Normally, existing Java code could just be compiled on the embedded system, and compiler errors would specifically identify security reasons for specific classes/methods/etc being disabled. Google removed the classes entirely, so the developer will just get IDontKnowWTFThatClassIs exceptions instead, which are less informative.

It also contravenes existing standards, sort of like making “dangerous” files invisible to unprivileged users in *NIX (via some sort of arcane black magic, perhaps a modified (munged) shell or something…) instead of just setting appropriate file permissions.

Did you know that your application will be running on multiple VM’s. So we do actually have threading support, it is just i another form.

[…] It even supports loading bytecode generated at run time. That means that our new Java runtime can support any language with a compiler that targets the JVM

You need to take extra care to enable HTTP sessions to which you could write data. It may look like a vendor lock in solution whether it is or is not remains to be decided…


November 20, 2008

AvalonWebApplication with PHP backend

Filed under: jsc — Tags: , , , , , , , — zproxy @ 7:41 pm

I have created a new project template that demonstrates most of what jsc is capable of. Soon I will publish it on the sourceforge with a tutorial how to get started using it.

Long story short – Here is an application which demonstrates the following features all written in C#:

  1. PHP Backend
  2. JavaScript (WPF)
  3. ActionScript (WPF)
  4. Java Applet

Update: Moved the example to sourceforge and removed the querystring switch.

July 17, 2008

Two New Examples

Filed under: jsc — Tags: , , , , , , — zproxy @ 3:11 pm

The RayCaster is based on this source and is just what you need to when you start making one of these Wolf3D games. The ZIndex demo shows how you could emulate the missing z-index property in flash 9.

June 12, 2008

Jsc June Refresh 2

Filed under: jsc — Tags: , , , , , , , , , , — zproxy @ 4:29 pm

Some updates to the compiler and the framework: Download jsc here. (Others already have!)

Added two Java project templates.

Visit our google groups.

Tutorials to read when just starting with jsc:

This release contains the following Project Templates:

OrcasAppletApplication – C# to Java Applet
OrcasFlashApplication – C# to ActionScript
OrcasScriptApplication – C# to JavaScript
OrcasVisualBasicFlashApplication – VB.NET to ActionScript
OrcasVisualBasicScriptApplication – VB.NET to JavaScript
OrcasWebApplication – C# to JavaScript as Microsoft Web Application
OrcasWebSite – C# to JavaScript as Microsoft ASP.NET Web Site
OrcasJavaConsoleApplication – C# to Java as Console Application
OrcasNativeJavaConsoleApplication – C# to Java as Console Application with JNI bindings.

Have a look at some old screencasts:

June 6, 2008

Jsc June Refresh

Filed under: jsc — Tags: , , , , , , , , , , — zproxy @ 2:43 pm

Some updates to the compiler and the framework: Download jsc here.

Most important update was fixing the virtual + override semantics for jsc:actionscript. It’ did not allow to combine multiple events for example.

Visit our google groups.

Tutorials to read when just starting with jsc:

This release contains the following Project Templates:

OrcasAppletApplication – C# to Java Applet
OrcasFlashApplication – C# to ActionScript
OrcasScriptApplication – C# To JavaScript
OrcasVisualBasicFlashApplication – VB.NET to ActionScript
OrcasVisualBasicScriptApplication – VB.NET to JavaScript
OrcasWebApplication – C# to JavaScript as Microsoft Web Application
OrcasWebSite – C# to JavaScript as Microsoft ASP.NET Web Site

Writing code in VB.NET for flash looks like this:

Blog at