Results 1 to 15 of 15
Thread: Class Wasn't Found in Project
- 05-02-2012, 01:58 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 20
- Rep Power
- 0
Class Wasn't Found in Project
Here is my code:
Any ideas?Java Code:/* * <applet code="ImageViewer" width=200 height=200> * <param name="img" value="Snow.jpg"> * </applet> */ import java.awt.*; import java.applet.*; public class ImageViewer extends Applet { Image img; public void init() { img = getImage(getDocumentBase(), getParameter("img")); } public void paint(Graphics g) { g.drawImage(img, 0, 0, this); } }
- 05-02-2012, 02:59 PM #2
Re: <No main class found>
I've moved this to the Applets forum, as it appears you're trying to run an applet.
How are you trying to run it? What's the actual error message you receive?How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-02-2012, 03:06 PM #3
Member
- Join Date
- Mar 2012
- Posts
- 20
- Rep Power
- 0
Re: <No main class found>
I'm basically trying to display an image. I'm using a code from a Java book. I'm using Netbeanz.
I run the code and I get
Image Viewer class wasn't found in ImageViewer project
Select the main class:
<No main classes found>
- 05-02-2012, 03:11 PM #4
Re: <No main class found>
Does it actually say Image Viewer, with a space?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-02-2012, 03:14 PM #5
Member
- Join Date
- Mar 2012
- Posts
- 20
- Rep Power
- 0
Re: <No main class found>
No, sorry
It says: ImageViewer class wasn't found in ImageViewer project
- 05-02-2012, 03:28 PM #6
Re: <No main class found>
Then I suppose this is actually a netbeans question, so I'll move the thread again. I suggest googling something like "netbeans class wasn't found in project". Better yet, ditch your IDE altogether and just compile by the command prompt until you're more familiar with the basics.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-02-2012, 03:49 PM #7
Member
- Join Date
- Mar 2012
- Posts
- 20
- Rep Power
- 0
Re: Class Wasn't Found in Project
I'm not too familiar with using the command.
- 05-02-2012, 03:51 PM #8
Re: Class Wasn't Found in Project
Now's your chance to become acquainted: "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-02-2012, 04:04 PM #9
Member
- Join Date
- Mar 2012
- Posts
- 20
- Rep Power
- 0
Re: Class Wasn't Found in Project
Right, I've done that tutorial. So should I try and code I posted before and do that with the command?
- 05-02-2012, 04:23 PM #10
Re: Class Wasn't Found in Project
It's up to you. I don't know anything about netbeans, so I've given you several options. You can wait here for somebody to get back to you. You can google the error for more info. Or you could take netbeans out of the equation and compile your classes directly, which is probably what you should be doing anyway, IMHO. Up to you though.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-02-2012, 04:30 PM #11
Member
- Join Date
- Mar 2012
- Posts
- 20
- Rep Power
- 0
Re: Class Wasn't Found in Project
I'll give it a try. In the mean time I'll see anyone else has another suggestion
- 05-02-2012, 05:00 PM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: Class Wasn't Found in Project
You can't run the code directly.
I can't remember, but does Netbeans have an applet viewer built in?Please do not ask for code as refusal often offends.
- 05-02-2012, 07:06 PM #13
Re: Class Wasn't Found in Project
NetBeans runs an Applet class in the AppletViewer that comes with the JDK. But not by selecting 'Run' for the project.
I was going to post a step-by-step of the three ways to run an Applet in NetBeans, but I found that it's more than adequately documented in the online help, so there was no valid reason for this to be asked on a forum.
Ever tried pressing F1?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 05-03-2012, 09:42 AM #14
Member
- Join Date
- Mar 2012
- Posts
- 20
- Rep Power
- 0
Re: Class Wasn't Found in Project
I've press F1, what am I looking for in here?
- 05-03-2012, 10:35 AM #15
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Similar Threads
-
JDBC class not found when calling a java class in a java project from my JSP in a web
By Mark1234 in forum New To JavaReplies: 6Last Post: 03-01-2012, 03:07 PM -
Class not found exception for the servlet class.
By mazem in forum Java ServletReplies: 2Last Post: 08-24-2011, 09:20 AM -
class not found
By meong in forum JDBCReplies: 7Last Post: 09-22-2010, 11:25 AM -
JUnit - Test class not found in selected project
By cka in forum New To JavaReplies: 11Last Post: 07-27-2010, 04:08 PM -
Class Not found
By jitendra in forum AWT / SwingReplies: 5Last Post: 02-26-2010, 10:55 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks