Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET, Java to JavaScript compiler

I am interested to create a drag-and-drop layout designer using only JavaScript, HTML and CSS. The designer will allow the user to drag the page elements from one place to another (something like Blogger's layout designer) to create a site layout. But I don't want to hand code everything in JavaScript, I would prefer to write my application in .NET (preferably) or Java and rely on a compiler to compile it to JavaScript and HTML.

What are the .NET or Java to JavaScript compilers that you have used and can recommend? For Java to JavaScript I know GWT is available. What about .NET to JavaScript? Microsoft did come out with Volta, but the project seems to be no longer available.

like image 726
Graviton Avatar asked Feb 24 '09 04:02

Graviton


People also ask

Can I convert Java to JavaScript?

Designed, developed, and open-sourced by Google, J2CL is a source-to-source compiler that converts Java to Javascript. J2CL developers say the compiler "enables seamless use of Java in your JavaScript applications."

Is there a compiler for JavaScript?

In contrast, JavaScript has no compilation step. Instead, an interpreter in the browser reads over the JavaScript code, interprets each line, and runs it. More modern browsers use a technology known as Just-In-Time (JIT) compilation, which compiles JavaScript to executable bytecode just as it is about to run.

Is .NET like JavaScript?

js is a platform for executing JavaScript on the server-side, whereas ASP.NET helps you develop dynamic web pages using web forms, HTML5, CSS, JavaScript, and templates. If you are a developer looking for a job or want to hire someone to build an application, you should know which one is better.


3 Answers

Look no further, you already mentioned GWT pick that!

It has a very good API and many good applications have use them.

Even JavaScript frameworks like http://extjs.com/ have GWT support.

I use it for an small JavaScript calendar recently.

To be honest, I don't really like JavaScript that much. Most of the times the errors are hard to track (specially for a non JavaScript guy as me) and the workarounds included some plug-ins for the explorer just to get exactly what a compiler should do. Catch silly error early.

In the other hand I'm very familiar with the Java Programming language, and many of the libraries (if not the most important) such as java.lang and java.util have been ported to GWT.

Plus, the guy who wrote relevant parts of java.util is the same behind GWT (google Joshua Bloch.)

like image 125
OscarRyz Avatar answered Sep 17 '22 02:09

OscarRyz


Check out Nikhil Khotari's Script# project. It allows you to write C# code and compiles it to JavaScript.

like image 21
Franci Penov Avatar answered Sep 17 '22 02:09

Franci Penov


  • Script# has already been mentioned. It hasn't been updated since August 2008.
  • Milescript is another, but also has seen very little for 6 months.
  • Extsharp for the Ext library. Adds Ext support for Script#
  • Javascript compiler to Java (going the wrong way for you)
  • Java to script Eclipse plugin

My issues with Script# (a known issue) is it doesn't support jQuery yet. However it comes with a very lightweight library to tie in with the .NET framework, in Nikhil's sscorlib.js file and ssfx.core.js files. And also has support for lots of other Javascript APIs (mostly Microsoft, seeing as he is in the ASP.NET team).

I'd love to see a Script# extension for jQuery (I'm thinking about writing it if it's easy enough). As it stands, most don't provide full compilation yet but they're certainly getting there.

Update: I wrote a small extension to enable JQuery support Script# a few months ago. The project can be found here.

like image 29
Chris S Avatar answered Sep 20 '22 02:09

Chris S