File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Can an applet call another class file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Can an applet call another class file?" Watch "Can an applet call another class file?" New topic
Author

Can an applet call another class file?

George Hutto
Greenhorn

Joined: Mar 12, 2003
Posts: 8
Okay, I'm new to a lot of this, so any help is appreciated.

I've written an applet that works just grand in the appletviewer.

In my apache 6.0.35 ROOT directory I've got the HTML file, the applet class and some supporting classes.

Here is my applet declaration:

<BODY>
<APPLET CODE="SterlingCC"
ARCHIVE="oc4j.jar,servlet.jar,servlet-api.jar,SterlingCC.jar"
CODEBASE="http://localhost:8080/"
HEIGHT="700" WIDTH="900" ALIGN="bottom">
This browser does not support Applets.
</APPLET>
</BODY>

Yes, I also have a jar file with the applet and supporting classes. Right now they are all right in the root directory.

The HTML screen comes up fine and shows the applet interface but when I click my submit button nothing seems to happen. I was wondering if there is some issue with an applet using other classes.

Also, is there a way to troubleshoot this? I don't get any errors showing up in Firefox so I was wondering if some log file might be generated that I can view.

Thanks,

George
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Yes, of course an applet can "call" other classes. (Note: Java programmers say that a class "uses" another class by "calling" methods from that class.)

If the applet code is throwing an exception (the most likely possibility) then you'll find the stack trace in the Java console. As for your APPLET element: it mostly looks okay to me, except of course I can't tell whether your relative URLs are correct; but I seriously doubt your applet is going to need anything from servlet.jar or servlet-api.jar. If it does, you must have misunderstood something.
George Hutto
Greenhorn

Joined: Mar 12, 2003
Posts: 8
Paul Clapham wrote:Yes, of course an applet can "call" other classes. (Note: Java programmers say that a class "uses" another class by "calling" methods from that class.)

If the applet code is throwing an exception (the most likely possibility) then you'll find the stack trace in the Java console. As for your APPLET element: it mostly looks okay to me, except of course I can't tell whether your relative URLs are correct; but I seriously doubt your applet is going to need anything from servlet.jar or servlet-api.jar. If it does, you must have misunderstood something.


Okay, still showing my newbishness. "Java Console" -- how does one access that? When I get an error in JDeveloper I can see it easily enough and I've been poking around in Firefox but seem to be missing something.

Ah Ha! I found Java Console ... now to figure out how to have it monitor my applet.
 
 
subject: Can an applet call another class file?
 
Similar Threads
Deploying my Japplet in Netbeans
Deploying applets in a web application
packages in applets
Class Not Found Error
Applet in tomcat