Thank, you . var pi = Math.PI; works, but I got the same error when doing further testing :
Java primitive and classes are not exposed in ThingWorx Script Services.
You can create Java entities and services using the ThingWorx Extension SDK.
Do you know the reason why the java primitive classes are not exposed ? it bring lots of convenience for development.