General discussion
-
CreatorTopic
-
April 15, 2005 at 7:55 am #2187794
Simple applet won’t run – please help
Lockedby madestroitsolutions · about 18 years, 11 months ago
Hi all,
I am an experienced programmer trying to learn Java. I have a very simple applet that I cannot get to run for some reason. Please see the code below:import java.applet.*;
import java.awt.*;public class BLinkJVerCheck extends Applet
{
private Label m_labVersionVendor;
public void init()
{
Color colFrameBackground = Color.pink;
this.setBackground(colFrameBackground);
m_labVersionVendor = new Label (” Java Version: ” +
System.getProperty(“java.version”) +
” from “+System.getProperty(“java.vendor”));
this.add(m_labVersionVendor);
}
}As you can see, this a pretty simple, straight forward applet, but for some reason when I attempt to run it on a web page, I get the following error (when I put the mouse on top of the square the applet is supposed to draw):
load: class BLinkJVerCheck not found
The tag on the web page:
The applet file IS sitting in the same folder as the web page that calls it. When I compile the applet, everything goes ok, I get no errors and the class file is generated.
Any ideas….???… I always found Java annoying, and now that I finally want to make the move, I cannot get a stupid applet to work… please HELP!
Thank you in advance!
Topic is locked -
CreatorTopic
All Comments
-
AuthorReplies
-
-
April 15, 2005 at 3:32 pm #3248701
Reply To: Simple applet won’t run – please help
by tony hopkinson · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
Not mad keen on Java myself.
Try this link
http://javaboutique.internet.com/tutorials/Java_by_Example/section1_1.html-
May 3, 2005 at 9:17 am #3261017
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you. A good source. Still not able to fix my problem though…
-
-
April 21, 2005 at 1:15 am #3247310
Reply To: Simple applet won’t run – please help
by martin simons · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
If you are using Internet Explorer to view this
applet, you will probably need to compile this
using the option “-target 1.1”. And, if you are
using jdk 1.5 (5.0) you will probably not be able
to use this option.-
May 3, 2005 at 9:17 am #3261016
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. Yes, I was not able to compile it with that option on 5.0
I did try it with 1.4.x though. The compiler yields no errors but the appletviewer does not launch and the applet does not load on the page.
-
-
April 21, 2005 at 1:19 am #3247308
Reply To: Simple applet won’t run – please help
by debfar · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
I just copied your Java code then compiled it,
then I created a simple HTML page and pasted your applet tag into the page. And guess what?
It works just fine through my IE browser.Here is what I have on my simple HTML page:
—————–
Applet
Applet
—————–-
May 3, 2005 at 7:28 am #3261110
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for your reply. I tried your tag but it still doesn’t work. Must be something with compilation. Thanks again!
-
-
April 21, 2005 at 1:33 am #3247304
Reply To: Simple applet won’t run – please help
by tarzanek · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
Hi there,
actually your java code is OK along with the html page tag. I am running WINXP with JAVA5 installed & the applet made from your article was running fine. I suppose the problem is elsewhere. Probably bad instalation of JDK or browser plugin. Try setting CLASSPATH (mine is not set & still the applet works) or checking whether there couldn’t be some browser related problems.-
May 3, 2005 at 9:17 am #3261014
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. I think the problem may be a conflict of installations. Please see other responses. Thank you!
-
-
April 21, 2005 at 1:53 am #3247300
Reply To: Simple applet won’t run – please help
by rafiq · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
hi,
your code looks ok. Why not you first try out the applet using AppletViewer before trying in the browser.hope this helps,
rgds,
Rafiq.-
May 3, 2005 at 8:12 am #3261070
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. I used the appletviewer and it doesn’t do anything. The command line executes but the appletviewer does not start, so I imagine something is wrong with the compiled code. Although your answer put me in the right direction, it still didn’t solve my problem. Your reply is very much appreciated, thanks again!.
-
-
April 21, 2005 at 2:05 am #3247298
Reply To: Simple applet won’t run – please help
by cyberknault · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
Okay, I am suspecting your class file format is not compatible with the VM you are running. If you are running your class in IE with Microsoft VM, try compile the source with target is 1.1.
Hope this help.
-
May 3, 2005 at 8:12 am #3261068
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. I tried your suggestion. The kit I am using does not allow compilation with target 1.1, I get the following error:
target release 1.1 conflicts with default source release 1.5
Thanks again!
-
-
April 21, 2005 at 3:21 am #3247275
Reply To: Simple applet won’t run – please help
by sps1 · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
This looks like a classpath problem. Setting your classpath to include the folder
containing your class file may work, but some flavours of jre/vm have bugs/security
issues that prevent this fix working.
The only definitive diagnosis is to see what happens when you add your class file to
one of the class libraries of your jre/vm – if it works, this is also the only fix until you
install another jre/vm.-
May 3, 2005 at 9:17 am #3261015
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. I tried your suggestions and I found out that I actually have 4 different JDK’s/JRE’s installed…
-
-
April 21, 2005 at 3:52 am #3247262
Reply To: Simple applet won’t run – please help
by saurangshu · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
Hi,
This seems to be a classpath issue. Place your class in the defined system classpath and restart the browser.
thx
-
May 3, 2005 at 9:17 am #3261013
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. I tried that. No luck….
-
-
April 21, 2005 at 4:33 am #3247243
Reply To: Simple applet won’t run – please help
by deveshpradhan · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
Use “-target 1.1” while compiling the code and I hope u will get rid of the issue. I tried your code and it was not working for me either.But then I compiled the code with “-target 1.1” option and it was running successfully.
Usage:
javac -target 1.1 BLinkJVerCheck.javaDevesh
-
May 3, 2005 at 8:12 am #3261069
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. What version of the jdk did you compile it with? I cannot use 1.1 with 1.5.0_02
-
-
April 21, 2005 at 5:18 am #3247221
Reply To: Simple applet won’t run – please help
by ravanibhavik · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
May be u need to set the classpath in your Environmental Variable (classpath should be of your bin folder). Or u can put your .class file in your “bin” folder and run your applet from there.
-
May 3, 2005 at 8:12 am #3261067
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. Didn’t help.
-
-
April 21, 2005 at 5:41 am #3247211
Reply To: Simple applet won’t run – please help
by mike · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
Well, I’ve got good news, and bad news.
The good news is, when I compile your example and duplicate your page, it works fine on my system, in both Mozilla and IE, under the exact conditions that you lay out. Bad new is that doesn’t get us any closer to fixing your problem. When I tried to load the applet in IE, I got security errors, service pack 2 still thinks java is the greatest threat known to mankind, so if you have alerts turned off that could be the problem. Which version of Java and the plug-in are your using? I know that older versions of Java under IE had problems with the applet tag, you had to wrap it in an object tag, but newer ones should do fine.
hth
Mike-
May 3, 2005 at 9:17 am #3261011
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. From many other tests I have conducted following other posts’ advice, I have come to the conclusion that this is not browser (or code, JAVA or HTML) related. It has to do with compilation, but I still can’t figure it out.
-
-
April 21, 2005 at 6:45 am #3247166
Reply To: Simple applet won’t run – please help
by mjremijan · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
I tried what you gave on FireFox and IE on Windows XP and had no problems. You’d need to post more information about your setup if it’s still not working.
-
May 3, 2005 at 9:17 am #3261012
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for your reply. Please see comments on other posts.
-
-
April 21, 2005 at 6:50 am #3247161
Reply To: Simple applet won’t run – please help
by charles simon · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
I would strongly urge you to not use the Microsoft JVM. It is very old and has many bugs/limitations. Use the current Java version from Sun.
If you must use the MS JVM then you will need to compile the applet code to be compatible with Java 1.1 as mentioned in some of the other comments.
Last but by far not least is, to use the Java plugin, you will need to verify that your IE security settings do not disable scripting and Active-X controls. The best setting is to have it prompt you, then you will know if the plugin is actually starting.
-
May 3, 2005 at 8:57 am #3261030
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. Unfortunately It MUST use Microsoft’s JVM. We are stuck with it.
-
-
April 21, 2005 at 6:51 am #3247160
Reply To: Simple applet won’t run – please help
by georgehsnyder · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
You’re running in a browser, Your browser is configured to look for classes in a specific directory. If your browser thinks /this/html/dir is the root dir it can not access anything not below /this/html/dir. This keeps users from browsing your system. It also means you have to have classes in the correct CLASSPATH. Check your environment variables.
-
May 3, 2005 at 8:57 am #3261031
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. Still not working.
-
-
April 21, 2005 at 6:52 am #3247157
Reply To: Simple applet won’t run – please help
by alexmy · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
Try to use codebase attribute in applet tag.
-
May 3, 2005 at 8:57 am #3261029
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. Didn’t work.
-
-
April 21, 2005 at 7:18 am #3247145
Reply To: Simple applet won’t run – please help
by fipilica · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
On my computer win 2000 it works like a charm.
I suggest to specify a package and put that class into a .jar file. The html file may look like this:
HTML Test Page
-
May 3, 2005 at 8:26 am #3261056
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. Sounds good, how do I stick it into a Jar file? Java beginner here…. >:P
-
-
April 21, 2005 at 9:28 am #3246372
Reply To: Simple applet won’t run – please help
by jimmydevenport · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
I got it to load fine using appletviewer: create web page with tag instead of XHTML… then load appletviewer test.html or whatever you called your html file. Then I loaded that using Firefox 1.0 (moz 1.7.5 core, Windows XP SP2) and it worked fine… is the problem with IE? Mozilla? Also see HTMLConverter which comes with the JSDK – that may help you convert the applet so it works on various browsers … but sometimes it is buggy also… the best best is to make sure you have the latest JRE installed and “plugged in” to the browser… also see the Java Plug-in settings via your Windows control panel…
-
May 3, 2005 at 8:26 am #3261054
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. I have tried your suggestions, but it still doesnt work. I appreciate your input.
-
-
April 21, 2005 at 12:32 pm #3246250
Reply To: Simple applet won’t run – please help
by ncaajam · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
I played with javabeans as a proof-of-concept for a project I worked on a while back that captured JPGs of screens as the user navigated our internal web site.
I have an HTML file with
in it and the file BLinkJVerCheck.class is in the same directory. It worked fine.
Is it possible that you have the class file somewhere the classpath can’t find it?
-
May 3, 2005 at 8:26 am #3261055
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
I am no Java expert by any means, so I guess it is possible. How can I find out the current value of the CLASSPATH?
-
-
April 21, 2005 at 6:04 pm #3244689
Reply To: Simple applet won’t run – please help
by clgan333 · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
Your java code is fine but when I test it on Java Beans for Sun, it fails as what is shall get. I think you’re use some Java SDE tool to test the code. But when I use normal procedure to test it, it works properly. I do agree with the classpath problem.
I found your code is not in constantly implement the coding convention, please notice
that the ***m_labVersionVendor*** and ***colFrameBackground***, one use Hungarian prefix and other no… I guess you are VB programmer. Someone do argue about to place the prefix for the variable, lengthy work and cumbersome to do some. But for me, I preferred to use Huangarian prefix since it will reveal the scope of variable which I deal with.Proposal: use ***m_labVersionVendor*** for class scope and ***l_colFrameBackground*** for local scope, and g_intCounter for global scope of convention, it show stringent software engineering practice…
-
May 3, 2005 at 8:23 am #3261062
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. The code is not mine. I actually got it from a web site. I use Hungarian too. I need to get this running by tomorrow and I still haven’t been able to make it work. I am doing a fresh installation of J2SE JDK 5.0 Update 3 on another machine….
-
-
April 22, 2005 at 8:50 am #3244440
Reply To: Simple applet won’t run – please help
by ablake1 · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
You haven’t specified the codebase property of the applet tag in your html file. This property should specify the path to your applet’s jar file.
-
May 3, 2005 at 8:23 am #3261061
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. This is a standalone applet, not part of any package. I am putting the class file in the web page folder but it doesn’t work. Thanks!
-
-
April 22, 2005 at 1:36 pm #3243203
Reply To: Simple applet won’t run – please help
by ablake1 · about 18 years, 11 months ago
In reply to Simple applet won’t run – please help
You haven’t specified the codebase property of the applet tag; the value should be the path to the applet jar file.
-
May 3, 2005 at 8:23 am #3261059
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. This is a standalone applet, not part of any package. I am putting the class file in the web page folder but it doesn’t work. Thanks!
-
-
May 2, 2005 at 2:13 pm #3261759
Reply To: Simple applet won’t run – please help
by g… · about 18 years, 10 months ago
In reply to Simple applet won’t run – please help
I saw a some funny things in there but there’s only one problem and it’s that you don’t have the right path to your applet. usually it helps if you put the path INCLUDED the package of the applet and, if you’re copying your applet, remember to copy the .CLASS and NOT the source. You need the compiled version of you code.
-
May 3, 2005 at 8:23 am #3261060
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for replying. This is a standalone applet, not part of any package. I am putting the class file in the web page folder but it doesn’t work. Thanks!
-
-
May 4, 2005 at 8:57 am #3242014
Reply To: Simple applet won’t run – please help
by g… · about 18 years, 10 months ago
In reply to Simple applet won’t run – please help
Do you have de BLinkVerCheck$1.class in the same directory?
-
May 4, 2005 at 8:59 am #3242012
Reply To: Simple applet won’t run – please help
by g… · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
and maybe codebase=./ in the applet tag
-
May 4, 2005 at 12:05 pm #3241918
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Poster rated this answer.
-
-
May 4, 2005 at 10:19 am #3241982
Reply To: Simple applet won’t run – please help
by tarzanek · about 18 years, 10 months ago
In reply to Simple applet won’t run – please help
🙂
already happened to me … got some conflicts between 1.4.2 & 5.0 installations of jdk
heh … btw. unfortunately some code in java is written for a special version of jre … e.g. hibernate 2.1 got some serious problems running with 5.0 (at least examples) … don’t know about 3.0 but such a thing could really upset you
hmm … it’s quite easy to run separate version of jre in java IDEs for separate projects, that’s why it should be possible to set up one main new system JRE & still have the possibility to switch to the old one … but … sometimes it’s quite a hack to accomplish it 😀 (at least in m$ win … reinstall is really necessary … but linux … symlinks rulez ;-D )-
May 4, 2005 at 12:05 pm #3241917
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Reply To: Simple applet won’t run – please help
Thank you for your help. I appreciate it. For everyone out there, thank you again. In the end, the problem turned out to be some kind of misconfiguration because I had 4 different versions running on the same machine. I still can’t get the appletviewer to load the applet, but at least the applet now works on the page. I have tried time and time again to get into Java but this latest incident has proven once again that this is just not for me. Much respect to everyone out there who does Java but personally I think it is a piece of junk. (maybe it is just frustration…)
-
-
May 4, 2005 at 12:05 pm #3241916
Reply To: Simple applet won’t run – please help
by madestroitsolutions · about 18 years, 10 months ago
In reply to Simple applet won’t run – please help
This question was closed by the author
-
-
AuthorReplies