Results 1 to 5 of 5

Thread: running file from command line in windows

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    running file from command line in windows

    Code:
    import java.io.*;
    
    public class cw1 {
        
        public static void main (String args[]) throws IOException {
    	System.out.println("fdfsdf");
    	String blah = args[0];
    	
    	System.out.println(blah);
        }    
        
    }
    Basically, when i compile and run that (from the xemacas popup), it gives me an exception error:

    fdfsdf
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at cw1.main(cw1.java:15)

    Process cw1 exited abnormally with code 1

    i need to run this by command line somehow, like
    java cw1 hello
    so args[0] will be hello and it shud print hello.

    i hope someone with experience can help me. im on windows, using xemacs
    with jdk1.5.0_05

    my environment variables 'path' is set as
    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.5.0_05\bin;C:\Program Files\Common Files\GTK\2.0\bin
    Last edited by Pouncer; Jan 29th, 2007 at 07:31 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
  •  



Click Here to Expand Forum to Full Width