Browser using Java not Javascript as DOM manipulation language - java

Is/was there a browser that used Java instead of Javascript as it's client-side programming language?
I appreciate that it would have required sites to have multiple versions of their client-side scripting logic as Javascript always seems to have been the dominant language.
Not as an Applet language, but as the language for interacting with the DOM.
I am aware that IE used VBScript for a while.
I am doing a research project on the evolution of the browser and there is so much noise in search engines for these terms that it is difficult to answer this question.

There is a WebView (based on the WebKit) in JavaFX 2 in which you can pass a Java object to JavaScript an call methods on it.
So this can be considered as a browser running on a JVM. Here is an example of how Google Maps are rendered in this browser: Maps in JavaFX 2.0.
JS-to-Java call sample: WebViewSample.

Related

Why doesn't Chrome Developer's Tools an JS Fiddle include classes and void while in the Javascript console?

I am a new developer, and usually mess around in JS Fiddle and Chrome developer tools. When looking at answers on Stack Overflow, I noticed that user started with public class and static void. Why don't I have to do this in Developer Tools?
Java and JavaScript are not the same thing.
Put simply, Java is a lower level language, designed for server side operation or operation in applets, while JavaScript was originally designed to add interactivity to websites (notably to the usually static HTML content). It has since evolved into the server-side space as well, but there's no need to confuse you with those terms right now.
Today, the two languages have no more common ground than any other two programming languages.
What you see in Dev tools is JavaScript. JS in JS Fiddle stands for "JavaScript".
It's very unlikely you're using Java in your browser, actually. Example Java apps include: Android applications, Eclipse (a code editor suite), your ATM's software, etc. Example JavaScript apps include everything you see on the web on the popular sites: whenever something animates, makes a sound, reacts to your keyboard or mouse input or shows you 3D content without loading Flash or similar plugins, you're usually dealing with JavaScript.

How is google's alternative to awt and swing in Java?

I use swing now for my GUIs in Java, and I was wondering about the quality of gwt. Are there compatibility issues with some things (I have a hard time with serialization sometimes when using swing, as an example), is the interface intuitive? How is the performance?
Swing and AWT are for desktop applications. GWT is for web applications. They're not comparable at all.
GWT is not just a GUI toolkit, it is a complete framework including a Java to JavaScript compiler, for writing Java code to be compiled into JavaScript and run by the browser. It includes support for serialization and other nice things, but it doesn't support the entire Java language/API. (No reflection for example).
Java applets are really just Java applications running within the browser. Applets don't really integrate with the HTML document model, and (Applet's) don't describe their GUI using html.
For doing GUI development: GWT does all its layout in the HTML DOM modul(Like you would if you wrote the JavaScript yourself) so to do layout you need to understand how HTML and CSS work.
Using GWT for GUIs are very different from using Swing/AWT exactly because you need to describe the GUI using HTML/CSS elements.

What client-side browser languages are widely available?

I've read a bit on client-side browser languages and tried a few out but I'm not convinced I know of all the options. To make it clear, I'm looking for something that can be processed either through the browser or otherwise on the clients computer with minimal need for additional installations/configurations.
At the moment I know of JavaScript, Java, and Flash ( I'm aware this isn't actually a language, but seems pertinent to mention it still as an option). If at all possible it seems like avoiding Flash would be best, but it's still a consideration. I know there are various flavors of JS and Java but I don't really know of any that make the end-product that different than just the raw language. Java and JavaScript both seem relatively slow when it comes down to more complex and weighty apps, though performance is always improving as our browsers and libraries get better.
All this said, is there anything available or about to be available that will do things better?
JavaScript is the only native browser language that’s widely supported. Flash isn’t native, but it’s the most widely-supported plug-in.
Nothing else yet seems to be installed widely enough to be worth considering in general, although obviously you should always try to figure out what the actual/intended audience of your specific project has installed.
JavaScript performance has come on leaps and bounds in the latest versions of all browsers as it’s become more widely used.
As far as interface programming goes, the only thing JavaScript has built in is the DOM interface, which lets you programmatically control the HTML page that the JavaScript is running on. The DOM interface is pretty raw and basic, so there are lots of frameworks that try to make it more palatable (like jQuery), and frameworks that seek to provide libraries of desktop-like UI controls (e.g. jQuery UI, Cappucino).
JavaScript is the main language for client-side browser development that interacts with the elements on the page, does ajax requests (update screen without a full page refresh), etc. Depending on your specific requirements, I would recommend JavaScript, as its most likely the tool that will accomplish your needs.
Java is NOT a client-side browser language, Java is a programming language, you can write apps in Java and embed them in a website, that is called a Java Applet. This will require that all users have a JRE installed on their machine for your applet to work.
Java has nothing to do with Javascript -- they share some similar syntax, and thats about it.
Flash is a browser plugin, if you want to write a flash application, ActionScript is the language it uses. It still requires that anyone going to view your application have the Flash plugin installed.
HTML5 is the future.
Currently many features are achieved with JavaScript, but these are being wrapped in libraries (e.g. the "polyfill" library Modernizer and even in other languages, e.g. Java with GWT. This is an area in a greater state of flux than most.
You forgot unity.
Unity is an up-coming client-side application development platform. It does require installing just like flash but it's a lot more powerful then flash and seems to be picking up popularity.
Unity has a lot more inbuild framework rather then doing it in HTML5+JavaScript. I would say these are your two main options. For an example of javascript & html5 in action look at cloud9ide
One of the big advantages of unity is the 3D engines.
Java applets are so 1998 and are not an option.

GWT Strength compared to other framework?

One of the main strength of GWT is to code in java and everything gets compiled and is loaded by several browsers through gwt deferred binding??
Apart from this, i.e. working only on a single code base, do GWT has any other advantage compared to other existing framework??
Edit:
I'm trying to say why should we use gwt and not another framework?? What is there in GWT that makes it special for web application development?? What GWT makes for us and another framework or toolkit don't do??
As i said above GWT makes deferred binding which is a plus, so I wanted what other things it do that makes it special and unique??
My point of view :
Pure Java : In standard web application you write html, css, php, javascript, mysql and others and others. In gwt you write java and java and java. Pure Java knowledge is enough for everything.
gwt-rpc mechanism is very simple to communicate with server and uibinder or any other tools are enough for ui development. plus there are many widgets that facilitate front-end developing
Debug : Debugging Java code is very very easy than debugging Javascript code
MVP Development with Activities and Places
Compiler that you can do all the thing, that you can do in Javascript, in GWT. In addition, working with JSON and XML is very easy and History management is unbleviable
and at last I'm a big big fan of Google and they did it so they did the right thing
One of the other benefits of GWT is that you can share code between the client and server components of your app. For example, if you're doing a graphical app you can write computational geometry code and have the same code evaluate on both sides. Of course, you can also do the same thing by using server-side Javascript (for example, Node.js), but server-side Java has serious advantages for performance, ease of deployment, and interoperability with other things.
My favorite benefit is their RPC mechanisms. JSON gives you a huge reduction in payload size, but GWT's serialization policies allow the data to be sent over the wire without key labels for each value and reduces payload size by another 30% or so. On top of that, its easy to build those services using Spring and Hibernate.
Another benefit is the use of md5 hashes for the filenames of compiled JavaScript, allowing you to set never expires cache headers for all of your code.
Last but not least (actually, it is the least cool of the benefits), there are free tools now for GUI design so you don't have to build a GUI by writing XML and Java or HTML and CSS.
GWT follows a principle of no compromise high-performance Javascript.
They have already invested a lot of work into making your application highly performant. For instance, the "compiled" Javascript files it generates are actually .html files. This is due to an issue that some browsers do not correctly support compressed .js files. This sort of tweaking is beyond what most people would do manually.
There are easy to use tools to help you improve the performance of your own application. GWT.runAsync, for instance, allows you to define splitting points in your Javascript which will be used to automatically divide up monolithic Javascript files into bite sized chunks to load.
As has been said, the RPC mechanism performance and ease of design is amazing. MD5 hash based names for the compiled Javascript means for great caching.
My biggest plus for GWT still has to be the debugging capabilities. Javascript debugging has always been messy and frustrating. With GWT you can employ the full debugging facilities of Java when working on your client side code.
There are no simple answers to these questions:
I'm trying to say why should we use
gwt and not another framework?? What
is there in GWT that makes it special
for web application development?? What
GWT makes for us and another framework
or toolkit don't do??
There is no silver bullet. Everything depends on the project and requirements. GWT may be good in one project and other frameworks may be good in other projects. It also depends which other frameworks are taken into account.
In my opinion the most significant element which makes GWT different from almost all other Java web frameworks is that the client side is fully in JavaScript while most of other frameworks generate usually plain HTML code. The JavaScript approach to the client has its benefits, to name a few:
it is fully AJAX which creates great user experience,
views state is managed in the browser,
it communicates with the server asynchronously;
it communicates with the server only to get the datal
However, there are also some drawbacks:
browser history support - it isn't as good as in HTML based frameworks; proper use of history mechanism isn't easy and requires extra effort from developers;
applications aren't SEO friendly;
more complicated page layouts may kill web browsers - sometimes it takes a long time to generate a page, especially when using additional component libraries;
For developers it is very important that GWT hides JS from them. You write in Java and you get fully working AJAX based client application in JS usually without touching a single line of JS. This is great especially when you need a lot of AJAX in your application and you don't know JS. This is specific to GWT - using JS and AJAX in other frameworks isn't usually that easy (Vaadin may be an exception but it is GWT based).
It is worth mentioning that in many cases GWT can be combined with other web frameworks - this way you can have most of you application content created in HTML based frameworks and some more complicated AJAX parts in GWT.
If you want a recent comparison of Java Web Frameworks, here is an interesting presentation from Devoxx 2010 :
http://raibledesigns.com/rd/entry/my_comparing_jvm_web_frameworks

What are the options for developing powerful browser hosted UI in Java?

I am interested to widen my horizons and wish to learn what are the options for developing a powerful browser hosted UI in Java. All I know is .NET based solutions, specifically Silverlight, which I find extremely powerful, although not without some regretful omissions as compared to its elder brother - WPF.
So, to rephrase my question. Are there mature Silverlight alternatives in Java?
Thanks.
P.S.
I am not starting the war of Java vs .NET, so please do not raise the benefits of Java against .NET in general. I am interested in a specific area only, anything else is put aside.
Please, do not bring Adobe AIR, flex, HTML5, etc... The questions is about Java.
The question is about Java, but front-ends for the web are almost never written in pure Java.
GWT - that's where you write pure Java which is then translated to javascript and html automatically
JSF - you reuse rich components to create your pages. Still there's html and javascript. This resembles the ASP.NET model
Vaadin - heard of it, never used it. Seems promising
ZK - Same as above.
jQuery - yes, this has nothing to do with Java, but is very powerful tool for creating rich UI
Flex - easy integration with Java back-ends. (I personally don't like Flex, but it's a viable option)
(I specifically omitted JavaFX, because in my opinion it is not yet mature)
You know, having rich applications in the browser using Java has existed since, say, 1999 : applets, that's what they're for.
They were long far from beautiful. However, with the recent apparition of JavaFX, they can now have a very nice look.
The closest thing to Silverlight in the Java world is JavaFX. I haven't worked with it myself though, and I don't think I've randomly come across any sites using it in the wild... which means your users are less likely to have whatever plugin is required... and you're likely to be cutting out most mobile users too. (I believe there's a mobile flavour of JavaFX, or at least one planned, but you really want to find out whether it exists on iPhone/Android/(whatever your target market is).
Personally I would probably try to stick to HTML 5 and JavaScript, which can still be pretty rich. (That doesn't necessarily mean writing all the UI by hand, of course - projects like GWT and jQuery are your friends.)
Open Laszlo is worth a look they have a nice interactive demo section too.
The OpenLaszlo platform consists of the LZX programming language and the OpenLaszlo Server:
LZX is an XML and JavaScript description language similar in spirit to XUL, MXML, and XAML. LZX enables a declarative, text-based development process that supports rapid prototyping and software development best practices. It is designed to be familiar to traditional web application developers who are familiar with HTML and Javascript.
The OpenLaszlo Server is a Java servlet that compiles LZX applications into executable binaries for targeted run-time environments.
I'm not sure if it fits your demand but have you looked at the Google Web Toolkit? It compiles Java to javascript and some colleges have made nice UI's with it.
I've used GWT before and more recently Vaadin which I would recommend. You can give it a go at a demo sampler here. I am currently using it to create custom portlets for the Liferay CMS/Portal and I am pretty happy with it.

Categories

Resources