Results 1 to 2 of 2
  1. #1
    romina is offline Member
    Join Date
    Jul 2007
    Posts
    26
    Rep Power
    0

    Default My application Will Not Execute

    I then used 'javac' to convert that into a file named 'MyProgram.class'.
    MyProgram.java

    Java Code:
    public class MyProgram {
    
    public static void main(String[] args) {
    System.out.println(
    "Eureka, I can put Java on my resume.");
    }
    }
    I have an html that looks like this:

    Java Code:
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <applet width="300" height="300" src="MyProgram.class"></applet>
    </body>
    </html>
    Now I am quite new to java and i'm not sure but I think my software is ok so if i can get an explanation to why this only displays a little white piece of paper with a red 'X'.

  2. #2
    trill is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default

    Have a look at Java's own Applet tutorial, Lesson: Applets (The Java™ Tutorials > Deployment)

    Code snippets you'll want to look at:
    Java Code:
    <applet code=HelloWorld.class width="200" height="200"></applet>
    Java Code:
    import javax.swing.JApplet;
    import java.awt.Graphics;
    
    public class HelloWorld extends JApplet {
        public void paint(Graphics g) {
    	g.drawRect(0, 0, 
    		   getSize().width - 1,
    		   getSize().height - 1);
            g.drawString("Hello world!", 5, 15);
        }
    }
    Also Java's API is invaluable. Familiarize yourself with it and it will help you solve many problems very quickly. Java 2 Platform SE v1.3.1

    Java tutorial site: The Java™ Tutorials

    Usually when I need to find something Java related I head to Google, search: Java api 'whatever' and will find a related document in the api files.
    Example: for this thread a googled: Java api Applet and that tutorial was the first link.

    Greetings.

Similar Threads

  1. cannot execute EJB application.
    By JavaEmpires in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-17-2008, 10:53 AM
  2. Execute Jar file
    By barney in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 08:13 AM
  3. problems when I try to execute a jsp page
    By christina in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-01-2007, 01:23 PM
  4. why does not execute this?
    By aleplgr in forum New To Java
    Replies: 6
    Last Post: 08-01-2007, 12:37 PM
  5. Execute a new program in java
    By mathias in forum Advanced Java
    Replies: 1
    Last Post: 07-31-2007, 06:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •