Dear All:
I meet some problem and try two ways to resolve it, but still can't resolve.
I hope someone can give me the correct resolve
ways....
Target : I want use Applet and NetCDF Java Library (Version 2) to
do
1. open the remote netcdf file(http://61.60.103.48:81/g2var1level.nc, the remote file also in same folder with applet class.) 2. print size and data of the Variable("lon" & "lat") which in netcdf file. I can't get the correct result, but get some error message in Java console : First way
:
I use the function in Applet to open the
remote file,
(the function can run in application): String urlfile = "http://61.60.103.48:81/g2var1level.nc"; NetcdfFile ncfile = NetcdfFile.open(urlfile); and HTML code use :
<applet code="MyNetcdfApplet.class" archive="nc2.2.jar" codebase=. width=300 height=400> First way Error message
:
IE version
6.0.2900.2180.xpsp_sp2_gdr.050301-1519
Java Plug-in 1.5.0_06 JRE version 1.5.0_06 Java HotSpot(TM) Client VM java.security.AccessControlException: access denied
(java.io.FilePermission http:\61.60.103.48:81\g2var1level.nc
read)
at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at java.io.File.exists(Unknown Source) at ucar.nc2.N3iosp.open(N3iosp.java:93) at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:780) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:339) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:221) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:167) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:151) at MyNetcdfApplet.init(MyNetcdfApplet.java:29) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Second way
:
I change my
code in Applet to open the remote file,
String urlfile =
getParameter("NCFile");
URL url = "" URL(getCodeBase(), urlfile); NetcdfFile
ncfile = new NetcdfFile(url);
and HTML code use
:
<applet code="MyNetcdfApplet.class" archive="nc2.2.jar" codebase=. width=300 height=400> <param name="NCFile"
value="/g2var1level.nc"> ... </applet> Second way Error message
:
URL http://61.60.103.48:81/g2var1level.nc
java.security.AccessControlException: access denied (java.io.FilePermission http:\61.60.103.48:81\g2var1level.nc read) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at java.io.File.exists(Unknown Source) at ucar.nc2.N3iosp.open(N3iosp.java:93) at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:763) at MyNetcdfApplet.init(MyNetcdfApplet.java:33) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) And I didn't sign My applet. Could anyone tell me
what keypoint I miss?
(May I need sign it? or not add some import jar file?)
How can I do that My applet can read the remote netcdf
file?
The netcdf file also be in My applet class folder. First way or Second way is better?
Thank you very much~
Monica
|