1. The problem statement, all variables and given/known data:
As a excercise I have to compile a program (Hello2.java) with a class file (HelloText.java) in another directory. (As you seen in the screenshot)
I´m setting a PATH and a CLASSPATH (system variables). It´s working without a command. But if I use a command like java or javac which I need to compile ITS NOT WORKING.
I can´t retrace why the bash is doing this respectively is not doing this.
2. Relevant commands, code, scripts, algorithms:
PATH=$PATH:<directory>, CLASSPATH =$CLASSPATH:<directory>, cd (change directory), javac
3. The attempts at a solution (include all code and scripts):
see the screenshot.
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Beuth Hochschule für Technik, Berlin, Germany, Radners, Programmierung I (Praxis)
You didn't set the environment variable CLASSPATH, but a shell variable of this name, i.e. only the shell sees this. What you did here is similar to setting a variable in your Java program, then run a shell program from Java and hope that the Java variable is visible to the shell program.
In shell context, "environment variables" are sometimes also called "exported variables", because the child processes can see them. Each shell has a different way to set an environment variable. For example, bash or zsh use the command export, while csh or tcsh use the command setenv.
You didn't specify, which shell you are using. Consult the man page of your shell to find out, how to set environment variables.