Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #21241
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2013-01-08 23:01 -0800 |
| References | <kcd5kg$elb$1@speranza.aioe.org> <50ea1db2$0$284$14726298@news.sunsite.dk> <kcj34i$ido$1@speranza.aioe.org> |
| Message-ID | <e0c77abe-3290-42a4-bbb2-7ef82979e190@googlegroups.com> (permalink) |
| Subject | Re: Applet not running on the web |
| From | Lew <lewbloch@gmail.com> |
emf wrote:
> Arne Vajhøj wrote:
>> emf wrote:
>>> The webpage is:
>>> httρs://files.nуu.edц/emf202/ρublic/jv/NatalTransits.html
>>>
>>> and you can find the code in
>>>
>>> httρs://files.nуu.edц/emf202/public/jv/transits/NatalTransitsApplet.java
>>>
>>> The applet was working without a problem from the beginning in the
>>> eclipse applet viewer. Then I managed to make it work on browser from my
>>> computer by putting the class and the csv files into a transits folder
>>> (like the package in eclipse) and the html in the higher level
>>> directory. Then I created the same structure in the webserver. The
...
>> Ooops.
>>
>> #FileReader ephemeris = new FileReader("transits/ephemeris.csv");
>>
>> applets run client side!
>>
>> The user do not have a transits/ephemeris.csv file and the
>> applet would not have priv to access it anyway.
>>
>> Stuff your class files *and* the CSV file in a jar
>> file and let the Java code retrieve the CSV as a resource!
>
> Unfortunately the suggested solutions does not work. I have both
What happens when you try it?
What's the structure of the app inside the JAR?
Where in the JAR did you put the CSV?
How is the code attempting to retrieve the CSV?
I sure hope you aren't calling 'new FileReader()' to get to it!
Oh!
'FileReader ephemeris = new FileReader("transits/ephemeris.csv");'
That's not how you read it. Use 'getResourceAsStream()' and put a
'StreamReader' around it.
See the Javadocs for 'Class<T>'.
> versions on the server:
>
> httρs://files.nуu.edц/emf202/public/jv/NatalTransitsA.html
>
> uses the jar archive, while
>
> httρs://files.nуu.edц/emf202/public/jv/NatalTransits.html
>
> uses the transits folder.
>
> Both work fine in my browser when running from the local files, but when
Probably because the JAR version can still see the file system.
> running through the Internet they both give a
> java.security.AccessControlException, after using
Probably because you still haven't changed the code to comply with
Arne's suggestion.
Additional comments:
- Don't use TAB characters to indent code for public consumption.
- For Christ's sake, man, Javadoc your code!
- 'String textLine = null;' Don't assign values you will never use.
- 'String textLine = null;' declared at too broad a scope.
- 'catch (Exception e)' is far too broad. Catch the particular exceptions.
- 'String birthday$' Never use '$' in your variable names. Ever.
It's for system-generated stuff only.
Follow the naming conventions in the Java Coding Conventions.
- 'int[][] planetArray' Generally, variable names should not indicate their
implementation but their purpose.
- 'int[][] planetArray' not the best type. You're storing what are essentially
strings there, as 'int' values. You can invent your own type if 'String'
doesn't suffice.
- 'planet1 = (planet1 - planet2 > 21540) ? ...' Magic numbers are bad.
- 'package transits;' Good.
--
Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Applet not running on the web emf <emfril@gmail.com> - 2013-01-06 19:46 -0500
Re: Applet not running on the web Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 19:56 -0500
Re: Applet not running on the web emf <emfril@gmail.com> - 2013-01-09 01:21 -0500
Re: Applet not running on the web Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 19:58 -0500
Re: Applet not running on the web emf <emfril@gmail.com> - 2013-01-07 03:39 -0500
Re: Applet not running on the web emf <emfril@gmail.com> - 2013-01-09 01:40 -0500
Re: Applet not running on the web Lew <lewbloch@gmail.com> - 2013-01-08 23:01 -0800
Re: Applet not running on the web emf <emfril@gmail.com> - 2013-01-10 07:08 -0500
Re: Applet not running on the web Arne Vajhøj <arne@vajhoej.dk> - 2013-01-09 20:51 -0500
Re: Applet not running on the web emf <emfril@gmail.com> - 2013-01-10 07:19 -0500
Re: Applet not running on the web Arne Vajhøj <arne@vajhoej.dk> - 2013-01-10 07:20 -0500
Re: Applet not running on the web Roedy Green <see_website@mindprod.com.invalid> - 2013-01-08 22:56 -0800
Re: Applet not running on the web emf <emfril@gmail.com> - 2013-01-09 02:46 -0500
Re: Applet not running on the web Roedy Green <see_website@mindprod.com.invalid> - 2013-01-09 11:22 -0800
Re: Applet not running on the web Arne Vajhøj <arne@vajhoej.dk> - 2013-01-09 20:44 -0500
Re: Applet not running on the web Roedy Green <see_website@mindprod.com.invalid> - 2013-01-09 11:26 -0800
csiph-web