|
-
Jan 29th, 2007, 07:25 PM
#1
Thread Starter
Frenzied Member
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.
-
Jan 30th, 2007, 03:53 AM
#2
Re: running file from command line in windows
Are you really launching it with that full command line?
Code:
C:\...\> java cw1 hello
It's basically telling you that you didn't pass any arguments, and I've never heard of such a serious and basic error in Java - I very much doubt it would ever make it into release.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 30th, 2007, 06:39 AM
#3
Thread Starter
Frenzied Member
Re: running file from command line in windows
Thanks for the reply CornedBee.
 Originally Posted by CornedBee
Are you really launching it with that full command line?
Code:
C:\...\> java cw1 hello
It's basically telling you that you didn't pass any arguments, and I've never heard of such a serious and basic error in Java - I very much doubt it would ever make it into release.
My problem is that i compile and run it by the popups in xemacs, i don't know the command line input to running it like you suggested
do you use xemcas? does anyone please? i badly need to get this working
http://img209.imageshack.us/my.php?image=picfu3.jpg
-
Jan 30th, 2007, 09:00 AM
#4
Re: running file from command line in windows
Check the project settings if there is a "command line arguments" field somewhere.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 30th, 2007, 11:13 AM
#5
Thread Starter
Frenzied Member
Re: running file from command line in windows
 Originally Posted by CornedBee
Check the project settings if there is a "command line arguments" field somewhere.
yep found it in the 'shell' menu! thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|