My first program

i get this error when i try to run the program below got it from a javabook by sybex
Exception in thread "main" java.lang.NoSuchMethodError: main
import java.awt.Graphics;
public class hello extends java.applet.Applet
public void paint(Graphics g)
g.drawString("Hello from Java!", 60, 30 );
}

You should find an updated book. Most books don't teach Java with applets these days. Also most books don't teach the AWT.
This is a link to the sun java tutorials. http://java.sun.com/docs/books/tutorial/
It's free and easy to start.
Most people agree that Head First Java is a better than average book for a beginning programmer. You may want to start there, if the tutorials aren't working for you.
Brushfire,

Similar Messages

  • I created my first program-compiling error-help please

    hey there
    i just wanted my first program in java and here it is below with the eroor when i'm compiling it, i cant understand whats wrong:
    public class SquareArea {
         public static void main(String[] args); {
         float length;
         float width;
         float SquareArea;
         System.out.println ("Please enter length"+ length);
         System.out.println ("Please enter width"+ width);
         SquareArea= length*width;
         System.out.println ("The area of the square is" + SquareArea);
    The error is:C:\Documents and Settings\User\Desktop\SquareArea.java:5: missing method body, or declare abstract
         public static void main(String[] args); {
    ^
    1 error
    Tool completed with exit code 1

    There shouldn't be a semicolon between the ")" and the "{" near the end of that line.
    With that semicolon, you're basically defining an empty, zero-size main method, and then throwing a bunch of garbage after it. That's what the compiler thinks anyway. Remove that semicolon and it should compile OK.
    But it won't work super well, because you're not actually getting any input for length and width. It's just going to output this:
    Please enter length0
    Please enter width0
    The area of the square is0

  • Problem compiling my first program; Please Help me!

    Please HELP, what am I doing wrong?
    For over 5hours I have been trying to figure out how to compile a simple Hello world program using sdk1.3.1_02/j2re1.3.1_02 and I am getting the following errors: helloworld.java:2 cannot resolve symbol
    symbol : class string
    location : class helloworld
    cannot reolve the string symbol
    symbol : class out
    location : package system
    I want to program in java so badly but I am trying to get my environment set so that I can take off. To compile my first program has been a disaster!!
    This is my path:
    SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK1.3.1_02\BIN
    Thanks very much in advance
    ::(

    Java is case sensitive,
    use String instead of string. and System.out instead of system.out
    Sudha

  • How to execute the first program without using SUBMIT and RETURN

    Hi Experts,
    My requirement is , I need to select thet value from VA02 at runtime and need to pass that value to VF01 transaction and press save then it creates proforma document.The created document we can see in VA02 by clicking on document flow.
    My program is processed through OUTPUT TYPE.
    To get this functionality i written coding like this.
    1) i am selecting the value at runtime from VA02  using FORM ROUTINE.Now iam passing this selected value to VF01 for
    genarate proforma document using BDC.Here the problem is,first time when i am selecting the value form VA02 at runtime it is in open status,now my BDC code need to update the value in VA02 only.so locking problem occurres  the document is not getting updated.
    To overcome this problem i have done changes like this......
    2) i splited my program into two parts, that  is into two programs.
    a) In first program i am only selecting the value form VA02 at runtime using FORM ROUTINE and in this program i have written SUBMIT statement to call another program there my BDC  code will create documet and update in VA02,upto here everything is doing fine,
         But here again the problem is when i process OUTPUT type my program is triggering and giving correct result but the status is not changing form YELLOW to GREEN.Why means when SUBMIT statement trigger, control is going to second program and creating a new document,but not coming to first program so the status is not changing as the first prohram is still processing. .If i write RETURN along with SUBMIT the VA02 is in open STATUS only, till control comes to first program.so it will not uodate document in VA02.
    If i execute all line in my program status will automatically change from YELLOW to GREEN how to acheive this
    please suggest me the solution.

    I would do 2 things:
    1) be sure to do a COMMIT WORK AND WAIT
    2) refresh your display in calling program
    the point 2) can be done by submitting the program again (or the transaction) with the same parameters

  • My first program to create a crystal report from java... Help needed...

    Hi... I am writing a java program that fetches a table from database and creates a Crystal Report from that table(ResultSet object)... Optionally exporting the report as a pdf also...  This will be a console application since it is my first program using crystal reports.... Any one can help me with this...?

    Hi Karthik,
    you could have a look over these developer guides below for understanding of Java sdk :-
    [http://www.sdn.sap.com/irj/boc/sdklibrary|http://www.sdn.sap.com/irj/boc/sdklibrary]
    you could also find  below sample codes for creating reports using Java sdk (RAS sdk) :-
    [http://www.sdn.sap.com/irj/boc/samples|http://www.sdn.sap.com/irj/boc/samples]
    let me know if you need any help,
    Regards,
    Rameez.

  • How to find First Program run in the Current Month in Foreground?

    Dear Experts,
    My requirement is that i need to find the First Program run date in the Current Month in foreground. The user must be allowed to run the Report only once for a month and if the next time he runs in the same month, it should not allow him to do so.
    Is there any Function Modules available? How to achieve this?
    Regards,
    Ramesh Manoharan

    Hello Ramesh,
    May be you can try with this code:
    INITIALIZATION.
      DATA:
      v_date TYPE datum,
      wa_indx TYPE indx.
    * Import the date to INDX table
      IMPORT date = v_date
        FROM DATABASE indx(xy)
        TO   wa_indx
        CLIENT sy-mandt
        ID 'DATE'.
      IF v_date IS NOT INITIAL.
        IF v_date+0(6) = sy-datum+0(6). "Check YYYYMM is same
          "Give your error message & exit
        ELSE.
          v_date = sy-datum.
    *     Export the date to INDX table
          EXPORT date = v_date
            TO DATABASE indx(xy)
            FROM   wa_indx
            CLIENT sy-mandt
            ID 'DATE'.
        ENDIF.
      ELSE.
        v_date = sy-datum.
    *   Export the date to INDX table
        EXPORT date = v_date
          TO DATABASE indx(xy)
          FROM   wa_indx
          CLIENT sy-mandt
          ID 'DATE'.
      ENDIF.
    Hope this is of some help.
    BR,
    Suhas

  • Writing my first program....

    Okay my first programming assignment is to write a program that requests an amount of money and will then calculate how many quarters, dimes, nickels and pennies it takes to get that number. I do wanna figure this out by myself, but since im new to JAVA i was wondering if anyone could give me some ideas and/or hints as to maybe where a good place to start is.....

    A good way to start is for you to do what the program needs to do, and write down the steps involved.
    Assume you start with $1.01
    What would you do first?
    next?
    and so on.
    Each statement should consist on only one action.
    By the time you finish, you've pretty well outlined what the program needs to do.
    Then you can start figuring out wha program instructions are needed.

  • My first program in Java

    After I compile my first application using javac Welcome1.java
    when I try to run the pplication using java Welcome1
    I get this message
    Exception in thread "main" java.lang.NoClassDefFoundError: Welcome1
    Please if somebody can help me:
    This is my source code:
    // Fig. 2.1 Welcome1.java
    // A first program in Java.
         public class Welcome1 {
         // main method begins execution of Java application
         public static void main ( String args[] )
              System.out.println( "Welcome to Java Programming!" );
         } // end method main
    }     // end class Welcome1
    Thank you

    Try this
    go to c:\edit autoexec.bat
    type these lines
    set path=c:\j2sdk1.4.0\bin; // check the java folder name in c:\
    set classpath=c:\%classpath%;.;
    save and close DOS
    restart PC,
    now try the example
    Hope it helps
    Uma
    http://www.javagalaxy.com

  • My First Program, Seeking Advice

    Hello all!
    This is my first program attempt with Visual Studio 2013 Express and I don't have hardly any experience in programming to begin with...so bare with me. I have this idea for a Digital Communications Board. You know like the ones that are make of cork board
    that have a million things attached to it and its all over the place? Ya that mess. I have several ideas for this concept which, if given enough help, I will go into later. But basically, I want to be able to have a program or app that lets you assign categories
    for certain things that can be displayed in a work setting. Categories like Schedule, Announcements, and other things that you would want to add as you think of them. so I imagine this board starting out with a few that can be edited. 
    The main aspect of this program is to be able to upload any screenshot or picture or pdf file that is available and present it in a fashion that is organized. So if we just focus on the Schedule tab that I mentioned already I can probably explain it better.
    The way I will personally use this is to display employee schedules through the addition of a picture or file taken from my company's system (not a data retrieval, just simple manual entry). Later down the road I will attempt to make it so that the Schedule's
    for each employee can be entered manually so that there are simple layouts and no excess material to fill up the space. 
    So with this idea in mind what would be my first steps? I know I need the following things:
    1. I want to be able to have a minimum of 3 tabs displaying the name of the display that would come from it. for example, If i click the button/tab that says "Schedule" then that tab would expand or present the content that IS the schedule for
    the employee's or what has been set by the user to be displayed there.
    2. I want to be able to expand the number of tabs with ease. Like a typical "+" button that would obviously add another tab that can be set up for another purpose while at the same time it is formatted to space itself on the main page with
    the other tabs.
    I know this is a lot at one time but I really just want to get some constructive feedback and if someone is awesome enough to actually write code for me then please please please put comments in the code so I can understand!
    I appreciate any and all feedback!
    Thank you 

    Hello,
    Thank you for your post.
    Your issue is out of support range of VS General Question forum which mainly discusses the usage issue of Visual Studio IDE such as
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
    Because your issue is about programming, maybe Visual Studio Language Forums can help you:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • First program on Zed board

    I have just got our Zed board.
    Can you please help me in locating my first program for Zynq w.r.t:
    1- PS section
    2- PL section
    3- Both in communication.
    I just want a minimal design to get into.
     

    Have you tried to just Google "zedboard tutorial" there are tons of tutorials out there. Go to zedboard.org support and look around. You can find some here: Zedboard Tutorials, In the tutorials is a step by step guild to build a simple PS/PL design that interacts with the switches and leds.  If I remember there are two main tutorials, one is bare-metal (don't need to boot Linux) and the other requires Linux up and running via the SD interface.  

  • Help with first program

    I just started taking a class in Flash CS4 and I have a basic program that I'm suppose to develop for my first project. My problem is that I'm not good at programming yet so I was wondering if anyone is able to help me out. Here is what I'm suppose to do.
    Use flash CS3 to create a mini marble game. It should have the following elements:
    •         a) The first scene should have a single button labeled "start game", placed at the exact center of an 800*600 pixel screen. A simple background image containing a polka dot pattern should fill the background layer for this intro screen.
    •         b) When the start button is pressed, the game should show a new screen with a solid color background (which may be white). Two marbles, represented by filled circles (80 pixels of radius or 80 by 80 pixel bounding box) of two different colors should appear. The first marble should appear at the exact center of the stage, the second marble at either a random location (extra credit for this) or one of four possible locations OTHER than the area allocated for the first marble.
    •         c) Using the mouse or any keystroke, the player should be able to "start" the second marble in the direction of the first at a constant speed of 24 pixels per second (use an event handler and the Enter_Frame event, as well as a 12 fps speed for the movieclip, to establish the speed of the marble).
    •         d) When the first marble collides with the second, it should stop it's motion, and the second marble should start moving at the same speed in the same direction than the first one until it leaves the screen.
    •         e) Display a "Game Over" sign, when the second marble has left the screen.
    •         f) Publish the movie, and upload both the fla and swf here.
    I finish the a) section but I don't know what to do with the rest. Here is my file.
    http://rapidshare.com/files/360378296/Project1.fla

    use some actionscript to code your start button to move to a new frame where your two marbles are on stage.  then apply actionscript to the 2nd marble so when it's clicked or a key is pressed you start a loop that moves that 2nd marble towards the center marble.  when the two collide (use hitTest() ), stop the 2nd marble and start moving the 1st marble.

  • Call another program in first program

    hi,
    i need to perform to call another report in my current report. so how am i going to do so?
    how report work:
    the report are going to run as background job. once the report run, it will send out the report in text file to user. and then i want it to trigger report 2. report 2 work the same, it will send another text file to user.
    and the parameter for both the report is on current date only.
    so how am i going to code in my first report program, to call the second report program, and to execute it?
    thanks
    Edited by: ben leen lee on May 14, 2008 3:57 AM

    Hi, 
    clear: d_JOB_COUNT.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            JOBNAME  = d_JOBNAME
          IMPORTING
            JOBCOUNT = d_JOB_COUNT.
        submit ZFI_AGEWISE_PERFORMANCE
        VIA JOB d_JOBNAME
        NUMBER  d_JOB_COUNT
        with IKUNNR   IN r_id
        with s_vertn  in S_VERTN
        with s_hkont  IN S_HKONT
        with IBUDAT   eq IBUDAT
        with P_BUKRS  eq P_BUKRS
        with s_umskz  in s_umskz
    *with R1 = R1
        WITH R2 = R2
    *with r3 = R3
        WITH P_SESS = P_SESS
        AND RETURN.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            JOBNAME      = d_JOBNAME
            JOBCOUNT     = d_JOB_COUNT
            STRTIMMED    = 'X'.
    Reward Points

  • MY first program in LabVIEW, please check it

    This is my first LabVIEW , My program is about taking EEG signal and filter it and extrat theta and alpha waves
    please could anyone  check my program
    Attachments:
    Simulated_EEGqq1.vi ‏1115 KB

    So I would arrange all of the vis so that you minimize the number of bends in wires. Also consider using subvis when you have portions of code preforming the same operations. It looks like you extract a portion of your code and then do some statistics on that portion. Consider making a subvi that you can resue. Also check out the following
    LabVIEW Programming Techniques - The Good, The Bad, and the Ugly
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours
    Chris C
    Chris Cilino
    National Instruments
    LabVIEW Product Marketing Manager
    Certified LabVIEW Architect

  • Cannot find symbol error on first program

    Good day
    I just started studying computer programming and the first app in book does not compile and I get error "Cannot find symbol". Error points to last line of code System.out.printf( "Sum is %d\n", sum );
    Code is copied from book so what is wrong?
    Here is full code:
    import java.util.Scanner;
    public class Addition
    public static void main( String args[] )
    Scanner input = new Scanner ( System.in );
    int number1;
    int number2;
    int sum;
    System.out.print( "Enter first integer: ");
    number1 = input.nextInt();
    System.out.print( "Enter second integer: ");
    number2 = input.nextInt();
    sum = number1 + number2;
    System.out.printf( "Sum is %d\n", sum );
    Thank you

    If the OP were compiling with an older Java version,
    the error would occur at the first line, not
    the last; Scanner was also introduced in Java 5.
    Anyway, that code compiles and runs fine on my
    computer.Damn, didn't see the usage of Scanner.

  • SavitchIn not found? Need help on first program

    I am using an old Java programming book written by Walter Savitch. I am running a sample program from the book in my NetBeans environment. When I run the thing, it gives me errors on the command SavitchIn. Here is the code:
    package firstprogram;
    * @author mac173
    public class Main {
    * @param args the command line arguments
    public static void main(String[] args) {
    System.out.println("Hello out there.");
    System.out.println("Want to talk some more?");
    System.out.println("Answer y for yes and n for no.");
    char answerLetter;
    answerLetter = SavitchIn.readLineNonwhiteChar();
    if (answerLetter == 'y')
    System.out.println("Nice weather we are having, huh?");
    System.out.println("Good-by.");
    System.out.println("Press any key to end program");
    String junk;
    junk = SavitchIn.readLine();
    The error messages from Netbeans:
    Compiling 1 source file to C:\Users\mac173\Documents\NetBeansProjects\FirstProgram\build\classes
    C:\Users\mac173\Documents\NetBeansProjects\FirstProgram\src\firstprogram\Main.java:23: cannot find symbol
    symbol : variable Savitchin
    location: class firstprogram.Main
    answerLetter = Savitchin.readLineNonwhiteChar();
    C:\Users\mac173\Documents\NetBeansProjects\FirstProgram\src\firstprogram\Main.java:31: cannot find symbol
    symbol : variable Savitchin
    location: class firstprogram.Main
    junk = Savitchin.readLine();
    2 errors
    BUILD FAILED (total time: 0 seconds)
    The book describes SavitchIn as a class to obtain input from the keyboard. I assume the class name and the writers names are the same because the wrote the class. Is this class now obsolete, or did I mess up the code?
    Edited by: mac173 on Aug 1, 2008 7:12 PM

    mac173 wrote:
    I do not want to change books or use the tutorials, because this book was specifically written to teach PROGRAMMING, not just JAVA.Then use the Java tutorials, or one of the other below links, to learn Java, and use that amazing wonderful fantastic most perfect one and only programming teaching book to learn whatever programming concepts the links below don't cover.
    I promise you, though, you'll gain nothing but pain by using outdated Java, and you'll have a harder time getting help. Folks here will provide help and examples based on the current Java language, APIs, and tools.
    If you're serious about learning programming, using an out-of-date book just because it's cheap is not an option.
    Sun's [basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
    Sun's [New To Java Center|http://java.sun.com/learning/new2java/index.html].Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    [http://javaalmanac.com|http://javaalmanac.com]. A couple dozen code examples that supplement [The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance].
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's [Thinking in Java|http://mindview.net/Books/DownloadSites] (Available online.)
    Joshua Bloch's [Effective Java|http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683/ref=pd_bbs_1?ie=UTF8&s=books&qid=1214349768&sr=8-1]
    Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance].
    James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806]. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.

Maybe you are looking for

  • Need Some help in Developing an ALV report ..Plz help me

    Hi Experts I am basic learner to ABAP Here I need some help in developing a Delivery *** Invoice Report....Please help me by spending a little time.. Tables are VBAK VBAP LIPS LIKP   and Document floe table is VBFA   SELECT VBELN VKORG VTWEG SPART   

  • Read Only Barcode Issue

    I have a form that was imported from a PDF document in Adobe LiveCycle Designer ES 8.2.  I added a 3 of 9 barcode and the Default value is the form number (*1.764903.105NFS*).  I do not want a user to be able to click on the barcode, so I made it Rea

  • Aperture can't move files to trash

    My photos are on networked external hard drive, and I have the folder on the drive mounted. However, when I try to delete a photo from this drive within Aperture, I get a message saying "Cannot Move Files to Trash" "You don't have access to the Trash

  • Xpath condition in Receiver Determination

    Hi  Gurus - I want to implement a condition, For QUALF=01 AND ORGID=ORG1, then only it should go to some receiver and otherwise some other Receiver.However when i implement this using context object/Xpath, The condition happens to be true which shoul

  • Update file data into xk02

    Hi All, I need to update file data into vendor master general data,company code data ,purchase org data in xk02 . Is there any BAPI for xk02 to update all the vendor master data into general data,company code, purchase org data. Please any one share