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 10 of 10

Thread: Intro to Java

  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts

    Intro to Java

    Alright, I've had some trouble with trying to learn java in the past, mainly installing and using the tools that Sun Micro provides. I have found some pretty good tutorials, although if anyone thinks they know a phenomenal one feel free to mention. The main thing I'm looking for is a good, straight java compiler. I don't need a fancy-shmancy IDE, just a simple debugger/compiler.

    I just need to be pointed in the right direction; I have big plans for java and my webpage.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I prefer Eclipse for developing java. You will need the JDK. Do a search on how to setup the environmental variables for java. After doing that successfully you can run java from the command line or use eclipse. Eclipse is good for debugging. Good tutorial here on getting java setup on your system.

    http://www.javacoffeebreak.com/tutor...ted/index.html
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    Thank you, it appears to be just what I've been looking for. However, I can't seem to debug or run any programs. I have my code:

    Code:
    public class Helloworld
    {
    public static void main(String[] args)
    {
    System.out.println("Hello World!");
    }
    }
    in a .java file. I try to run it and I get an error
    The selection could not be launched, and there are no recent launches.
    Do you happen to know what's wrong?

  • #4
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    how did you run the program? Alt+Shift+X, J ?
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #5
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    CTRL-F11, (menu bar) > Run > Run
    Is that right? I mean, should I be doing it a different way?

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    What program are you using to run the file? Did you setup your environmental variables? Have you tried using the command line to verify that everything is working properly. READ the whole tutorial, not just bits and pieces.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    In Eclipse, right click on your .java file in the navigation window and choose:
    "run as" --> "java application"

    This is the same as the ALT+SHIFT+X, J keyboard shortcut.

    If you want to test it on the command line, after ensuring that you have Java installed and configured correctly you can simply use the compiler from the command line.

    First, on the command line, navigate to the directory where you have your .java file.
    Then type "javac MyFile.java" without the quotes.
    Then type "java MyFile" again without quotes.

    The javac command compiles the .java file into a .class file, and the java command runs the .class file.

  • #8
    ley
    ley is offline
    New Coder
    Join Date
    Jun 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try TextPad.

    Oh make sure you are saving your .java file exactly the same as your class name

  • #9
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Starting out with Java, I didn't like Eclipse much. I prefered Jcreator Pro and later on moved on to NetBeans. I still use Jcreator Pro occasionally.

    -my first post!

  • #10
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by binaryWeapon View Post
    I don't need a fancy-shmancy IDE
    well if you dont want a "fancy-shmancy IDE" go for notepad, lol.


  •  

    Posting Permissions

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