Link to home
Start Free TrialLog in
Avatar of mayhem4
mayhem4

asked on

Applet using my .class file

Okay I created a class which is a standalone program which downloads and parses a file for certain items.

Downloader d = new Downloader();
d.download();
d.getdata();
d.gettime()

Are some of the functions it has. I made a separate standalone program to test it and that works fine. I tried creating an applet which uses an instance of the standalone class file but its reporting notinited. I assume this is because I can't call a standalone app? If anyone has a workaround to being able to use my own class inside an applet. OR downloading a URL from within an Applet (to either a local file or a vector of strings). Either answer solves this problem.. OR how I can use the .class successfully thru a javascript (.js) page (haven't had ANY luck with this). Thanks
Avatar of girionis
girionis
Flag of Greece image

 You shouldn't have problems instantiatign a standalone class from applet. What exactly is the problem? Do you have the standalone class in the same folder with applet or in the same jar file?
The file that the application parses would have to be in the applet's codebase and should be accessed without instantiating File.
Avatar of mayhem4
mayhem4

ASKER

Quote:The file that the application parses would have to be in the applet's codebase and should be accessed without instantiating File.

Can you elaborate a little? They are both in the same folder ... I haven't made them a jar file, and would prefer not to.
>>They are both in the same folder

OK. How are you going to get the file into the application for parsing?
Avatar of mayhem4

ASKER

Could the problem be I never used classloader in my applet :\ Looking into that now :(
No reason to use a classloader particularly.
Avatar of mayhem4

ASKER

If you could throw up a sample .class and an applet which uses the functions and creates a type of that classtype, I could most likely figure the rest out. I'd accept any answer that teaches me how to create a variable of my classtype. :)
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And what about the

>>d.getdata();


stuff?
 It's just some sample code to show how to create an instance from within an applet.
No, my remark is really addressed to mayhem4, as that area of the program is potentially problematic in an applet.
 I think he would help us more if he could tell us the exact error message. Applet not initialized is a generic error that can be caused by dseveral factors.

  Mayhem4 what does the java console say when it fails to initalize the applet?
Avatar of mayhem4

ASKER

Well I've given up on the script but heres the points and a good grade for tryin. :P