Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Failing to get java programs with more than one class to run(Mozilla or IE problem)
Failing to get java programs with more than one class to run [message #761140] Mon, 05 December 2011 19:43 Go to next message
Thomas Williams is currently offline Thomas Williams
Messages: 3
Registered: December 2011
Junior Member
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 #761464 is a reply to message #761140] Tue, 06 December 2011 09:03 Go to previous messageGo to next message
Patrick is currently offline Patrick
Messages: 55
Registered: July 2009
Member
Le 06/12/2011 01:43, Thomas Williams a écrit :
> java.lang.ClassNotFoundException: IGgames.Picture.class

Hi,
What is IGgames? a package name? Should not it be in lower case?
Re: Failing to get java programs with more than one class to run [message #761611 is a reply to message #761464] Tue, 06 December 2011 13:36 Go to previous messageGo to next message
Thomas Williams is currently offline Thomas Williams
Messages: 3
Registered: December 2011
Junior Member
Hi,

Well it is kinda in upper and lower case. Very Happy

Do package names have to be in all upper or lower case then?

regards
Thomas
Re: Failing to get java programs with more than one class to run [message #761636 is a reply to message #761611] Tue, 06 December 2011 14:25 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3146
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 06-Dec-11 11:36, Thomas Williams wrote:
> Hi,
>
> Well it is kinda in upper and lower case. :d
>
> Do package names have to be in all upper or lower case then?
>
> regards
> Thomas

Yes, package names are always lower case with no underscores. Although,
no, they do not have to be to work. Class names are camel-back case.
Etc. There are specific practices defined for all this in Java.
Re: Failing to get java programs with more than one class to run [message #761690 is a reply to message #761636] Tue, 06 December 2011 17:19 Go to previous messageGo to next message
Thomas Williams is currently offline Thomas Williams
Messages: 3
Registered: December 2011
Junior Member
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.

I did have a link here, but it wouldn't let me post a link grrr.

Ok it doesn't do a lot but show a picture and put some text over it, but it is my second java program. The first being 'Hello World' LOL.

I have written in C++ and java seems pretty close to this.

Anyway thanks a lot.

I am thinking of porting one of my programs over from C++ and SDL to java. Just got to learn how sprites work with the double buffering and stuff first.

regards
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 Go to previous message
Russell Bateman is currently offline Russell Bateman
Messages: 3146
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

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
Previous Topic:Diagnosing OOM errors
Next Topic:Eclipse (3.7) indigo no repository found errors
Goto Forum:
  


Current Time: Wed Aug 20 12:41:19 EDT 2014

Powered by FUDForum. Page generated in 0.02871 seconds