APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

EJsS Error

Return to the EJS Modeling forum
Login to post to this thread

Relative Position of 2d segments
Spencer Wheaton
6 Posts

Dear Paco

I still can't pinpoint the issue with my sim that doesn't run but, in the process of looking for the cause, I found what I think is inconsistent behaviour in the way that the "north-west" and "south-east" relative positions treat the position and size entries of 2D segments.

The X and Y values are not used to specify either endpoint of the segment in these two cases, but instead the X is used for the one endpoint and the Y for the other.  


Current Replies - View all
Re: Relative Position of ...   (Francisco Esquembre - )
Error including line segments in EJsS
Spencer Wheaton
6 Posts

Hi there!

I am struggling to see what is wrong with the code attached. The problem is with the last line segment "segment2" that has sizeX and sizeY related to variables h and f. When I make the sizes constants then the problem disappears.  Also removing some of the other segments in the drawingPanel makes the problem go away.

Attached File: ejss_src_DivergingLensRealImage.zip

Current Replies - View all
Re: Error including line ...   (Francisco Esquembre - )
Re: Re: Error including l...   (Spencer Wheaton - )
EJS Javascript Exception Error
Nick Gross
17 Posts

Thanks to Paco for pointing me to the Javascript setting.  I have successfully created an HTML 5 file for a simple simulation, but now I am getting this error when I try to do something a little different.
Attached is the EJS file I am using that generates this.  Can someone point me towards where this is going wrong?

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.mozilla.javascript.ConsString cannot be cast to java.lang.String
at org.colos.ejss.xml.JSHint$2.run(JSHint.java:201)
at org.mozilla.javascript.Context.call(Context.java:489)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504)
at org.colos.ejss.xml.JSHint.buildResults(JSHint.java:187)
at org.colos.ejss.xml.JSHint.hint(JSHint.java:71)
at org.colos.ejss.xml.Emulator.setSimulation(Emulator.java:181)
at org.colos.ejs.osejs.utils.EmulatorRun.refreshEmulator(EmulatorRun.java:136)
at org.colos.ejs.osejs.utils.EmulatorRun$2.run(EmulatorRun.java:114)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Current Replies - View all
Re: EJS Javascript Except...   (lookang - )
Re: Re: EJS Javascript Ex...   (Nick Gross - )
Re: EJS Javascript Except...   (Francisco Esquembre - )
Re: Re: EJS Javascript Ex...   (Nick Gross - )
OSP Projects:
Open Source Physics - EJS Modeling
Physlet Physics
Physlet Quantum Physics
STP Book