NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Collaborative Community of EJS => Topic started by: lookang on June 15, 2010, 09:23:37 pm



Title: Ejs Open Source Earth and Moon Model
Post by: lookang on June 15, 2010, 09:23:37 pm
Ejs Open Source Earth and Moon Model is by Professor Francisco Esquembre aka Paco. I did not make this, i just post it here since the main website cannot deploy the applet properly.
This model is not an accurate model yet, it aims to demonstrate the new features available to Ejs as mentioned during MPLT14 http://www.fisica.uniud.it/URDF/mptl14/contents.htm
the 3D java ready!!
 i went to Prof Paco's wiki it didn't load. http://www.um.es/fem/EjsWiki/Main/ExamplesEarthAndMoon3D properly so i uploaded this version which works!

need
Download Java 3D 1.5.1 for Windows
Java 3D 1.5.1
java3d-1_5_1-windows-i586.exe    2.95 MB

seems to work only as a standalone, web does not display Java 3D


Title: Re: Ejs Open Source Earth and Moon Model
Post by: ahmedelshfie on June 15, 2010, 11:49:02 pm
I download java 3d and simulation work very well i like idea so much
Very good idea of simulation  ;)


Title: Re: Ejs Open Source Earth and Moon Model
Post by: Fu-Kwun Hwang on June 16, 2010, 06:27:26 am
The error seem to be Caused by:
java.security.AccessControlException: access denied (java.util.PropertyPermission j3d.stereo read)

May be Paco knew how to solve it?


Title: Re: Ejs Open Source Earth and Moon Model
Post by: ahmedelshfie on June 16, 2010, 06:38:05 am
When i download java 3d simulation jar file work very well but have error that prof Hwnag
Saying and because it EJS cant run XML source code i search alto about name this error in XML
But no found I'm wonder how have error about variable not exist in XML source code.


Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on June 16, 2010, 07:45:42 am
The error seem to be Caused by:
java.security.AccessControlException: access denied (java.util.PropertyPermission j3d.stereo read)
May be Paco knew how to solve it?

That's the best. I email him now


Title: Re: Ejs Open Source Earth and Moon Model
Post by: Fu-Kwun Hwang on June 16, 2010, 09:25:32 am
I tried to change java.policy file without success.
And I can view java3D applet from other web site, so it is something implemented in EJS which need more security protection.


Title: Re: Ejs Open Source Earth and Moon Model
Post by: fem@um.es on June 16, 2010, 01:12:09 pm
Thanks for pointing out this problem. It does look like a security issue. We'll investigate it.
Paco


Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on June 17, 2010, 12:18:50 pm
did someone do something?
it works on Web deployment now! it looks great.
Prof Hwang?


Title: Re: Ejs Open Source Earth and Moon Model
Post by: Fu-Kwun Hwang on June 17, 2010, 01:39:10 pm
It is not working with my browser (IE and firefox). The same error message!
Did you change something in your system?


Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on June 17, 2010, 02:00:42 pm
oic, it was me.
Code:
permission java.util.PropertyPermission "j3d.stereo", "read"; //  added by lookang

add this line to C:\Program Files\Java\jre1.5.0_16\lib\security\java.policy
i added at the bottom of the codes

and if that didn't work

add  the same line to C:\Program Files\Java\jre6\lib\security\java.policy
i think this is the solution to the 3D java

i used Jedit to edit them


method 2:
1 download the attachment java.zip
2 unzip the file, it is called java.policy
3 copy file into C:\Program Files\Java\jre6\lib\security\java.policy
3.5 optional* rename java.policy into java.policy~ in case you want the old file back
4 say yes to copy and replace file depending on whether it is replace or just copy new


BOOM! Java 3D on Ejs Web applets  ;D ;D
attached is the java.policy for windows xp system

Youtube to show the steps


Title: Re: Ejs Open Source Earth and Moon Model
Post by: Fu-Kwun Hwang on June 17, 2010, 04:52:46 pm
I did the same change for more than 3 different computers. However, it is not working for my computers.


Title: Re: Ejs Open Source Earth and Moon Model
Post by: ahmedelshfie on June 17, 2010, 05:50:53 pm
I did the same steps but not loading java 3d error
I test on Firefox,Internet Explorer,IE Tester,Opera
Not loading error all time


Title: Re: Ejs Open Source Earth and Moon Model
Post by: ahmedelshfie on June 17, 2010, 06:02:17 pm
Yes now is work after i replace java.policy
On C:\Program Files\Java\jre6\lib\security\java.policy
Now is loading very well in first 5 Minuit's no loading and it let me think that will not work
But i test again and work very well is work on all my browser(Firefox,IE tester,opera,Internet Explorer)
Good job prof Lookang  :D
Just one thing i try running XML file on EJS but error still now
variable IMPLEMENTATION_mode
location: class org.opensourcephysics.display3d.factory.OSP3DFactory
    org.opensourcephysics.display3d.factory.OSP3DFactory.setImplementation (org.opensourcephysics.display3d.factory.OSP3DFactory.IMPLEMENTATION_mode);
                                                                                                                                ^


Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on June 17, 2010, 06:37:17 pm
thx ahmedelshfie.! yes the first method works best, 2nd method assumes your PC is windows xp

copy the line
Code:
permission java.util.PropertyPermission "j3d.stereo", "read"; //  added by lookang

into the exisiting java.policy

i did it on a windows 7 system too by doing this.

copy out java.policy to a space where u can edit and save the new java.policy say d:/

add the line of code at the bottom of the page of java.policy

for windows 7 it looks like this, different from windows xp

Code:
// Standard extensions get all permissions by default

grant codeBase "file:${{java.ext.dirs}}/*" {
permission java.security.AllPermission;
};

// default permissions granted to all domains

grant {
// Allows any thread to stop itself using the java.lang.Thread.stop()
// method that takes no argument.
// Note that this permission is granted by default only to remain
// backwards compatible.
// It is strongly recommended that you either remove this permission
// from this policy file or further restrict it to code sources
// that you specify, because Thread.stop() is potentially unsafe.
// See "http://java.sun.com/notes" for more information.
permission java.lang.RuntimePermission "stopThread";

// allows anyone to listen on un-privileged ports
permission java.net.SocketPermission "localhost:1024-", "listen";

// "standard" properies that can be read by anyone

permission java.util.PropertyPermission "java.version", "read";
permission java.util.PropertyPermission "java.vendor", "read";
permission java.util.PropertyPermission "java.vendor.url", "read";
permission java.util.PropertyPermission "java.class.version", "read";
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "os.version", "read";
permission java.util.PropertyPermission "os.arch", "read";
permission java.util.PropertyPermission "file.separator", "read";
permission java.util.PropertyPermission "path.separator", "read";
permission java.util.PropertyPermission "line.separator", "read";

permission java.util.PropertyPermission "java.specification.version", "read";
permission java.util.PropertyPermission "java.specification.vendor", "read";
permission java.util.PropertyPermission "java.specification.name", "read";

permission java.util.PropertyPermission "java.vm.specification.version", "read";
permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
permission java.util.PropertyPermission "java.vm.specification.name", "read";
permission java.util.PropertyPermission "java.vm.version", "read";
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
permission java.util.PropertyPermission "j3d.stereo", "read"; //  added by lookang
};

rename the old java.policy from C:\Program Files (x86)\Java\jre6\lib\security to say java~.policy

copy back the file which has the new added line as C:\Program Files (x86)\Java\jre6\lib\security to say java.policy

it works again!
attached in the java.policy for windows 7 system


Title: Re: Ejs Open Source Earth and Moon Model
Post by: ahmedelshfie on June 17, 2010, 06:53:36 pm
I really do it but XML source code have wrong.Ejs cant running XML so i try solve but i don't find variable
That have wrong on XML file i notice a thing earth and moon 3d created by ejs version 4.3.0 and I'm use
Version 4.2.7 may this problem for cant run XML source code .


Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on June 17, 2010, 07:08:51 pm
I really do it but XML source code have wrong.Ejs cant running XML so i try solve but i don't find variable
That have wrong on XML file i notice a thing earth and moon 3d created by ejs version 4.3.0 and I'm use
Version 4.2.7 may this problem for cant run XML source code .

Yes. u need to get the latest Ejs

anyway, on Mac OSX
the web apple didn't run
the error is
Code:
java.lang.NullPointerException
at users.sgeducation.lookang.ejs_EarthAndMoon3D.EarthAndMoon3D_pkg.EarthAndMoon3DView.reset(EarthAndMoon3DView.java:266)
at org.colos.ejs.library.Animation.reset(Unknown Source)
at users.sgeducation.lookang.ejs_EarthAndMoon3D.EarthAndMoon3D_pkg.EarthAndMoon3DSimulation.(EarthAndMoon3DSimulation.java:25)
at users.sgeducation.lookang.ejs_EarthAndMoon3D.EarthAndMoon3D_pkg.EarthAndMoon3D.(EarthAndMoon3D.java:96)
at users.sgeducation.lookang.ejs_EarthAndMoon3D.EarthAndMoon3D_pkg.EarthAndMoon3DApplet.init(EarthAndMoon3DApplet.java:27)
at sun.applet.AppletPanel.run(AppletPanel.java:424)
at java.lang.Thread.run(Thread.java:637)
maybe prof Paco will be interested in this error on Mac later one day


Title: Re: Ejs Open Source Earth and Moon Model
Post by: ahmedelshfie on June 17, 2010, 08:33:54 pm
Quote
Yes. u need to get the latest Ejs
I really download EJS latest version but is the same error
Code:
EarthAndMoon3D_pkg\EarthAndMoon3D.java:189: ';' expected
    permission java.util.PropertyPermission "j3d.stereo", "read"; // added by lookang  // > Initialization.Lights:5
                   ^




Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on June 18, 2010, 09:14:18 am
i think i know what is your problem.

file name too long.

D:\EasyJavaSimulation\EJS_4.3.0_100613\EJS_4.3.0\workspace\source\users\sgeducation\lookang\users_sgeducation_lookang_ejs_EarthAndMoon3D_EarthAndMoon3D.xml

rename the file to EarthAndMoon3D.xml before you save it to your PC. Do not change file name in Ejs editor mode, the file is already not read correctly so it will not work still.

i think java has some number of character restriction from the root directory so how i solve this problem is rename file to a short name.
try it


Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on June 18, 2010, 09:19:42 am
the method just described did not work still.

how i did it is the download the jar file (1.9 mb file)

unzip in its folder

go in to find the source xml and the folder that is needed
for example
D:\EasyJavaSimulation\EJS_4.3.0_100613\EJS_4.3.0\workspace\export
D:\EasyJavaSimulation\EJS_4.3.0_100613\EJS_4.3.0\workspace\export\ejs_users_sgeducation_lookang_ejs_EarthAndMoon3D_EarthAndMoon3D\users\sgeducation\lookang\ejs_EarthAndMoon3D
need
EarthAndMoon3D.xml and folder TEXTURES
copy these into the usual source user ... / ...
D:\EasyJavaSimulation\EJS_4.3.0_100613\EJS_4.3.0\workspace\source\users\sgeducation\lookang\ejs_EarthAndMoon3D

it should work now




Title: Re: Ejs Open Source Earth and Moon Model
Post by: ahmedelshfie on June 18, 2010, 05:22:30 pm
Quote
i think i know what is your problem.

file name too long.

D:\EasyJavaSimulation\EJS_4.3.0_100613\EJS_4.3.0\workspace\source\users\sgeducation\lookang\users_sgeducation_lookang_ejs_EarthAndMoon3D_EarthAndMoon3D.xml

rename the file to EarthAndMoon3D.xml before you save it to your PC. Do not change file name in Ejs editor mode, the file is already not read correctly so it will not work still.

i think java has some number of character restriction from the root directory so how i solve this problem is rename file to a short name.
try it
I really do it from first time i change however i will wait answer see with prof Hwang what is the problem in my system


Title: Re: Ejs Open Source Earth and Moon Model
Post by: Fu-Kwun Hwang on June 18, 2010, 10:13:06 pm
I would suggest you download the jar file and run it at your computer.
Then, right click mouse and select "open ejs model" and it will extract and save all the necessary files for the simulation at the right place.
May be this will solve your problem. Try it!


Title: Re: Ejs Open Source Earth and Moon Model
Post by: ahmedelshfie on June 19, 2010, 12:32:01 am
Thanks prof Hwang about your solution now is work very well  :D


Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on September 16, 2010, 06:33:31 pm
Textures for the applet


Title: Re: Ejs Open Source Earth and Moon Model
Post by: lookang on August 02, 2011, 03:39:39 pm
submited a bug on http://www.um.es/fem/EjsWiki/FeedbackEn/00078

Title
bug in java 3d texture implementation
 
Type
Bug
 
Raised by
lookang
 
Date opened
Tuesday, 2 August 2011
 
Description
notice the earth texture is render wrongly.
amercia africa asia is the order from left to right
the bug is
asia africa amercia, everything is rendered i think inside out?
 
Importance
3
 
Proposed solution
should be a easy bug to solve.
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1830.0 to see the bug
 
Urgency
3
 
Status
Open
 
Resolution
should be a easy bug to solve.