1

I'm looking through a Makefile for a java project, and can't find any definition for the variable CLASSPATH:

JFLAGS = -g -Xlint:unchecked -Xlint:deprecation \
        -sourcepath .. -classpath ..:$(CLASSPATH)

CLASSES = $(SRCS:.java=.class)

...
...

Does this refer to an environment variable ('echo $CLASSPATH' in bash)?

I don't see any references to another Makefile in another directory (e.g. maybe including definitions from a global Makefile?)

Rdesmond
  • 1,201
  • 10
  • 30

1 Answers1

1

Makefiles can indeed reference environment variables, which is exactly what CLASSPATH is in this context. Per Wikipedia,

Classpath is a parameter in the Java Virtual Machine or the Java compiler that specifies the location of user-defined classes and packages. The parameter may be set either on the command-line, or through an environment variable.

On Linux, you are correct in that you can view the variable with echo $CLASSPATH. To set the variable, you can use export CLASSPATH=/path/to/classfiles

CyanBlob
  • 64
  • 1
  • 7