473,405 Members | 2,282 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,405 software developers and data experts.

Class inside a class problem

Hi,

I made a little Japplet in Netbeans. It uses a sub-class to store some
things. Netbeans can get the stuff compiled and running but when I try it in
Internet Explorer the Java console gives this error :
"java.lang.NoClassDefFoundError: <applet>$<sub-class>"

I've declared the sub class as follow :
public class TestApplet extends javax.swing.JApplet {
public class Number
< stuff >
}
< bla bla >
}

I know I can put this number class into another Java file but due some
isseus(it got to be stored on a microcontroller) I want everything in 1
..class file. Why is Internet Explorer too stupid to execute the applet or
am I doing something wrong?

Greetings,
Rick
Jul 17 '05 #1
5 5557
Well, I 'solved' the problem a bit. I saw Netbeans generates 3 files in this
case :
- TestApplet.class
- TestApplet$Number.class
- TestApplet$1.class // where the heck is this one good for?
It works in IE now but then again, ain't there a way to stuff al these 3
files in one?

Greetings,
Rick
Jul 17 '05 #2
"Rick" <as******@hotmail.com> wrote in message news:<3f***********************@news.xs4all.nl>...
Well, I 'solved' the problem a bit. I saw Netbeans generates 3 files in this
case :
- TestApplet.class
- TestApplet$Number.class
- TestApplet$1.class // where the heck is this one good for?
It works in IE now but then again, ain't there a way to stuff al these 3
files in one?

Greetings,
Rick


hi
bundle them in a jar
& use archive=myjar in APPLET tag

regards
amey
Jul 17 '05 #3
Thanks for the tip! But can JAR files be executed like normal class files in
a webpage or do I need to 'unzip' them first?

Greetings,
Rick
Jul 17 '05 #4
Maybe it's just me but I can't get the jar files to work. Originally I had 1
java file with 1 sub class. After compiling I got 3 class files. I packed
the stuff in 1 jar file using the JDK tool and then created a new test
folder. Inside that folder there are 2 files now,
the jar file (test.jar)
and a html webpage for testing
In that testpage I now have these lines for loading the applet :

<APPLET code="myClass.class" ARCHIVE="test.jar"
width=300 height=200></APPLET>

When running the webpage in Internet Exploder 5.5 (win98) the applet won't
get loaded. If I view the Java Console it seems that he just tries to find
myClass.class. But there's nothing about test.jar so I doubt if the webpage
even tries to use the jar file. These are the 2 errors :
"java.lang.classNotFoundException: myClass.class"
"java.io.fileNotFoundException: ....\myClass\class.class"
As for the second error, that file indeed doesn't exists but where to change
that path? Maybe it has something to do with the platform?

Greetings,
Rick
Jul 17 '05 #5
Never mind, it was the case sensitiv shit, Java messed up filenames etc.
etc. I hate case sensitivity but what am I gonna do about it? anyway, thanks
for helping!

Greetings,
Rick
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lüpher Cypher | last post by:
Ok, here's what I'm trying to do. I have a class. Inside the class I have a method that reads a text file. In the text file I have a class name and a file name where that class is defined. Now, I...
13
by: Bryan Parkoff | last post by:
I have created three classes according to my own design. First class is called CMain. It is the Top Class. Second class and third class are called CMemory and CMPU. They are the sub-classes....
2
by: Ruben Campos | last post by:
I have a problem with a template function that is declared as a friend of a template class. I'll first show the exact problem with source code: // MyClass.hpp template <typename T> class...
3
by: nicver | last post by:
I am fixing a client's Web site and for some reason an ASP class does not want to use the variables it retrieves when it initialiases. This is an excerpt of the class and it is enough to show...
2
by: rhamlin | last post by:
I'm working on a class. When instantiating I pass the variable name referencing the class (vw) and the page object where the class will display (view). In this class I create a DIV. I also...
12
by: Peter Cranz | last post by:
hello, I've got the following problem: I have a construct similar like this: namespace A { class X {
7
by: for.fun | last post by:
Hi everybody, I have the following problem : B class need A::MyEnum type and A class need B::MyEnum type. In both case, the class type is incomplete so it is obvious that the ::MyEnum can not...
7
by: vabby | last post by:
Hi I have run into an eerie situation whihc i cant make out. I have a class A which has has two virtual functions with the same name, having diff arguments. Basically a case of function...
9
by: Matthias Buelow | last post by:
Hi folks, I've got something like: class Outer { int f(); friend class Inner; class Inner { int g() {
5
by: Andy B | last post by:
I am trying to figure out how to make an object instance available for all methods of a class. I tried to do something like this: public class test { TheObject Instance = new TheObject();...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.