Solved

Running applet locally: class not found error

Posted on 2003-11-26
19
1,693 Views
Last Modified: 2013-11-23
I am trying to run applet on my home pc, but having trouble.
The followings are directory layout after creating jar of classes files and resources with.
From $C;\classes:
Jar cvf dkim18.jar images dkim18
C:\src\dkim18\library\LibraryApplet.java
C:\classes\images\CheckOut.gif
C:\classes\images\CheckIn.gif
C:\classes\dkim18\library\LibraryApplet$1.class
C:\classes\dkim18\library\LibraryApplet.class
C:\classes\dkim18.jar
C:\LibraryApplet.html

And this is my applet tag in LibraryApplet.html.

<applet code="dkim18.library.LibraryApplet.class"
      codebase="classes"
        archive="classes\dkim18.jar"

        width="900" height="300">

When I try to run, I have “class dkim18.library.LibraryApplet not found” error. Why can’t appletviewer find class?

Thank you your help

0
Comment
Question by:dkim18
  • 10
  • 6
  • 3
19 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9824771
>>dkim18.library.LibraryApplet

Means that the class must be in package

dkim18.library

Please print the contents of jar and post

jar -tvf dkim18.jar
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9824802
>>Means that the class must be in package...

...which of course means that the source of LibraryApplet must start

package dkim18.library;


0
 

Author Comment

by:dkim18
ID: 9824845
...2003 META-INF/
...2003 META-INF/MANIFEST.MF
...2003 images/
...2003 images/CheckIn.gif
...2003 images/CheckOut.gif
...2003 images/Thumbs.db
...2003 dkiim18/
...2003 dkim18/library/
...2003 dkim18/library/LibraryApplet$1.class
...2003 dkim18/library/LibraryApplet.class

I already included package dkim18.library in my LibraryApplet.java file.

thanks,

0
 

Author Comment

by:dkim18
ID: 9824893
I mean...I still have same error.
0
 
LVL 35

Assisted Solution

by:TimYates
TimYates earned 125 total points
ID: 9824947
Does:

<applet code="dkim18.library.LibraryApplet.class"
        archive="classes/dkim18.jar"
        width="900" height="300">

work?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9825106
What happens when you run

java -classpath dkim18.jar dkim18.library.LibraryApplet

?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9825113
Or rather

appletviewer ...

not

java ...
0
 

Author Comment

by:dkim18
ID: 9825337
<applet code="dkim18.library.LibraryApplet.class"
        archive="classes/dkim18.jar"
        width="900" height="300">
 
doesn't work either.

if  I run java -classpath dkim18.jar dkim18.library.LibraryApplet  
I get NoClassDefFoundError.

if I run appletviewer -classpath dkim18.jar dkim18.library.LibraryApplet  -classpath doen't get supperted and if I run appletviewer dkim18.jar dkim18.library.LibraryApplet, then I have I/O error
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9825348
can you move the archive out of the classes folder into the same folder as the html, and try:

 <applet code="dkim18.library.LibraryApplet.class"
        archive="dkim18.jar"
        width="900" height="300">

?

Are you sure the class:

LibraryApplet.class

is inside the package

dkim18.library

and it's inside the folder

/dkim18/library in the jar file?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 86

Expert Comment

by:CEHJ
ID: 9825385
>>
if  I run java -classpath dkim18.jar dkim18.library.LibraryApplet  
I get NoClassDefFoundError.
>>

Try

appletviewer -J-classpath -Jdkim18.jar dkim18.library.LibraryApplet  
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 125 total points
ID: 9825413
Incidentally, move that jar well away from the directories in question before testing, or there could be all kinds of confusion.
0
 

Author Comment

by:dkim18
ID: 9825831
can you move the archive out of the classes folder into the same folder as the html, and try:

 <applet code="dkim18.library.LibraryApplet.class"
        archive="dkim18.jar"
        width="900" height="300">

>>I did, but didn't work

Are you sure the class:

LibraryApplet.class

is inside the package

dkim18.library

and it's inside the folder

/dkim18/library in the jar file?

>>Yes


Try

appletviewer -J-classpath -Jdkim18.jar dkim18.library.LibraryApplet  

>>same I/O error

Incidentally, move that jar well away from the directories in question before testing, or there could be all kinds of confusion.

>>I moved jar file away but didn't help, indeed I need jar file under classes dir for this project.
0
 

Author Comment

by:dkim18
ID: 9826766
I did solve the problem. I didn’t update jar file. I compile and then should create jar file.
I am sorry for my ignorance and thank you for all your answers. Since this was my fault I will still give points whoever answered to my question.
0
 

Author Comment

by:dkim18
ID: 9826831
When I tried to split the points, it says i need to select at least two accepted ansewers, but
I can't select two accepted ansewers even though I use ctrl key. How do I do it?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9826837
! LOL. Never mind - easily done. Happy to split points with Tim...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9826842
>>I can't select two accepted ansewers even though

Just use the radio button/ check box (can't remember which now)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9826871
Yes - what you have to do is use one radio button but two text boxes for inserting points
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9826886
:-)

Glad you got it sorted :-)

Good luck!!

And thanks!!

Tim
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9827004
:-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unexpected HttpURLConnection connection behavior 2 86
bitbucket vs gitbucket 3 58
thymeleaf natural templating vs JSP 2 69
MySqlDump not dumping triggers 1 19
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now