Failing to get java programs with more than one class to run [message #761140] |
Mon, 05 December 2011 19:43  |
Eclipse User |
|
|
|
Hi all,
I have been 4 days trying to get this to work without success. If I make one class and run it. It works in eclipse and I can get it to work in a browser.
Make a package and add 2 classes it works in eclipse, but gives me errors in the browser.
load: class IGgames.Picture.class not found.
java.lang.ClassNotFoundException: IGgames.Picture.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: IGgames.Picture.class
Any help would be appreciated, as I feel like throwing my computer out of the window.
I am using this code in the html to run it.
<html>
<body>
<applet code=IGgames.Picture.class width="200" height="200" >
</applet>
</body>
</html>
Although I have tried various incarnations of this. ie I have just put Picture.class on it's own and various other stuff too.
Thomas
|
|
|
|
|
|
|
Re: Failing to get java programs with more than one class to run [message #761724 is a reply to message #761690] |
Tue, 06 December 2011 19:04  |
Eclipse User |
|
|
|
On 06-Dec-11 15:19, Thomas Williams wrote:
> Hi Russell,
>
> You are some kind of super human genius.
>
> After 4 days of pulling my hair out you solve my problem.
>
> I didn't think renaming the class in the refactor menu, and then doing
> clean would work, but it did. Except when I do that it deletes
> everything in the bin folder which is inconvenient, as my jpg was in
> there I was trying to get to view. Perhaps I should keep jpegs out of
> the bin folder, and link to them.
>
> [snip]
Genius? No, I just happened to answer your question first. Any other
responder in this forum would have pointed out the same thing.
Yup, never put anything in the bin subdirectory of a Java project (or,
in the case of a Dynamic Web Application project, the build
subdirectory). Reserve it for Eclipse to put compiled class files into.
Your .jpg and other resources should go under the src directory in the
package that consumes them or, perhaps, under src/resource to suite your
tastes. There's a whole science to this (and it hasn't much to do with
Eclipse although we think sometimes that it does since IDE often appears
to equal language). I'd suggest Googling around, but you could start here:
http://stackoverflow.com/questions/270197/java-in-eclipse-where-do-i-put-files-on-the-filesystem-that-i-want-to-load-usin
It's easy to get confused with this stuff. The best forums for such
questions (since this isn't an Eclipse question) are stackoverflow and
javaranch.
Best of luck my friend,
Russ
|
|
|
Powered by
FUDForum. Page generated in 0.09812 seconds