Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    simple .java file

    how can i make a simple .java file in JBuilder?
    for example a helo world file...

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    class HelloWorld{

    public static void main(String args[]){

    System.out.println("Hello World");

    }//end main

    }//end class
    Last edited by Spookster; 03-09-2003 at 02:45 AM.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no, i didn't mean that, i meant how to make new file (.java) in JBuilder.
    for more illustration: where should i copy and paste this code?

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Well you could read the help files that come with it. Been a few years since I used it but you should create a New Project and then add a java source file to it. Can't remember all the menu choices.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    First make a new project, File -> New Project. Then just follow the wizard to set it up. Then make a new class File -> New Class and also follow its wizard. Make sure the name of the class is the same as .java (HelloWorld if you use the code spook provided). Then to compile your project goto Project -> Make Project and then Run -> Run Project to run it.

  • #6
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by Josh Campbell
    if you use the code spook provided)
    I had a typo in that code and you didn't catch it. Shame shame.

    I fixed it now so you will never know what it was.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #7
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I assumed that someone as skilled as yourself would not have made any typos or errors. j/k

  • #8
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but when i choose run a dialog box named project properties will apear...
    i choosed new from that dialog, another dialog will apear, then i made the main class: HelloWorld.HelloWorld, then i clicked ok to close this dialog, after that i clicked run and this error appeared to me:
    Could not find the main method. Program will exit!
    Why

  • #9
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Make sure you chose application as type and that you have the package setup correctly. Whenever you paste in spook's code, keep the thing that says package HelloWorld;

  • #10
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i did it!!! and the same problem...

  • #11
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok heres the process again, this works for me

    1. File -> New Project
    2. Name your project then press finish
    3. File -> New Class
    4. Name your class then press finish
    5. Copy and paste spook's code, remembering to keep package thing in there
    6. Project -> Make Project
    7. Run -> Run Project
    8. Click New
    9. Choose Application as type
    10. Choose the class you just made as main class.
    11. Run -> Run Project

  • #12
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok thank you very much, but where can i see the output of my project?

  • #13
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Output using System.out is displayed in the bottom text area thing, right below where the classpath and the call to the java interpreter are displayed.

  • #14
    New Coder
    Join Date
    Mar 2003
    Location
    Canada eh.
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmmm. I use ready to program in Java from Holt software it's cool but sometimes a little buggy. Still I prefer over Jbuilder.

    The Bee
    "Me work..... There is as much chance of that happening as there is of the world ending as you read this!"


  •  

    Posting Permissions

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