Results 1 to 3 of 3
  1. #1
    MehItsMe is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default Can't get any program to run

    Hey all.

    I've only started learning java today and i'm having trouble getting programs to run - even hello world! :)

    The contents of hello.java are:

    public class hello {
    public static void main (String[] args) {
    System.out.println("Hello, world");
    }
    }

    When I type
    "java hello.java" I get
    h t t p : / / img12.imageshack.us/img12/4046/javaerror.png
    I'm sorry for breaking the rules so early on - I did try to pipe the output to a file so I could copy & paste it but it wasn't working - sorry!

    I kno that i'm only new, but i'm not convinced its my code; I get the exact same message if I point it to a file that doesn't exist - the only difference being the file name.
    I'm writing in notepad then using java via the command prompt to run my program. I've installed jdk 6 update 16 and java db 10.4.2.1 along with java 6 update 16.

    If anyone could help me out at all with this issue i'd be very greatfull.

    Thanks for reading.

  2. #2
    Andyj is offline Member
    Join Date
    Oct 2009
    Posts
    10
    Rep Power
    0

    Default

    I'm pretty new to this as well but I think you need to compile it first:

    javac hello.java

    and then run the class file

    java hello

  3. #3
    MehItsMe is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default

    Thanks; that was the problem - everythings working fine now!
    I've set the directory where javac is as part of my path so I can work with in my java directory which is nice.

    Thanks again - enjoy the rep.

Similar Threads

  1. Execute A program from a Program!
    By Moncleared in forum Advanced Java
    Replies: 2
    Last Post: 02-22-2009, 04:17 PM
  2. Executing a program within a program
    By gibsonrocker800 in forum New To Java
    Replies: 5
    Last Post: 05-12-2008, 08:24 AM
  3. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  4. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

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