I just started studying JAVA. I'm trying something very simple: Request a argument from the user on the prompt. I made this code:
public class Request
public static void main (String args)
Scanner s = new Scanner(System.in);
System.out.println("What's your name?");
String name = s.nextLine();
System.out.println("Welcome " + name);
Java -cp Request
java Request, or maybe
java -cp . Request ; the
-cp option provides the JVM with a classpath, which should be a list of jars or directories containing
As Klitos mentions, you can set the
CLASSPATH environment variable to provide a default classpath. Setting it to include the current directory
. is common practice and spare you from having to use
-cp . when invoking Java.
In Windows, the variable is
%CLASSPATH% and is a
;-separated list of windows pathes.
In Linux (and MacOS AFAIK), the variable is
$CLASSPATH and is a
:-separated list of unix pathes.