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?)

2

1 Answer 1

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

1
  • excort --> export.
    – blackpen
    Nov 3, 2016 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.