Java and JavaScript

Today, I came up with the idea of “Orto: Java in JavaScript“. Well, it is not “Java to JavaScript”, it is “Java in JavaScript”. It is said that java.lang.Thread is supported. But as there is no downloads available, and it is not open source, so I could not test it.

Supporting Thread programming in JavaScript would be cool. Once I spent some time trying to figure out how to support Thread in Java2Script project, but I failed. But I managed to program execute codes asynchronously by using SWT’s Display#timerExec(int, Runnable) or Display#asyncExec(Runnable) instead. So even though I can not use Thread#sleep, I still can do lots of thread things.

And Orto seems to be in a different way to support Thread, the codes it generated look like these:

case 117:orto246[orto247-2]={high:(~orto246[orto247-2].high)
&0xffffffff,low:(~orto246[orto247-2].low+1)&0xffffffff};
if(orto246[orto247-2].low==0){orto246[orto247-2].high++;
orto246[orto247-2].high&=0xffffffff;
orto246[orto247-2].low=0;
}break;

Compiling to Java code into byte-code like script, and loading and running these scripts in “JVM” should be a way to support all Java things. In my opinions, all locks and threads are re-implemented. Performance should be a problem. I know that there is another project called XML11, which is also trying to compile Java codes into JavaScript byte-code.

And recently, I also noticed that there was a debate about GWT Ext or Ext GWT. You may already know that GWT is about compiling Java to JavaScript and Ext JS is a HTML/CSS+JavaScript based UI library. It is interesting to see people combine these two technologies together. And it is more interesting that putting GWT before Ext JS and putting Ext JS before GWT is two different things. You may want ot read Didier Girard’s discussion for a clear idea.

About 2 years ago, when I started Java2Script project, I had to think about its programming model. At that time, people began to wrap existed JavaScript library in Java way. I called it “JavaScript for Java (JavaScript4Java)”, which is quite different from my “Java to JavaScript (Java2Script)”. So “2″ and “4″ is totally different, right?

In fact, I do know that Java and JavaScript are two different language. The reason that I chose Java as the source and JavaScript as the target is that Java is most beautiful and most used language while JavaScript is a world wide supported language. And I am familiar and love Java language. So I created Java2Script. I do believe that C#-to-JavaScript, Ruby-to-JavaScript or Other-to-JavaScript is not a big deal for me. But I may not have energy to make a similar compiler.

Java and JavaScript may be hotter and hotter. Good to see that more and more people is linking Java and JavaScript together.

This entry was posted in Java, JavaScript and tagged , , , . Bookmark the permalink.

13 Responses to Java and JavaScript

  1. zproxy says:

    As a reference for the readers, jsc does the C#-to-JavaScript, C#-to-ActionScript and C#-to-Java compilation. see for more: http://jsc.sf.net

  2. Sam says:

    D I’m happy I found you. Maybe we should tell ppoele what happened? Well, we went to Gf6teborg to take some photos (see above street QTVR post) when we arrived I realized that I had forgotten my phone AND camera (I had my bag, tripod and pano head) so I left Linn in the city and went home. Soon I realized that I had HER phone in the car so we had no way of communicating. Well we bumped in to each other and before that Linn tried to reach me on my home page. :) Now you know!

  3. say thanks to a lot for your web site it assists a great deal.|

  4. Good Site, Stick to the fantastic work. Thanks a ton!.

  5. air yeezy says:

    I and my guys have been taking note of the good suggestions found on your web site and so immediately got a terrible feeling I had not thanked the web site owner for those techniques. Those boys are actually for that reason passionate to learn them and have now clearly been using them. Thank you for genuinely simply helpful and also for getting such ideal subject matter most people are really wanting to be aware of. My personal honest regret for not expressing gratitude to you sooner.

  6. I’m just commenting to make you understand of the brilliant discovery my girl had using your web page. She came to find numerous pieces, including what it is like to possess a great teaching style to get the mediocre ones smoothly learn specified tricky subject matter. You truly exceeded readers’ expected results. Many thanks for coming up with those necessary, healthy, informative and also unique guidance on your topic to Ethel.

  7. I must show my appreciation to you just for rescuing me from this particular challenge. Right after researching throughout the the web and getting notions that were not productive, I thought my entire life was done. Existing without the presence of answers to the difficulties you’ve sorted out by means of the website is a critical case, as well as those that would have badly damaged my career if I hadn’t discovered the website. Your own natural talent and kindness in taking care of a lot of stuff was vital. I’m not sure what I would have done if I hadn’t come upon such a solution like this. It’s possible to at this point relish my future. Thanks a lot very much for your skilled and effective guide. I won’t be reluctant to propose your web blog to anybody who will need tips on this subject matter.

  8. nike dunks says:

    I in addition to my buddies were actually looking at the excellent tips found on your web blog while unexpectedly I got an awful suspicion I never thanked the web site owner for those secrets. All the men are already for this reason very interested to read through all of them and have actually been tapping into those things. We appreciate you being considerably helpful and for using certain great guides millions of individuals are really eager to discover. Our honest regret for not expressing appreciation to you earlier.

  9. I intended to draft you that very small note to help say thanks a lot once again about the awesome strategies you’ve shown on this site. It was wonderfully generous with people like you to give easily exactly what numerous people would have supplied as an e book to get some profit for their own end, chiefly given that you might have tried it if you desired. Those principles in addition acted to provide a good way to recognize that many people have the identical desire similar to mine to realize many more on the subject of this matter. I believe there are some more pleasant occasions ahead for people who looked over your site.

  10. Thanks a lot for providing individuals with an extraordinarily remarkable chance to discover important secrets from this blog. It is usually very excellent and as well , stuffed with a lot of fun for me and my office friends to search your blog no less than three times a week to study the newest stuff you will have. Of course, I am just always pleased considering the impressive knowledge served by you. Selected 1 points in this posting are essentially the very best I have had.

  11. jimmy choo says:

    I needed to write you one tiny observation to finally give thanks yet again on the pretty tricks you’ve shared on this page. It is really incredibly open-handed with you to make unreservedly all many people would’ve made available for an ebook in order to make some money on their own, even more so seeing that you might well have tried it if you ever desired. Those advice in addition worked like a good way to be sure that other people online have the identical interest similar to my own to know a good deal more regarding this matter. I’m certain there are some more fun times ahead for those who looked at your site.

  12. I wanted to post a brief remark so as to thank you for those marvelous hints you are showing at this site. My time consuming internet look up has at the end been rewarded with good suggestions to exchange with my pals. I would repeat that most of us readers actually are rather blessed to exist in a fabulous community with many brilliant individuals with beneficial principles. I feel rather privileged to have used the website page and look forward to plenty of more thrilling times reading here. Thanks a lot again for everything.

  13. Nice post. I study one thing tougher on different blogs everyday. It should always be stimulating to read content material from other writers and practice a bit something from their store. I抎 favor to use some with the content on my weblog whether you don抰 mind. Natually I抣l offer you a hyperlink on your net blog. Thanks for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>