Java programming applet issue newbie help

hello
i am a student taking an intro to OOP course using java. i have textMate and blue J as java editing environments. i have successfully managed a few lessons but now i am having trouble with applets. my applet source code will run in blue j but not in textmate and i think the reason has to do with the applet extension. first when i run the program successfully in blue jay it utilizes the sun.applet.main environment to display the applets output. but in textmate the identical code generates an error which i finally have a some information about why?
the error in textmate reads
:exception in thread "main" java.lang.NoSuchMethodError: main
i am not sure whether this has to do with the import java.awt.*: or just the public void paint(Graphics g) method (code Below)
the eventual intended output of the applet is to a web browser via an html document which calls the java applet but when i run this html document both firefox and safari display blank pages.
i am on macpro with the latest java version - just downloaded last week
is there some unique import statement to utilize import java.awt.*;
import java.applet.*; in mac os or ???
BTW the smile.gif is in the project folder with the java document
thanks for any help
Chapter 2: Welcome to My Day
Programmer: rafe McDonald
Date: November 5, 2009
Filename: WelcomeApplet
Purpose: This project displays a smile graphic, welcome message, the user's
name, and the system date in an applet.
import java.util.Date;
import java.awt.*;
import java.applet.*;
public class WelcomeApplet extends Applet
public void paint(Graphics g)
Date currentDate = new Date(); //Date constructor
g.drawString("Welcome to my day!",200,70);
g.drawString("Daily planner for Rafe McDonald",200,100);
g.drawString(currentDate.toString(),200,130);
Image smile; //declare an Image object
smile = getImage(getDocumentBase(), "smile.gif");
g.drawImage(smile,10,10,this);
setBackground(Color.cyan);
}

http://discussions.apple.com/thread.jspa?threadID=2226853&tstart=0
i realized the other section of this forum is geared toward java inquiries so if anyone has some ideas please post there
thanks

Similar Messages

  • Java program in XP - Please Help

    Hi, I am not sure if I am in the right fourm. I am not a developer, but a network engineer trying to help out my wife. My wife uses a java program to monitor the company she works for web site, which is not linked to a web browser. When she received the java program, it came with Java 1.2.2. Our PC had Windows 98 installed. I purchased a new machine, with Windows XP on it, and installed the java program and JRE on to it. The program does not work. The programmer who wrote the program was fired a few months ago, so I started looking through the internet, and the Sun fourms for a solution. First, the XP machine does not have Microsoft VM on it. Second, I upgraded the java to 1.4.1_02, following the instructions, still with no success. There was a suggestion to dual boot with Windows 98, but I really do not want to do that. What happens is - when you log in to the program, it just freezes. It does not go into the server. Any help is greatly appreciated.

    Possible reasons for the program hanging up
    1) The version of the VM on the machine is not correct.
    2) Even if the version is correct and correctly installed, can you please check whether the PATH and CLASSPATH variables are set correctly on the machine where you are running the program.
    3) I use WINXP as well with the latest version of VM downloaded from Sun and NOT Microsoft.
    Hopefully this might solve the issue.

  • Learning java programing - Array issues.

    Hi Everyone,
    I just started in java programming and into Arrays multidimensional. I started a simple 2 dimensional array with 5 names with genders. I 'm having issues because it does not want to print out the names with correct genders Male/ Female. The simple program should print out the 5 names with gender type.
    example:
    Jack - Male
    Sally - Female
    Dave - Male
    Sue - Female
    Brian - Male
    Here is what I came up with so far:
    public class Multiname
         public static void main(String[] args)
              //String[][] multiname;
              String [][] multiname =
                        {"Jack", "sally"},
                        {"Dave", "Brian"},
                        {"Sue"}
              /* multiname [0][0] = "Jack";
              multiname [0][1] = "Male";
              multiname [1][0] = "Sally";
              multiname [1][1] = "Female";
              multiname [2][0] = "Dave";
              multiname [2][1] = "Male";
              multiname [3][0] = "Sue";
              multiname [3][1] = "Female";
              multiname [4][0] = "Brain";
              multiname [4][1] = "Male";     
              //int rows = 2;
         //int columns = 2;
                   for(int i = 0; i < 4; i++)
                        {for(int j = 0; j < 2; j++)
                                System.out.println("multiname " + ": " + multiname [i][j]);               
    This is the result:
    multiname : Jack
    multiname : sally
    multiname : Dave
    multiname : Brian
    multiname : Sue
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
         at MultiD.main(MultiD.java:29)
    Can someone inform me what is wrong or missing, and what do I need to do to correct this. I'm new to this and I'm a visual person. Any assistance would be appreciated.
    Thanks,

    Welcome to the forum!
    When you post code use \ on the line before and on the line after the code to preserve formatting (read the FAQ). You can use the 'Preview' tab on the reply window to see what your reply will look like.
    Please edit your post and add the code tags.
    {quote}
    The simple program should print out the 5 names with gender
    {quote}
    How could it possibly do that when you commented out the lines the put the gender into the arrays?/* multiname [0][0] = "Jack";
    multiname [0][1] = "Male";
    multiname [1][0] = "Sally";
    multiname [1][1] = "Female";
    multiname [2][0] = "Dave";
    multiname [2][1] = "Male";
    multiname [3][0] = "Sue";
    multiname [3][1] = "Female";
    multiname [4][0] = "Brain";
    multiname [4][1] = "Male";
    When you are starting out don't use any more data than you need to get things working. You only need two name/gender combinations; any more just gets in the way.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • CALL A JAVA PROGRAM FROM ABAP -- NEED HELP

    Hi all,
    Can somebody tell me how to call a java xml code from an ABAP program? First let me know if at all, is it possible to call a java program from SAP that is from an ABAP executable progam?
    Please suggest me in this. All your inputs in this is valuable to me and highly appreciated.
    Thanks in advance,
    Vaishnavi Varadarajan

    Hi,
    Previous explanation i gave is not correct.
    ABAP web services expose the function modules outside R/3, so that other technologies like Java can consume that webservice and read the data in R/3 using the function module.
    For your requirement, create a Java web service to read the XML. Consume this webservice in ABAP. This way you can read the XML from ABAP.
    Regards
    Srikanth KV.

  • Displaying video file in a java program.. PLZ HELP!!!!!!

    hi, all..
    i am a just a student and i am new to java. im making an project/application where i must be able to play a video on it. can somebody pls tell me the command syntax in putting a video file in a program. can you pls provide a sample code and tell me what are the other necessary files that i need. pls help me!!! tnx a lot....

    It's not built into the jre base, so you might not get any very helpful answers here. However, what I'd do is go to google and search for something like "mpeg2 avi java"

  • I'm new in java program... ineed help

    i need to post a table to a web page from database using java..
    these are the parameters given by my boss.. pls help...
    SELECT DISTINCT PROD_GRP,
    NVL(SHIPPED,0) AS SHIPPED,
    NVL(NET_SCRAP,0) AS NET_SCRAP,
    ROUND(NVL(TOTAL_ASSY,0),2) AS TOTAL_ASSY,
    ROUND(NVL(TEST_YLD,0),2) AS TEST_YLD,
    ROUND(NVL("CONT%",0),2) AS CONT_PS,
    ROUND(NVL(ATY,0),2) AS ATY,
    NVL("$SHIPPED",0) AS DS_SHIPPED,
    NVL("$NET_SCRAP",0) AS SCRAP,
    NVL("TEST_$SCR",0) AS TEST_SCRAP,
    ROUND(NVL(CWATY,0),2) AS CWATY,
    NVL(LOT_BONUS,0) AS LOT_BONUS,
    NVL(LOT_SCRAP,0) AS LOT_SCRAP,
    NVL("TEST_$COST",0) AS test_dollar_cost,
    ROUND(NVL("TEST_COST%",0),2) AS test_cost_percent
    FROM prod_grp
    WHERE facility = 'CLARK-AT'
    AND run_date = 'D20100425'
    AND prod_grp in (select distinct prod_grp
    FROM device
    WHERE facility = 'CLARK-AT'
    AND MFG_GRP = 'QFN')
    AND EXCLUSION_ON ='Y'
    ORDER BY PROD_GRP ASC
    ** font in bold blue means dynamic
    Connection string:
    # Cwaty Clark
    db.connectString.Cwatydb=jdbc:oracle:thin:cwatyclk/[email protected]:1521:cwatydb
    db.driverString.Cwatydb=oracle.jdbc.driver.OracleDriver
    db.minConnections.Cwatydb=0
    db.maxConnections.Cwatydb=16
    db.testQuery.Cwatydb=SELECT * FROM dual
    db.conURL.Cwatydb=jdbc:oracle:thin:@smsdwsp3.itg.ti.com:1521:cwatydb
    db.host.Cwatydb=smsdwsp3.itg.ti.com
    db.sid.Cwatydb=cwatydb
    db.usr.Cwatydb=cwatyclk
    db.pwd.Cwatydb=reserved
    db.dbName.Cwatydb=cwatydb
    thanks alot..

    These aren't parameters. Youve got a SQL SELECT statement and a snippet of Java code to connect with the oracle database.
    What you need to do is to create a PreparedStatement and read the ResultSet. But franckly, if you don't know anything about this, i would go for a little help from my colleaques.
    Edited by: hsc71 on 6-mei-2010 9:38
    Edited by: hsc71 on 6-mei-2010 9:39

  • My first Java program does;'t work HELP

    I received the following message in the Command Prompt:Exception in thread "main" java.land.NoClassDefFoundError: Test
    How do I fix this?
    Source Code:
    import java.awt.MediaTracker;
    class Test {
    public static void main(String[] args) {
    for (int i = 0; i < args.length; i++)
    System.out.print(i == 0 ? args[i] : " " + args);
    System.out.println();

    You might want to make your class public, although I don't think that's supposed to be necessary. It's most likely a classpath issue.
    Instead of java Test, try java -cp . Test (Note the dot between -cp and Test.)
    Javapedia: Classpath
    How Classes are Found
    Setting the class path (Windows)
    Setting the class path (Solaris/Linux)
    Understanding the Java ClassLoader
    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

  • Trying to run Java programs I wrote, need help~

    I wrote some very simple programs for image viewing with flickrj and other external libraries. But I don't know what would I do to make it run on other people's computers ( only with JRE installed, I can run it only because I have eclipse, can't even get it to work under windows command prompt). I have tried exe4j trial version, but it was really a mess. Please give me some advices~~~
    Thank you very much~

    Thx so much, i got it to work...is it possible for me
    to export it to a .jar file? and just double click it
    will run?Yes. Consult the Java Tutorial on using jars, and especially learn about the attribute "Main-Class" in manifest files. I also suggest you read the jar documentation here:
    http://java.sun.com/j2se/1.5.0/docs/guide/jar/index.html
    and how do you suppress all console output?
    TIAEither don't create it, or redirect it. Some operating systems provide a null device that can be used as a destination that acts as a data sink that will "eat" the data.
    See the setOut and setErr methods in java.lang.System class.

  • Help for writing to excel file from Java Program

    Hi,
    I am new to Java and Java API. I need to write to some specific cells of an excel file from a Java Program. Please anyone help me or give some directions.
    Thanks,
    Reet

    Hi,
    I saw an example while searching in google about importing jxl.*. Could you direct me how I can import this package as java does not have it. I heard that jxl is much easier that POI although I am not new to both of them.
    Thanks,
    Priya

  • Not able to run a java program on Sun Solaris

    Hi All,
    I am getting following error while running a java program. Can you help.
    Thanks,
    --Srini
    Error:
    Exception in thread "main" java.lang.NoClassDefFound

    Hi Sergi,
    Thanks for the info. I couldn't able to login because of my internet connection.
    Thanks,
    --Srini                                                                                                                                                                                                                           

  • Call Java Program from ABAP Program

    Dear all,
    In our scenario, we need to let ABAP call services provided by a standalone Java program. From online help I found some overview introduction and I'd make the called program a registered program in a RFC with type "T" (TCP/IP Connection). Can anybody give some concrete documentation? A step-by-step guide would be greatly appreciated.
    Best Regards
    Jerome

    check this thread
    Re: Calling Java API from ABAP using JCo

  • How to find Free disk space using Java program ?

    Hi friends,
    I need to find out the Free Hard disk Space to alert the user and send them mail if hard drive is about 85% full.
    i am developing databackup program in which i have to check it , if hard drive is fulled with 85% or remain left space is less email sent to user to notify and delete older backups.
    give me solution using java program...
    please
    Help me i need it in recent...

    Hi friends,
    I need to find out the Free Hard disk Space to alert
    the user and send them mail if hard drive is about
    85% full.
    i am developing databackup program in which i have to
    check it , if hard drive is fulled with 85% or remain
    left space is less email sent to user to notify and
    delete older backups.
    give me solution using java program...
    please
    Help me i need it in recent...

  • Executing a .bat/java program every 5 minutes

    Hi,
    I have a java program. I need to run that code every 5 minutes from another java program. could anyone please help me on doing this?
    Thanks!

    while(some condition){
        System.exec(your bat / program)
        Thread.sleep(1000*60*5);
    }

  • How to run a standalone java program with JRC to display/run a report

    Hi All,
    I am new to this forum.
    I am trying to run a java program developed using JRC to run a report created using Crystal Report XI. I stucked because not knowing how to run that java program.
    Can anyone help me? or
    can give a simple java code to do the same.
    Thanks in advance.
    Saravanakumar.

    Hi Saravana
    For the steps to run a standalone application java program with JRC to display/run a report ,please refer the following link.
    http://support.businessobjects.com/communityCS/TechnicalPapers/cr_xi_r2_jrc_deployment.pdf.asp
    You can get the sample code for standalone/desktop applications from the following link.
    http://support.businessobjects.com/communityCS/FilesAndUpdates/crxi_r2_jrc_desktop_samples.zip.asp
    Please do revert in case of any queries.
    Thanks
    Soni

  • I did write a simple java program but it is not working please help me.....

    This is the program I wrote LineRect just to draw a line a rectangle etc...... Y it is not working How can i used the same program to run without using applet that is by using awt and swing.........Pls Help me.............
    import java.awt.*;
    import java.io.*;
    public class LineRect
    {public void paint(Graphics g)
         {g.drawLine(10,10, 50,50);
         g.drawRect(10, 60, 40,30);
         g.fillRect(60,10,30,80);
         g.drawRoundRect(10,100,80,50,10,10);
         g.fillRoundRect(20,110,60,30,5,5);
         g.drawLine(100,10,230,140);
         g.drawLine(100,140,230,10);
    <APPLET
    CODE =LineRect.class
    WIDTH=250
    HEIGHT=200>
    </APPLET>

    There are many significant errors here for instance you are using a class file as if it were an applet yet you do not subclass applet. Your code has no init method (if it is to be an applet). Your best bet is to go through the tutorials one step at a time. One thing to consider is to subclass a JPanel and draw on the jpanel overriding the paintComponent method. This can then be added to a JFrame or a JApplet's contentPane and would allow the same graphics in both. But again, please study the tutorials on all of this, otherwise you will be doing hit-or-miss programming, and that is no way to learn.
    Much luck!
    Addendum: Also, if you are just beginning in Java programming, I suggest you start with the basics and not with Swing / AWT / graphics programming. Otherwise you will just end up bruised and disappointed. You have to learn to walk before you can run.
    Edited by: Encephalopathic on Dec 26, 2007 5:09 AM

Maybe you are looking for

  • Problem with KT4 and 200Gb Drive or is it?

     :( Help! Hi, I just got this board KT4 Ultra and am having a problem, not sure what it's related to though The MB picks up the new drive I bought (Maxtor IDE ATA-133 200Gb 7200RPM 8Mb Cache DiamondMax Plus9) fine no problem, but when I come to insta

  • Error while executing  operation mapping

    Hi All, I am getting  the below the error , while executing the Operation mapping, whereas the same payload working fine with message mapping. Please suggest.

  • How to retain the data in global variable.

    Hi all, i have one login view, when one user logs into it and press enter, then user name get displayed in table. but, when other user login, then that previous user name get flushed off. what i want is to display all the previously logged in users t

  • What is change pointer in ALE ?

    Dear Guru, 1. What is change pointer in ALE and how to configure it ?        The process of configure please guide me ! Tanks and Regards, Subash.

  • Modificacion Query

    Estimados, Tengo este query, /* SELECT FROM OINM T0 INNER JOIN OITM T1 ON T0.ITEMCODE=T1.ITEMCODE  INNER JOIN OWHS T2 ON T0.WAREHOUSE=T2.WHSCODE*/ DECLARE @bodega nvarchar(100), @Fec_Ini datetime, @Fec_ter datetime, @Grupo_ini nvarchar(30),@Grupo_ter