This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Applets and the fly likes How to access an applet from a folder inside a jar file -- Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How to access an applet from a folder inside a jar file -- Urgent" Watch "How to access an applet from a folder inside a jar file -- Urgent" New topic
Author

How to access an applet from a folder inside a jar file -- Urgent

Paromitabanerjee Banerjee
Greenhorn

Joined: Mar 10, 2006
Posts: 1
Hi,

I have an applet -- 'checking' placed inside a folder called 'customer'.

And have placed the customer folder inside the jar file.

Both my check.html and the checking.jar are in the same location.

I am using the following in my applet tag but it doesn't work :

<APPLET CODE="customer.checking.class" codebase="." WIDTH=150 HEIGHT=150

archive="checking.jar"></APPLET>

I need the same to work through an application. Any help will be highly appreciated.

Thanks,
Paromita
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Originally posted by Paromitabanerjee Banerjee:

<APPLET CODE="customer.checking.class" codebase="." WIDTH=150 HEIGHT=150

archive="checking.jar"></APPLET>


Welcome to JavaRanch Paromita!

Check the seocnd example in this link.


My blood is tested +ve for Java.
paromitabanerjee mukerjibanerjee
Greenhorn

Joined: Dec 20, 2004
Posts: 23
hi,

Thanks for the help. But I know how to use a codebase.

I have tried giving different paths but the browser is unable to pick up the Applet.class which is inside a folder called customer in the jar file
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Paromita, post package structure of your applet and <applet>.

I guess it is just a matter of giving proper package information in <applet>.
paromitabanerjee mukerjibanerjee
Greenhorn

Joined: Dec 20, 2004
Posts: 23
Hi,

The Checking.class is ina folder called 'Customer' inside the jar file.

The jar file and the html file are in the same location(i.e. same folder)

And the code for applet inside the html is :

<applet code="customer.checking" width="140" height="230" archive="check.jar"></applet>

While running the code, I am guessing its not able to find the jar file. Since the error that comes is 'ClassNotFoundError'.

There maybe some additional parameters that I should supply but I am not sure what....

Can anyone help ???

Thanks in advance.

Paromita
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Chetan is asking you if the class is in a package named "customer", or if you've just placed in in a folder by that name. If it's the latter, I don't think there's any way to make it work. Either put the class into the "customer" package with a package statement, or put the checking applet at the top level of the jar file.


[Jess in Action][AskingGoodQuestions]
paromitabanerjee mukerjibanerjee
Greenhorn

Joined: Dec 20, 2004
Posts: 23
The checking.class has a package statement -- called Customer.

But the jar is unable to find the class.

thanks,
Paromita
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

OK. You've been going back and forth between "customer" and "Customer" and "checking" and "Checking". Although Windows doesn't care about the capitalization of file and directory names, Java classes and packages are case-sensitive, and the "applet" tag has to match what you used in the Java source file, exactly. Does that help?
paromitabanerjee mukerjibanerjee
Greenhorn

Joined: Dec 20, 2004
Posts: 23
my mistake....

I have used all the names in lower case in my class and html file.

but while typing here Capital Letter has come in.

sorry about that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access an applet from a folder inside a jar file -- Urgent