473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error while running Applet

Hi All

I got a problem in running java programs.

i am not able to run java applet while running i got a problem as
Loading Java Applet Failed

java.lang.NoClassDefFoundError: App (wrong name: src/App)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknow n Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

myhtml file is like this

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4.  
  5.  
  6. <title>My Applet</title>
  7.  
  8.  
  9.  
  10. </head>
  11.  
  12.  
  13. <body>
  14.  
  15. <h1>Network Applet</h1>
  16.  
  17. <APPLET CODE="App.class" CODEBASE = "\src"  WIDTH=200 HEIGHT=50>
  18.  
  19.  
  20. </APPLET>
  21.  
  22.  
  23.  
  24. </body>
  25.  
  26. </html>
  27.  

the App.java file is



App.java



Expand|Select|Wrap|Line Numbers
  1.  
  2. package src;
  3.  
  4.  
  5.  
  6. import java.awt.*;
  7.  
  8. import java.applet.*;
  9.  
  10. import javax.swing.JApplet;
  11.  
  12. public class App extends JApplet
  13.  
  14. {
  15.  
  16. public void paint(Graphics g)
  17.  
  18. {
  19.  
  20. g.drawString("Hello",100,100);
  21.  
  22. }
  23.  
  24.  
  25. }
  26.  
  27.  
I kept the html file and App.class file in src directory...
so that i specified the CODEBASE in html file like CODEBASE = "\src"
i changed this in so many ways also but no use
i specified complete path of .class file also but it was not run for me..

my directory structure is

src----
app.java
app.class
myhtml.html

Iam using ant to build application so that i also set path to ant...



my jdk path settings are



CLASSPATH

C:\j2sdk1.4.2_12\bin;C:\j2sdk1.4.2_12\lib;





path

C:\ant\bin;C:\j2sdk1.4.2_12\bin;



JAVA_HOME

C:\j2sdk1.4.2_12



ANT_HOME

C:\ant

can anybody help me...
Mar 8 '07 #1
0 1461

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jeff T. | last post by:
I have an applet that sizes itself to the size of the browser frame that it is running in. On IE the applet resizes upon dragging the frame divider. I'm having a problem with getting this...
3
by: Al | last post by:
I've been attempting to run a small java applet via a cron on linux with the following command: 50 * * * * /home/usr/java/program/;java runScript I know runScript is running but the gui never...
2
by: David Haga | last post by:
How can I query an applet from Javascript to determine when it is running? I need to start a second applet but only when I know the first applet is completely loaded, initialized and executing.
5
by: azgoddess1 | last post by:
During the installation I get these error messages: ***** SQL1390C The environment variable DB2Instance is not defined or is invalid An error ocured while loading the command "C:\Program...
1
by: rajesh | last post by:
var fixedX = -1 // x position (-1 if to appear below control) var fixedY = -1 // y position (-1 if to appear below control) var startAt = 0 // 0 - sunday ; 1 - monday var showWeekNumber =...
1
by: jindalily | last post by:
Hey guys, I wasn't completely sure if this would be a Java or JS topic, but I thought it had more to do with Ajax and whatnot. Anyway, I have an embedded and signed Java applet on my page like so:...
7
by: adrian.bartholomew | last post by:
Im getting an error: Error: unterminated string literal Source File: http://98.214.38.110/allfours/site_flash/2.php Line: 75, Column: 37 Source Code: if (_ie == true) document.writeln(' ...
0
by: gotnspikes | last post by:
I am trying to create an applet using SitePad Pro. I am a college student and have a lab where I need to create applets. I did it in class just fine. I tried to run a "Hello World!" applet and it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.