• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

I'm new and already stumped!

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's right, can't get a very simple program like the HelloWorld program to work! I have programmed in Java for a long while now... but I have never ventured into the wonderful world of Applets.
See, I run this applet locally and it works fine. Toss it up on another machine that's my HTTP server and it runs fine. Try it on that machine, it runs fine. But when I ask anyone else to try it, it doesn't work. Finally I have found one (of probably 8 people I've asked) that could actually see my button. I have no idea what I'm doing wrong.
Please try it out, let me know...
You can get the java file at http://www.geocities.com/Fastest95PGT/Demo.java
You can try the Applet that doesn't seem to work at http://www.geocities.com/Fastest95PGT/Demo.html
And you can grab the .class if you want it for whatever reason at http://www.geocities.com/Fastest95PGT/Demo.class
Please try it out, let me know what you think. It's just one button at the top of the applet window. It doesn't do anything, just want something to actually display and not give an error about not finding the .class file or something. If you see what's wrong, please let me know.
Thanks!
Jeff
p.s. All I really want to do is make it so I can insert a JPanel into the applet settings so that I can run my normal programs as an Applet instead of a Program... if someone has something simple for me to do, a template for example, that'd be great!
[ October 07, 2002: Message edited by: Jeff Grant ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
works fine on my machine, but then i do have the latest version of the java runtime. I think in the past you had to download the swing classes seperately as a plugin to be able to use them in a browser, possibly the people who can't see the button have older versions of the java runtime. If you want to make sure it work avoid swing and use the AWT
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most of the errors the other people tried said it could not find "Demo.class". That made me think it was possibly my HTML that was incorrect. Thanks for telling me it works for you.
Unfortunately I'm not sure what the difference between AWT and Swing are... :roll:
~Jeff
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Works for me. I'm running IE6, SP1 on Windows2000 SP3, with JDK1.4.1 installed.
 
Saloon Keeper
Posts: 28468
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You DO realize that most people's web browsers are supplied with really antique Java implementations, don't you? A JPanel is a Swing feature and both Netscape and IE come equipped (using the term carefully in IE's case) with a version of Java that predates Swing.
To make an applet using Swing work for everyone you need to ensure that they have the Java Plug-in installed. Since that's about 5MB, a lot of us write down to the AWT featureset of Java 1.0.2 to avoid annoying the user.
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a place that I can get a set of functions for 1.0.2?
Or, perhaps, include certain files on my web page which the Applet could reference for the functions which the user might not have downloaded?
~Jeff

Originally posted by Tim Holloway:
You DO realize that most people's web browsers are supplied with really antique Java implementations, don't you? A JPanel is a Swing feature and both Netscape and IE come equipped (using the term carefully in IE's case) with a version of Java that predates Swing.
To make an applet using Swing work for everyone you need to ensure that they have the Java Plug-in installed. Since that's about 5MB, a lot of us write down to the AWT featureset of Java 1.0.2 to avoid annoying the user.

 
Tim Holloway
Saloon Keeper
Posts: 28468
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The 1.0.2 functionality is still there in JDK 1.4. for you to develop with. You just have to use only stuff that's in the java.awt packages and avoid using stuff from java.swing. Also before using a method, check to make sure that the JavaDocs for it don't say "since 1.1" or something like that. Also avoid other modern-day constructs like the java collections in java.util. All 1.0.2 supports is java.util.Vector and java.util.Hashtable unless I've missed something.
While it would be nice to "reference" or selectively download just what you need, Swing doesn't break down that nicely. It's the whole 5MB or nothing, I'm afraid.
If your users can tolerate a process that included that large a download followed by a short install process, you can use the Java plug-in which will allow you to use any of the JDK 1.4 features.
You can find out more about it here: http://java.sun.com/products/plugin/index.html
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your demo applet worked fine on my machine using
IE 6
Netscape 7
did NOT work using
Netscape 4.7
I do have the latest plug-in from Sun but I have problems getting it to work in Netscape 4.7 (for reasons I don't understand yet)
 
david eberhardt
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

p.s. All I really want to do is make it so I can insert a JPanel into the applet settings so that I can run my normal programs as an Applet instead of a Program... if someone has something simple for me to do, a template for example, that'd be great!


I looked around for a template so I can run my programs either as an Applet or an application from command line and here is what I found:
(borrowed from "Java How To Program" 4th Edition, Deitel and Deitel)

NOTE: make sure you write an html file to go with this ...
call from command line 2 ways:
java AppletToApp
or
appletviewer AppletToApp.html
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
UGH, I am going nuts.
I tried writing in straight up AWT for those who were "java impared" with their java updates. However, people still can't run this code!

Thoughts?? The two people who tested it were running IE 6.0.26.
I'm stumped again. Thought this'd fix it. One got a Class not found error and the other got just a plain grey box.
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, my code in the html to run this applet is..

But I think that's okay.
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't post a link to the new applet. Is this the URL for it?
http://www.geocities.com/Fastest95PGT/Demo.html
First, let me rant here. Please don't use AWT just because you don't want your user to d/l the latest java plug in. It seems that only java programmers think this is a problem.
If I want to see the latest Britney Spears blooper video and a site tells me I need to d/l the latest SuperRealPlayer2003, well, if I really want to see it, I do.
If I want to play the latest SuperBoingBoingDelux and the site tells me I need to d/l the latest MM Flash 27.5 DeluxSpiderMan edition, I do.
Why is it any harder for a user who really wants to use your applet to d/l the latest java plug in?
Microsoft giggles over this with glee. They WANT people to look at an AWT java applet and say "Boy that looks ugly. Java must suck." And they're right, AWT is ugly. It was a stopgap UI they threw together. Swing is beautiful and elegant and gives you much more control of your UI, so I encourage you to fully exploit its power.
That being said, your applet works fine in my browser (assuming that link is the new applet). One thing you may want to try is the -target compiler flag, so your bytecode gets compiled in a version that supports older JVMs.
[ October 11, 2002: Message edited by: Rob Ross ]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeff Grant:
I tried writing in straight up AWT for those who were "java impared" with their java updates. However, people still can't run this code!


Like Rob said, if you're going to write for people without the plug-in, you need to compile with the -target 1.1 flag. If you're going to use the plug-in so you can use swing and more current java stuff (more current than jdk 1.1), you need to use a different html page to require the plug-in -- something more than just
applet
code=
height=
width=
/applet
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marilyn de Queiroz:

Like Rob said, if you're going to write for people without the plug-in, you need to compile with the -target 1.1 flag. If you're going to use the plug-in so you can use swing and more current java stuff (more current than jdk 1.1), you need to use a different html page to require the plug-in -- something more than just
applet
code=
height=
width=
/applet


I see... Hmm, so I guess I could go back and write my normal Swing stuff and just make the user DL it. Yeah, if they really want to use it, they'll have to DL the update. Heck, most people are on broadband nowadays anywas.
Could you give me some example of how it would check to see if the user had the proper version of JDK? And how it'd foreward them to any selected page if not? That'd help, and yeah, I think it's a good idea to just write like I always have and stop satisfying Microsoft's outdated preinstalled JDK.
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, yes, that link was the updated one.
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/t/254541/Applets/java/Game-Tutorials-Exploring-Browser-Support
http://java.sun.com/products/plugin/index-1.4.html
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I get grey box with do nothing test button.
Browser Mozilla 1.1 someting
Java Console Info:
Java(TM) Plug-in: Version 1.4.0_01
Verwendung der JRE-Version 1.4.0_01 Java HotSpot(TM) Client VM
Home-Verzeichnis des Benutzers = C:\WINDOWS
Proxy-Konfiguration roxy-Konfiguration des Browsers
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marilyn de Queiroz:
https://coderanch.com/t/254541/Applets/java/Game-Tutorials-Exploring-Browser-Support


Welp, the first link didn't really seem to offer any help as to HOW to get the user to redirect to download the new JDK if theirs was not supported. However, I now see that it looks as though Netscape requires you to use an "<EMBED>" tag instead of "<APPLET>" to run applets.
I'm still sorta lost. I'm going to attempt to swipe Sun's javascript to insert the proper HTML per the user's browser.
But I wish someone could give me an example of a simple re-route to a page I create asking the user to simply download and install a more updated JDK to view my applet. Suggestions?
~Jeff Grant
 
Just the other day, I was thinking ... about this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic