Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2008
    Posts
    3
    Rep Power
    0

    Default executing the java file

    Hi there, I am relatively new to the Java expierience! I only have one problem. I am using a text editor to execute a java file (I do have eclipse, but just want to see how it works using the Command Prompt). I am working through the tutorials on the java.sun website and am currently busy with the helloworld part (http://java.sun.com/docs/books/tutor...ava/unix.html). I can compile the text file using the 'javac' command, but cannot execute the class file using the 'java' command. Attached is the error.

    Any suggestions

    Thanks in advance
    Attached Files Attached Files

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    8

    Default

    Welcome TBWM! :)

    Have you looked over the source files? That error message appears to be telling you it's a name issue - double check your code.

    See you around!
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

  3. #3
    Join Date
    Jan 2008
    Posts
    3
    Rep Power
    0

    Default

    Thanks! No that's not it. Here is my .java file's contents:

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

    The thing is the javac command did not work at first so I had to change the Path variable to include all of the java commmands. Is it possible that the problem might be there somewhere? The tutorial tells you that you must edit the CLASSPATH variable, but I do not have one and I tried to create one, but it still didnt work

    Thanks

  4. #4
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    8

    Default

    Ah.. I apologize, I assumed you already had this set. Not to start a flame war, but this is one of the reasons I love to use Linux, it makes setting this up much easier than on Windows.
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

  5. #5
    Join Date
    Jan 2008
    Posts
    3
    Rep Power
    0

    Default

    I set that, but i still get the same error message as soon as I try and execute the file. And yes I am getting Ubuntu as soon as the stellenbosch network gets some life again. hehe

    thanks

Similar Threads

  1. Executing a jar file
    By peiceonly in forum New To Java
    Replies: 7
    Last Post: 02-14-2014, 10:02 AM
  2. Executing stored procedures
    By mew in forum JDBC
    Replies: 3
    Last Post: 08-20-2008, 06:47 PM
  3. Problem with executing
    By mcal in forum New To Java
    Replies: 2
    Last Post: 02-09-2008, 02:51 PM
  4. Problem with executing .jar files
    By hiranya in forum NetBeans
    Replies: 2
    Last Post: 10-02-2007, 08:24 PM
  5. Executing Batch
    By zcoarens in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 10:49 AM

Posting Permissions

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