By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

Applets

P: n/a
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet?

I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file
Jul 17 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
"Andy" <an************@yahoo.co.uk> wrote in message
news:b2**************************@posting.google.c om...
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet? Yes
I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file


Not likely. You have a code problem. Find an error message to share. If
you're running a fairly recent JRE, you should have Web Start, which gives
you a console, where you'll find your stdout stuff (including stack traces).
Jul 17 '05 #2

P: n/a
"Andy" <an************@yahoo.co.uk> wrote in message
news:b2**************************@posting.google.c om...
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet? Yes
I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file


Not likely. You have a code problem. Find an error message to share. If
you're running a fairly recent JRE, you should have Web Start, which gives
you a console, where you'll find your stdout stuff (including stack traces).
Jul 17 '05 #3

P: n/a

"Andy" <an************@yahoo.co.uk> wrote in message
news:b2**************************@posting.google.c om...
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet?

I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file


Yes,

Applets are not allowed to do things like read files, do networking stuff to
other servers thanm the one that served the page they are on, accessing
ports etc. In short, in general an application will not run as an applet.
There are ways to grant applets all kinds of priviliges but that would at
least involve signing it (and buying an expensive certificate from Verisign
and the likes).

Silvio Bierman
Jul 17 '05 #4

P: n/a

"Andy" <an************@yahoo.co.uk> wrote in message
news:b2**************************@posting.google.c om...
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet?

I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file


Yes,

Applets are not allowed to do things like read files, do networking stuff to
other servers thanm the one that served the page they are on, accessing
ports etc. In short, in general an application will not run as an applet.
There are ways to grant applets all kinds of priviliges but that would at
least involve signing it (and buying an expensive certificate from Verisign
and the likes).

Silvio Bierman
Jul 17 '05 #5

P: n/a
"Ryan Stewart" <zz********@gSPAMo.com> wrote in message news:<H5********************@texas.net>...
"Andy" <an************@yahoo.co.uk> wrote in message
news:b2**************************@posting.google.c om...
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet?

Yes
I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file


Not likely. You have a code problem. Find an error message to share. If
you're running a fairly recent JRE, you should have Web Start, which gives
you a console, where you'll find your stdout stuff (including stack traces).

hi all
My que is related to J2ME. I am trying to show the loading screen
on a handset by filling of Gauge bars one by one.but ut doesnt worked
so. what it does that it just wait for some secs (coz of
Thresd.sleep()) and then fill all the bars simultaneously..here is the
code of program

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MyGauge extends MIDlet implements CommandListener {
Display display;
int i=0;
Command start=new Command("Start",Command.SCREEN,1);
Form frm=new Form("");
Gauge gauge = new Gauge ("Loading... Please wait.",false,7,0);
public MyGauge() {
display = Display.getDisplay(this);
frm.addCommand(start);
frm.append(gauge);
display.setCurrent(frm);
frm.setCommandListener(this);
}
public void startApp() {
display.setCurrent(frm);
}
public void destroyApp(boolean unconditional) {
}
public void pauseApp() {
}
public void commandAction(Command c,Displayable d) {
try {

for (int j=0;j<=7;j++) {
gauge.setValue(j);
Thread.sleep(1000);
}
}
catch(InterruptedException ie){
}
}
}

I am using J2ME Wireless Toolkit 1.0.4 with KToolbar.All solutions
will be welomed.
pink
Jul 17 '05 #6

P: n/a
"Ryan Stewart" <zz********@gSPAMo.com> wrote in message news:<H5********************@texas.net>...
"Andy" <an************@yahoo.co.uk> wrote in message
news:b2**************************@posting.google.c om...
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet?

Yes
I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file


Not likely. You have a code problem. Find an error message to share. If
you're running a fairly recent JRE, you should have Web Start, which gives
you a console, where you'll find your stdout stuff (including stack traces).

hi all
My que is related to J2ME. I am trying to show the loading screen
on a handset by filling of Gauge bars one by one.but ut doesnt worked
so. what it does that it just wait for some secs (coz of
Thresd.sleep()) and then fill all the bars simultaneously..here is the
code of program

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MyGauge extends MIDlet implements CommandListener {
Display display;
int i=0;
Command start=new Command("Start",Command.SCREEN,1);
Form frm=new Form("");
Gauge gauge = new Gauge ("Loading... Please wait.",false,7,0);
public MyGauge() {
display = Display.getDisplay(this);
frm.addCommand(start);
frm.append(gauge);
display.setCurrent(frm);
frm.setCommandListener(this);
}
public void startApp() {
display.setCurrent(frm);
}
public void destroyApp(boolean unconditional) {
}
public void pauseApp() {
}
public void commandAction(Command c,Displayable d) {
try {

for (int j=0;j<=7;j++) {
gauge.setValue(j);
Thread.sleep(1000);
}
}
catch(InterruptedException ie){
}
}
}

I am using J2ME Wireless Toolkit 1.0.4 with KToolbar.All solutions
will be welomed.
pink
Jul 17 '05 #7

P: n/a
"Silvio Bierman" <sb******@idfix.nl> wrote in message news:<40*********************@news.xs4all.nl>...
"Andy" <an************@yahoo.co.uk> wrote in message
news:b2**************************@posting.google.c om...
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet?

I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file


Yes,

Applets are not allowed to do things like read files, do networking stuff to
other servers thanm the one that served the page they are on, accessing
ports etc. In short, in general an application will not run as an applet.
There are ways to grant applets all kinds of priviliges but that would at
least involve signing it (and buying an expensive certificate from Verisign
and the likes).

Silvio Bierman


Hi Steve,

Thanks. Is the best solution therefore to attempt to plug into the
server my applet is on using the URLConnetion class to read an html
file (would that even be allowed). I'm trying to put the applet in
some space I've got from geocities. Do you just change the file from
..txt to .html or is it a bit more complicated than that. :-@

Andy Chambers
Jul 17 '05 #8

P: n/a
"Silvio Bierman" <sb******@idfix.nl> wrote in message news:<40*********************@news.xs4all.nl>...
"Andy" <an************@yahoo.co.uk> wrote in message
news:b2**************************@posting.google.c om...
Hi all,

I'm sure this is old hat to all of you but could someone please tell
me if you can use FileReader to input data into an applet?

I developed this project as an application and am just trying to put
it on my website as an applet but it keeps saying "applet notinited".
I figure it might be because the program needs access to a file


Yes,

Applets are not allowed to do things like read files, do networking stuff to
other servers thanm the one that served the page they are on, accessing
ports etc. In short, in general an application will not run as an applet.
There are ways to grant applets all kinds of priviliges but that would at
least involve signing it (and buying an expensive certificate from Verisign
and the likes).

Silvio Bierman


Hi Steve,

Thanks. Is the best solution therefore to attempt to plug into the
server my applet is on using the URLConnetion class to read an html
file (would that even be allowed). I'm trying to put the applet in
some space I've got from geocities. Do you just change the file from
..txt to .html or is it a bit more complicated than that. :-@

Andy Chambers
Jul 17 '05 #9

P: n/a
pr******************@indiatimes.com (priyanka) wrote in message news:<32**************************@posting.google. com>...
[snipped...]
hi all
My que is related to J2ME. I am trying to show the loading screen
on a handset by filling of Gauge bars one by one.but ut doesnt worked
so. what it does that it just wait for some secs (coz of
Thresd.sleep()) and then fill all the bars simultaneously..here is the
code of program
[snipped...] public void commandAction(Command c,Displayable d) {
try {

for (int j=0;j<=7;j++) {
gauge.setValue(j);
Thread.sleep(1000);
}
}
catch(InterruptedException ie){
}
}
}

I am using J2ME Wireless Toolkit 1.0.4 with KToolbar.All solutions
will be welomed.
pink

From what little J2ME I recall, commandAction is some kind of event
handler, correct? To put it in simplified terms, J2ME's UI thread
has called your event handler - your event handler then hogs the
thread for 7 or so seconds, updating the gauge, but as you are running
*your* code on the UI's thread, the UI never has an opportunity to
update until you release control of the thread when your event handler
exits. (A race condition, in threading terms!)

As a general rule of thumb: when programming event handlers in Java,
you are running on someone else's thread - so get your work done and
get the hell out of there ASAP! ;-)

(The similar deadlock effect can be had by opening a 'Chooser' type
dialog from inside an event handler in Swing, and waiting for its
response.)

You'll have to find some other way of periodically calling the
code which changes the gauge status, one which does not hog the
UI's event firing thread. This could be as simple as firing off
a separate thread for your loop - or finding an in-built J2ME
mechanism to re-call actionCommand periodically.
-FISH- ><>
Jul 17 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.