I highly doubt that a text editor did that.
Anyway, java -classpath . Gateway
wouldn't work if that class is in the package org.mcgill.telecom
(which the folder structure suggests).
Try java -classpath . org.mcgill.telecom.Gateway
instead from the folder where the org
folder can be seen.
Here's what you can do to test it.
- go to a
temp
folder and create this folder structure: org/mcgill/telecom
;
- create a file called
Gateway.java
in the telecom
folder;
- copy the contents below in your
Gateway.java
file;
- open a command prompt and navigate to your
temp
folder;
- execute
javac org/mcgill/telecom/Gateway.java
- execute
java -classpath . org.mcgill.telecom.Gateway
This is what I get:
bart@hades:~$ cd Temp/
bart@hades:~/Temp$ ls
org
bart@hades:~/Temp$ javac org/mcgill/telecom/Gateway.java
bart@hades:~/Temp$ java -classpath . org.mcgill.telecom.Gateway
Oi, it works!
bart@hades:~/Temp$
Here the Gateway class:
package org.mcgill.telecom;
public class Gateway {
public static void main(String[] args) {
System.out.println("Oi, it works!");
}
}