Right, so I managed to get Eclipse to work (which we need to use in our exam). I'm importing and running some of my programs I had written with gedit and run with command prompt (which worked), but they don't seem to work in Eclipse.
My Hello World program did, but my others seem to throw errors regarding args?
package week1;
public class PersonalGreeting {
public static void main(String[] args) {
String first_name = args[0];
String last_name = args[1];
System.out.println("Hello " + first_name + " " + last_name);
}
}
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at week1.PersonalGreeting.main(PersonalGreeting.java:6)
Any ideas how to fix this and what's causing it? Why should it work in command prompt but not Eclipse?