Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java class files in current directory?

Tags:

java

classpath

How "java" knows the class file to execute without setting the class path.ie.,Does it check in the current directory by default or we need to set the class path for current directory too.

like image 679
JavaUser Avatar asked Sep 14 '10 06:09

JavaUser


1 Answers

It checks the current directory first. If the class is not found, it searches for that class in the class path.

The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings. [source]

like image 74
jmj Avatar answered Sep 19 '22 03:09

jmj