restrictions of JAVA while using with GWT

86 views
Skip to first unread message

konquerror

unread,
Jul 9, 2007, 1:25:36 AM7/9/07
to Google Web Toolkit
Hi all

I am doing a project over GWT, and making some small applications
using GWT.

While using it i tried to look out for what features of JAVA can not
be used while using it in GWT environment.

some of them i have came across, like multithreading and some more.

can anyone tell me about more things which we could have done if used
JAVA in some IDE only,
But will not be allowed to use while developing a GWT application??

please tell me if anyone has any idea about this!! So that we can
discuss the things here and also do some work over that

Thanking you all

- rakesh

Neeraj Upreti

unread,
Jul 9, 2007, 1:42:16 AM7/9/07
to Google Web Toolkit
Hi,

First thing to be understood is the GWT is for the client side web
application development framework with the following two BASIC and
REMARKABLE features:

1. A complete web UI can be developed by using GWT packages in any
Java IDE.
2. This UI can interact with the server using RPC mechanism of GWT.

So only a Subset of java language features is used which is mandatory
to provide the above 2 features of GWT.

Now if more java language support is required then the 'java language
itself' is used on the server side and provide additional
functionality to the GWT objects on the server.

More simple GWT is "HTML + server interaction" using any Java IDE.

Neeraj Upreti

konquerror

unread,
Jul 9, 2007, 2:34:39 AM7/9/07
to Google Web Toolkit
hiii

thank you neeraj for your reply.

But then also in specific, can you tell me some of the features of
JAVA which are not supported in GWT???

may be becouse it wasnt necessary or due to some other fact??

Axel Kittenberger

unread,
Jul 9, 2007, 2:39:21 AM7/9/07
to Google Web Toolkit
IMHO you should first think about your requirements for your
applications, and then consider if GWT is the right platform for you.
Not think about what everything could/could not be done, until you
don't even know if you gonna need it...

Reinier Zwitserloot

unread,
Jul 9, 2007, 7:52:50 AM7/9/07
to Google Web Toolkit
You can't do:

- threading
- use any class not listed here:http://code.google.com/webtoolkit/
documentation/jre.html
(executive summary: Only stuff in java.util and java.lang works).
- reflection of any kind
- blocking the thread in any way (Object.wait, synchronized,
Thread.sleep)
- Any kind of I/O (java.io isn't supported).

We can discuss 'fixing' these problems till the cows come home, but
GWT compiles to javascript, and the above stuff just plain can't be
done in javascript, end of story. GWT can make the difficult easy, but
it cannot make the impossible possible.

Using another framework so that you do have those options
automatically means you must move away from vanilla HTML/JS. Look at
applets, java webstart, JavaFX, Flex/Apollo, signed customized ActiveX
controls, etcetera.

There's a reason the above list of technologies never result in a
successfull application though.

On Jul 9, 8:34 am, konquerror <konquer...@gmail.com> wrote:

rakesh

unread,
Jul 9, 2007, 12:19:53 PM7/9/07
to Google Web Toolkit
hii reinier

thanks for your comments. I am not planning to use other frameworks.
Even i have found out the same things exactly what you mentioned about
Java and GWT.

i was looking for some more restrictions over its use for the fact
that finally all we need is a javascript code.

As we know Javascript can't support all properties of Java. So i was
wondering that there must be some more things like these monothreading
and I/o things.

hope to see some more properties if you or anyone else finds out

thnaking you

rakesh

Axel Kittenberger

unread,
Jul 9, 2007, 2:30:04 PM7/9/07
to Google Web Toolkit
rakesh, GWT has a "java script native interface", if there is anything
you can't natively do with GWT; you can always resort to writing one
or two functions natively in javascript. Its even pretty easiy to do:

int native aNativeExampleFunc(String aparam1, int aparam2)/*-{
// insert javascript code here
}-*/;

So there is nothing js can do, what you cannot do in GWT, at least
with resorting to JSNI.

rakesh

unread,
Jul 9, 2007, 2:46:45 PM7/9/07
to Google Web Toolkit
hii axel

thank you.

I know about JSNI although didnt used it yet.

but my question was exactly reverse of what you answered. i think i
couldnt phrase my Question properly last time.

actually as we all know java is much more rich language than
Javascript. So while developing a GWT application there are many
properties of Java which can't be used, some of them discussed above
like threading, IO etc

so i was looking for those things of Java which couldnt be used in GWT
development just for the reason that finally it has t obe converted in
Javascript.

i hope i am clearer this time :-)

thanking you all for your responses

-rakesh

basstech

unread,
Jul 9, 2007, 4:15:54 PM7/9/07
to Google Web Toolkit
rakesh, I think the mistake you are making is that you are making the
assumption that GWT has somehow combined Java and Javascript together.
In reality, Java and Javascript have nothing in common, and GWT is
merely using Java as a vehicle to create great, reusable, and
maintainable code.

This quote is taken from the Introduction section to "Making GWT
Better":

"Why does GWT support the Java programming language instead of
language X? In a word, tools. There are lots of good Java tools.
That's the entire explanation. It isn't that we don't like language X
or that we think the Java programming language is somehow superior. We
just like the tools."

GWT is a remarkable and unique tool because it allows you do anything
you can already do with Javascript, better. It uses the power of Java
(reusable code, strong object oriented programming, organization,...)
to create Javascript code.


Really, the only pieces of "standard Java" that have been ported over
to GWT are listed here: http://code.google.com/webtoolkit/documentation/jre.html

You'll see that it's just standard Java objects and data structures.
All the fancy stuff you can do in Java in desktop programming CANNOT
be done in Javascript, because Javascript simply doesn't support that.

-Charles

basstech

unread,
Jul 9, 2007, 4:16:06 PM7/9/07
to Google Web Toolkit
rakesh, I think the mistake you are making is that you are making the
assumption that GWT has somehow combined Java and Javascript together.
In reality, Java and Javascript have nothing in common, and GWT is
merely using Java as a vehicle to create great, reusable, and
maintainable code.

This quote is taken from the Introduction section to "Making GWT
Better":

"Why does GWT support the Java programming language instead of
language X? In a word, tools. There are lots of good Java tools.
That's the entire explanation. It isn't that we don't like language X
or that we think the Java programming language is somehow superior. We
just like the tools."

GWT is a remarkable and unique tool because it allows you do anything
you can already do with Javascript, better. It uses the power of Java
(reusable code, strong object oriented programming, organization,...)
to create Javascript code.


Really, the only pieces of "standard Java" that have been ported over
to GWT are listed here: http://code.google.com/webtoolkit/documentation/jre.html

You'll see that it's just standard Java objects and data structures.
All the fancy stuff you can do in Java in desktop programming CANNOT
be done in Javascript, because Javascript simply doesn't support that.

-Charles

ddarby

unread,
Jul 9, 2007, 10:15:13 PM7/9/07
to Google Web Toolkit
You guys...Shame on you. Stop being so negative.
Take a more optimistic approach on this issue.

For those curious,

Forget all the haters and naysayers.
Gwt can do anything and everything your heart desires.
At least till the compiler says otherwise or your browser decides to
give up and quit.

I mean c'mon. What's the point in asking and then being told what you
can't do? Where's the fun?
Don't be afraid to escape the confines of your box.
Breathe in. Breathe out. And live a little!

Who cares that JS doesn't have I/O or Multi-Threading capabilities..
Java does.
So why not test the limits and try some multi-threaded I/O on a
browser. This seems a perfectly sound and reasonable test of GWT's
worth.

There's all sorts of things for you to dream up. Imagine being able
to write a browser app which can display your main page while at the
same time, with a different thread,
interact with your user's filesystem. What an awesome idea. You
could, say, download the complete Oxford Dictionary. Your user's
would surely benefit from such a wealth of knowledge.
I mean, who wouldn't want that.

You never know, till you get out there and try.

What we have here <really> is a failure to communicate.
We need some levity in these dark times.

Anyways,

JS sux .. Java Rules ... Devil Out

Sumit Chandel

unread,
Jul 10, 2007, 6:40:36 PM7/10/07
to Google-We...@googlegroups.com
Hi Rakesh,

As Reinier and Charles pointed out, anything outside of the emulated
JRE set cannot be used in GWT development. For the most part,
everything excluded from the
emulated JRE presents functionality that does not exist in the JavaScript world.

For the list of classes included in the emulated JRE, see:
http://code.google.com/webtoolkit/documentation/jre.html

I also wanted to mention that if multi-threaded programming is
important to you, Google Gears is working to provide similar
functionality through the WorkerPool module. You may want to take a
look at the official Google Gears code site, and if you like what you
see, try the Google Gears API for GWT.

Google Gears:
http://code.google.com/apis/gears/

Google APIs for GWT:
http://code.google.com/p/gwt-google-apis/

Please keep in mind that Gears is at an experimental stage and will
undergo some changes in the near future to improve the API.

Hope that clears things up,
-Sumit Chandel

mP

unread,
Jul 10, 2007, 8:01:47 PM7/10/07
to Google Web Toolkit
Read the doco as pointed out by Sumit its been prepared to answer
these types of questions. In the end if you cant do something on the
client in GWT because of javascript and its sandbox etc ( eg no
rdbms ) you implement such a functionality on the server and access it
as an RPC.

Reply all
Reply to author
Forward
0 new messages