Many class files resulting from one Java file.

Discussion in 'Java' started by lrantisi, Nov 27, 2006.

  1. lrantisi

    lrantisi Guest

    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.
    lrantisi, Nov 27, 2006
    #1
    1. Advertising

  2. "lrantisi" <> wrote in message
    news:...
    > 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.
    Mike Schilling, Nov 27, 2006
    #2
    1. Advertising

  3. lrantisi

    Dag Sunde Guest

    lrantisi wrote:
    > 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).

    --
    Dag.
    Dag Sunde, Nov 27, 2006
    #3
  4. 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.
    Andrew Thompson, Nov 27, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dee
    Replies:
    2
    Views:
    389
  2. Replies:
    3
    Views:
    308
  3. Nomen Nescio
    Replies:
    12
    Views:
    532
    dontspamleo
    Feb 28, 2010
  4. jason
    Replies:
    6
    Views:
    155
  5. Evolution
    Replies:
    1
    Views:
    99
    Evolution
    Apr 15, 2011
Loading...

Share This Page