aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "applet " Watch "applet " New topic
Author

applet

sunanda kadam
Ranch Hand

Joined: Feb 26, 2008
Posts: 42
package myPackage;
import java.applet.*;
import java.awt.*;



public class MyApplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("sunanda", 100 ,100);
}



}


i am getting error as nullpointerException
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
Please post more details, particularly which line your Exception occrus on.
sunanda kadam
Ranch Hand

Joined: Feb 26, 2008
Posts: 42
Exception in thread "main" java.lang.NullPointerException
at java.awt.Window.init(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at sun.applet.AppletViewer.<init>(Unknown Source)
at sun.applet.StdAppletViewerFactory.createAppletViewer(Unknown Source)
at sun.applet.AppletViewer.parse(Unknown Source)
at sun.applet.AppletViewer.parse(Unknown Source)
at sun.applet.Main.run(Unknown Source)
at sun.applet.Main.main(Unknown Source)
at sun.applet.AppletViewer.main(Unknown Source)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
Doesn't it give line numbers on your stack trace? Is that all the code you have? Nothing else?

You are supposed to write super.paint(g); before anything else in the paint() method, but I don't think that is the cause of your problem.
sunanda kadam
Ranch Hand

Joined: Feb 26, 2008
Posts: 42
i am buginner in java.
was trying to execute simple code in eclipse .
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
How did you start the application? Did you use "run as"->"Java Applet?" It works all right when I try it on Eclipse.
sunanda kadam
Ranch Hand

Joined: Feb 26, 2008
Posts: 42
yes i started as java applet
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
Is that the whole code? When I tried it on Eclipse it ran first time.
sunanda kadam
Ranch Hand

Joined: Feb 26, 2008
Posts: 42
sorry to ask you this agian campbell .......

this is the code i am executing
sunanda kadam
Ranch Hand

Joined: Feb 26, 2008
Posts: 42
starting!
Invalid Menu Extension (Path is invalid): org.objectweb.lomboz.ws.axis.ui.action
s.wsdl2java




This is what i am getting on dos shell
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
Have you tried running it elsewhere?

Go through the Java Tutorials.

You find you have to create an html file which will read something like this, in its simplest form:
<html>
<applet code = "myPackage.MyApplet.class" width = "300" height = "150">
</applet>
</html>
Call that file MyApplet.html and save it a folder. Copy your MyApplet class into the same folder. Run it from the command line with these commands
javac -d . myApplet.java
appletviewer MyApplet.html


I have just tried it and got a grey square with "sunanda" written on.

BTW: In future use the javax.swing.JApplet class rather than Applet.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
You have a problem with your Eclipse installation; I am going to shift this thread to what I think is the most appropriate forum. Click on the links above and below this thread to continue.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
Suggest you reinstall Eclipse as a first step. In fact I have neveer installed Eclipse on Windows myself; I simply unzip the installation into a folder, then create a shortcut from desktop to the eclipse.exe program, which you will find in the eclipse folder with the round blue icon.
sunanda kadam
Ranch Hand

Joined: Feb 26, 2008
Posts: 42
applications are running properly but not the aaplets.
ther might be spme extra settings required for applets to run in eclipse
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
You shouldn't need any extra settings to run applets from Eclipse. Suggest you download it again. Got to go now, but shall check later to see how you have got on.
No idea what the bit about org.objectweb means; it is presumably a required class somewhere, but I have never heard of it. If you get really desperate, reinstall Java and check your PATH.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: applet