Question

In my GWT application, I made a control to display/edit a numerical value with an associated unit (for example to convert meters <-> feet).

How could I use the JScience library (jsr-275 implementation) in the client part ?

I try to add it to my project but it didn't compile:

No source code is available for type java.text.ParsePosition

Thanks for your help.

Was it helpful?

Solution

This is not a problem with the JScience library as such.

GWT compiles java to javascript and as such needs access to the java source code. Also, not all of the JDK classes are available in the GWT emulation library, and ParsePosition (indeed all of java.text.*) is one of them...

It is not clear from your stacktrace excerpt whether you have used ParsePosition directly or it is the JScience library that does, but either way you will have to rewrite your code to not use that class on the client side (if possible) or perform the conversion on the server side, where the GWT JRE restrictions do not apply.

Have a look at JRE Emulation Reference for a complete overview of what's available to you.

Cheers and good luck,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top