James Raitsev
James Raitsev

Reputation: 96391

What is the significance of .: in classpath?

The title has it all, when setting up a class path to be used by your program, what is the significance of .: construct?

Consider

/Library/Java/Home/bin/java -cp $APP_HOME/lib/*.jar::  Handler

vs

/Library/Java/Home/bin/java -cp .:$APP_HOME/lib/*.jar::  Handler

Upvotes: 1

Views: 936

Answers (2)

shayan ray
shayan ray

Reputation: 321

For the code particular fragment given above: /Library/Java/Home/bin/java -cp .:$APP_HOME/lib/*.jar:

this would mean the current directory (denoted by '.') is to be looked at first before all the jars in the $APP_HOME directory.

: is the classpath separator in unix whereas ; is the classpath separator in windows.

Upvotes: 0

Greg Hewgill
Greg Hewgill

Reputation: 993173

Paths in the classpath are separated from one another by :. So . is just the first entry in the classpath list, which refers to the current directory.

Upvotes: 7

Related Questions