Java Forum / First Aid / September 2004
a little applet problem...
Frances Del Rio - 13 Sep 2004 16:17 GMT I compile an applet (file.java), do the html w/the applet tag.. run it, works fine, both in viewer and browser.. then I change something in .java file, compile again.. but when I view in browser again it still shows old version, can't see changes.. (can see them in appletviewer..) why can't I see changes in browser?? this is happening w/all my applets.. thank you..
Frances
Andrew Thompson - 13 Sep 2004 18:02 GMT > I compile an applet (file.java), do the html w/the applet tag.. run it, > works fine, both in viewer and browser.. What browser/version, running what JRE, on what OS?
>..then I change something in > .java file, compile again.. but when I view in browser again it still > shows old version, can't see changes.. (can see them in appletviewer..) > why can't I see changes in browser?? Browsers 'cache' classes. To test new classes, flush the class cache.
Flushing the class cache is different depending upon browser (and possibly version), OS, and JRE version, which leads us back to my first question.
 Signature Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
Frances Del Rio - 13 Sep 2004 18:52 GMT >>I compile an applet (file.java), do the html w/the applet tag.. run it, >>works fine, both in viewer and browser.. [quoted text clipped - 9 lines] > Browsers 'cache' classes. To test new > classes, flush the class cache. how do you flush the "class" cache...???? I have never heard of this.. I searched for 'class' in IE help, no go... (I have cleaned up cache numerous times.. am on IE v. 6.0.2800.1106.. don't know what version of JRE (I downloaded it about 2-3 months ago from java.sun..) OS is W2000) don't have this problem in Netscape..
other problem am having w/applets is I don't see params.. in html have one param then in .java have if param == null show this... and it reads like the param is null but it's not.. THIS one is also happening in Netscape... (N v.7..) thank you very much for your help.. Frances
> Flushing the class cache is different depending > upon browser (and possibly version), OS, and JRE > version, which leads us back to my first question. Andrew Thompson - 13 Sep 2004 19:08 GMT >>>I compile an applet (file.java), do the html w/the applet tag.. run it, >>>works fine, both in viewer and browser.. >> >> What browser/version, running what >> JRE, on what OS? ..
> how do you flush the "class" cache...???? *
>..I have never heard of this.. That's why I (and Fred and Matt) told you. There's probably lots of things you've never heard.
I know there's lots of things *I've* never heard. So if ever I ask a question and the answer's something I never heard, but that you know, I hope *you'll* tell *me*. ;-)
> I searched for 'class' in IE help, no go... (I have cleaned up cache > numerous times.. am on IE v. 6.0.2800.1106.. don't know what version of > JRE <http://www.physci.org/pc/property.jsp?prop=java.version+java.vendor+os.name>
>..(I downloaded it about 2-3 months ago from java.sun..) OS is W2000) But if you got it a few months ago, it's one of Sun's recent JRE's so you can clear the cache from inside the Java console, as Matt mentioned.
* You can get the console by (keyboard shortcuts) Alt t | Sun Java Console
To clear the cache 'x'
For help in the console ..'?' Oh come on.. you *guessed* that one didn't you? ;-)
> don't have this problem in Netscape.. I wish I had a dollar for every time I heard that..
> other problem am having w/applets is I don't see params.. in html have > one param then in .java have if param == null show this... and it reads > like the param is null but it's not.. THIS one is also happening in > Netscape... (N v.7..) It's at this point we come to.. URL? Code?
Put the page up at GeoCities or such and link to the code.
 Signature Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
Frances Del Rio - 13 Sep 2004 21:55 GMT >>other problem am having w/applets is I don't see params.. in html have >>one param then in .java have if param == null show this... and it reads [quoted text clipped - 6 lines] > Put the page up at GeoCities > or such and link to the code. Thank you very much, Andrew... cleared class by typing 'x' at java console... this java console thing is not mentioned in any book (and I'm following two books.. I think they should mention it..)
Params problem: html: <APPLET code="newPal.class" width=700 height=400> <param name="palin" value="Ok, you got the param">
.java: import java.awt.Graphics; import java.awt.Font; import java.awt.Color;
public class newPal extends java.applet.Applet { Font f = new Font("TimesRoman", Font.BOLD, 36); String palin;
public void paint(Graphics screen) { screen.setFont(f); screen.setColor(Color.red); screen.drawString(palin, 5, 50); } public void init() { palin = getParameter("palin"); if (palin == null); palin = "NULL"; } }
it returns "NULL" even though Param is not null...
thank you very much for your help.... Frances
Andrew Thompson - 13 Sep 2004 22:40 GMT > html: > <APPLET code="newPal.class" width=700 height=400> > <param name="palin" value="Ok, you got the param"> It's best to supply the *complete* HTML again Frances. Do I guess whether your applet element has a closing </APPLET> string, for instance?
Having said that, there is an apparent error in your code.. You are gonna kick yourself.
> if (palin == null); > palin = "NULL"; if (palin == null) palin = "NULL";
One single ';' difference.. ;-)
HTH
 Signature Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
Frances Del Rio - 14 Sep 2004 02:10 GMT >><APPLET code="newPal.class" width=700 height=400> >><param name="palin" value="Ok, you got the param"> [quoted text clipped - 17 lines] > > HTH Thank you Andrew.. I am indeed kicking myself... but: you know what?? that's not what it was! -- it's STILL not working.. ok, html:
<body> <!-- <object classid="java:newPal.class" width=700 height=400> hey obj </object> I tried this obj tag but it didn't work.... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --> PAL 2:<br><br> <APPLET code="newPal.class" width=700 height=400> <param name="palin" value="ok, you got the param... ;) "> hey </APPLET> </body> </html>
.java:
import java.awt.Graphics; import java.awt.Font; import java.awt.Color;
public class newPal extends java.applet.Applet { Font f = new Font("TimesRoman", Font.BOLD, 36); String palin;
public void paint(Graphics screen) { screen.setFont(f); screen.setColor(Color.red); screen.drawString(palin, 5, 50); } public void init() { palin = getParameter("palin"); if (palin == null); palin = "NULL"; } }
// THANK YOU FOR YOUR HELP.... Frances :)
Frances Del Rio - 14 Sep 2004 02:16 GMT Andrew, here's url:
http://www.francesdelrio.com/java/applets/newPal.html
thank you again.. Frances
>>html: >><APPLET code="newPal.class" width=700 height=400> [quoted text clipped - 18 lines] > > HTH Andrew Thompson - 14 Sep 2004 07:13 GMT > Andrew, here's url: > > http://www.francesdelrio.com/java/applets/newPal.html I don't get it Frances.. Your web-page still shows 'null' and the code at the site does not have the offending ';' removed.
Are you going to fix it?
 Signature Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
Frances Del Rio - 14 Sep 2004 14:26 GMT ok, Andrew... what happens is I'm doing this from home AND from work, sometimes get confused as to versions of stuff I have at home vs. versions at home, etc.. ok, now it's working in IE, I see what it's sup. to display if there IS a value to the param.. now it's sup. to say "NOTHINGNESS" or "ok, you got the param"... BUT: Netscape is no go.. I emptied cache.. (netscape 7..) so: how do I do this in Netscape? thank you very much for yr help.. Frances
>>Andrew, here's url: >> [quoted text clipped - 5 lines] > > Are you going to fix it? Andrew Thompson - 14 Sep 2004 14:55 GMT > ok, Andrew... OK Frances. Time to state a few things specifically. Please do not top-post, I find it both confusing and irritating. <http://www.physci.org/codes/javafaq.jsp#netiquette>
Top-posting corrected ..for the last time hopefully.
[ ..and please do not launch into a big guilt/anger fest, I'd prefer to hear a simple 'beyond it' to lots of pointless 'sorry, sorry, sorry'.. ]
>>>http://www.francesdelrio.com/java/applets/newPal.html >> >> I don't get it Frances.. Your web-page >> still shows 'null' ..
>..what happens is I'm doing this from home AND from work, > sometimes get confused as to versions of stuff I have at home vs. > versions at home, etc.. Applets. The devil's work, I daresay. ;-)
> ok, now it's working in IE, I thought I had said this, perhaps to someone else in this forum, but you really need to state Browser+version/OS/Java version when talking internet.
You ..are *reading* this forum generally aren't you Frances?
In any case, it fails with (all Win XP) IE 6 running MSVM (class not found), NN 4.8 running Symantec 1.1.5 VM (bad class version number). It runs just fine in Mozilla 1.7.2 running Java 1.5.0 beta. I did not test Opera because the problem is obvious to me.
You did not compile your class files to work with 1.1 JVM's. See the advice I gave Dan Barnet on compiling for 1.1, in this group, today..
[ Big hint there.. ;-) ]
 Signature Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
Frances Del Rio - 14 Sep 2004 02:35 GMT >>>>I compile an applet (file.java), do the html w/the applet tag.. run it, >>>>works fine, both in viewer and browser.. [quoted text clipped - 57 lines] > Put the page up at GeoCities > or such and link to the code. well Andrew, what do you know... I got it to work in IE and now it won't work in Netscape.. when I wrote to you earlier I was at work, now at home it works in IE and not in N... this caching thing w/applets is turning out to be a bit of a nightmare... well, hope it's b/c I don't know enough yet.. but you know, either way this caching thing w/browsers in general has always bothered me.. why can't you just config yr browser so it never caches anything?? thank you again.. Frances
Andrew Thompson - 14 Sep 2004 07:28 GMT > why can't you just > config yr browser so it never caches anything?? (chuckles) You probably can, but for every developer that stresses over it, thousands of users benenfit from it.
And while on the subject, I was a bit perplexed by your other post, given your current version does not work for me.
I have a suggestion. Upload a new sub-directory inside the one you currently have on your site.
<http://www.francesdelrio.com/java/applets/2/>
Upload the latest HTML, .class and .java to the directory, and add a link from the HTML to the java.
That will neatly sidestep the caching problem for each new page. (You can be confident you see the applet the first time you check it, even with class caching.)
I suspect it does not work because you are confused and *think* you uploaded the new stuff, but didn't. You might have seen it work locally and been mistaken that you were lookin at the site.
(And people wonder why I claim that 'Applets ar not for beginners' - many seasoned developers break down and cry when developing applets.)
Sometimes Frances, with applets you need to, ..set them aside. Shut-down the computer, meet up with some friends and 'get roaring drunk'/'sing dance and laugh'..
 Signature Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
Frances Del Rio - 14 Sep 2004 14:28 GMT > I have a suggestion. Upload a new sub-directory > inside the one you currently have on your site. [quoted text clipped - 8 lines] > see the applet the first time you check it, > even with class caching.) but HTML links to class, not .java.. I mean to run this the HTML reads the .class, not the java, right??
<APPLET code="app/newPal.class" width=700 height=400> <param name="palin" value="Ok, you got the param... :)"> </APPLET>
pls explain.. thank you... Frances
> I suspect it does not work because you are confused > and *think* you uploaded the new stuff, but didn't. [quoted text clipped - 8 lines] > them aside. Shut-down the computer, meet up with some > friends and 'get roaring drunk'/'sing dance and laugh'.. Andrew Thompson - 14 Sep 2004 15:04 GMT >> <http://www.francesdelrio.com/java/applets/2/> >> >> Upload the latest HTML, .class and .java to the >> directory, and add a link from the HTML to the java. ..
> but HTML links to class, not .java.. I mean to run this the HTML > reads the .class, not the java, right?? > > <APPLET code="app/newPal.class" width=700 height=400> > <param name="palin" value="Ok, you got the param... :)"> > </APPLET> <html> <head> <title>Applet Test 2</title> <style type='text/css'> p { border: solid 10px red; } </style> </head> <body> <APPLET code=ttt3d.class width=100 height=100> <p>This applet requires Java. </APPLET> <p>Source code of <a href='./ttt3d.java'>ttt3d.java</a>. </body>
HTH ;-)
 Signature Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
Fred L. Kleinschmidt - 13 Sep 2004 18:03 GMT > I compile an applet (file.java), do the html w/the applet tag.. run it, > works fine, both in viewer and browser.. then I change something in [quoted text clipped - 4 lines] > > Frances Your old applet has been cached by the browser. Clear the cache.
 Signature Fred L. Kleinschmidt Boeing Associate Technical Fellow Technical Architect, Common User Interface Services M/S 2R-94 (206)544-5225
Matt Humphrey - 13 Sep 2004 18:11 GMT > I compile an applet (file.java), do the html w/the applet tag.. run it, > works fine, both in viewer and browser.. then I change something in > .java file, compile again.. but when I view in browser again it still > shows old version, can't see changes.. (can see them in appletviewer..) > why can't I see changes in browser?? this is happening w/all my > applets.. thank you.. The browser caches the applet, although different browsers will do this in different ways. For Internet Explorer, I open the browser's java console and use the commands there to flush the cache. When I reload the page it runs ok. In the worst case exit and restart the browser.
Cheers, Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
Dan Barnet - 24 Sep 2004 18:51 GMT > The browser caches the applet, although different browsers will do this in > different ways. For Internet Explorer, I open the browser's java console > and use the commands there to flush the cache. When I reload the page it > runs ok. In the worst case exit and restart the browser. To reload the applet I hold Ctrl while pressing the refresh button. I'm using IE6.
Dan Barnet - 24 Sep 2004 19:19 GMT > The browser caches the applet, although different browsers will do this in > different ways. For Internet Explorer, I open the browser's java console > and use the commands there to flush the cache. When I reload the page it > runs ok. In the worst case exit and restart the browser. To reload the applet I hold Ctrl while pressing the refresh button. I'm using IE6.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|