Many class files resulting from one Java file.

L

lrantisi

Dear friends.
I have an Applet in a java file. But the applet uses two other classes
inside the same .java file
When I compile that file, I get many .class files.
Now I want to put this applet on the web.
So I uploaded all the .class files that were generated from building
the original .java file.

Of course I have to put an HTML file, and inside the code of that HTML
file, I should indicate the required .class file of the Applet. But
what about the other .class file: They are already on the web, but the
browser will not know about them, it will know only about the .class
file of the Applet.

What is the solution to this problem, I tried an example and it didn't
work, and the problem , as I mentioned, is that the other .class files
are not mentioned inside the HTML file.
Is the Jar technology a solution, and how to do it.

Thank you all.
 
M

Mike Schilling

lrantisi said:
Dear friends.
I have an Applet in a java file. But the applet uses two other classes
inside the same .java file
When I compile that file, I get many .class files.

This happens when you use nested or inner classes.
Now I want to put this applet on the web.
So I uploaded all the .class files that were generated from building
the original .java file.

Of course I have to put an HTML file, and inside the code of that HTML
file, I should indicate the required .class file of the Applet. But
what about the other .class file: They are already on the web, but the
browser will not know about them, it will know only about the .class
file of the Applet.

What is the solution to this problem, I tried an example and it didn't
work, and the problem , as I mentioned, is that the other .class files
are not mentioned inside the HTML file.
Is the Jar technology a solution, and how to do it.

Yes. There's no need for an applet for be a single class file; in fact,
that would be quite unusual. Collect all of your class files into a jar
file (using the jar utility), and install that along with your html file.
 
D

Dag Sunde

lrantisi said:
Dear friends.
I have an Applet in a java file. But the applet uses two other classes
inside the same .java file
When I compile that file, I get many .class files.
Now I want to put this applet on the web.
So I uploaded all the .class files that were generated from building
the original .java file.

Of course I have to put an HTML file, and inside the code of that HTML
file, I should indicate the required .class file of the Applet. But
what about the other .class file: They are already on the web, but the
browser will not know about them, it will know only about the .class
file of the Applet.

What is the solution to this problem, I tried an example and it didn't
work, and the problem , as I mentioned, is that the other .class
files are not mentioned inside the HTML file.
Is the Jar technology a solution, and how to do it.

What didn't work?

As long as you put the additional (generated) .class files in the same
directory as your html and main (applet) .class file it should work.

The only thing the browser need to know about is the .class file
containing the code for the applet. Then the Applet itself will look
for the rest of the files.

You can wrapp all of the class files in a jar, but it should make *no*
difference.

You have to tell us what went wrong. What error messages (in the java
Console).
 
A

Andrew Thompson

Dag Sunde wrote:
....
You have to tell us what went wrong. What error messages (in the java
Console).

...What URL (is the broken page on the internet)?

Andrew T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top