I was just reading this line:
The first thing the format() method does is load a Velocity template from the classpath named output.vm
And I couldn't figure out what was meant by classpath in this context.
I was just reading this line:
The first thing the format() method does is load a Velocity template from the classpath named output.vm
And I couldn't figure out what was meant by classpath in this context.
classpath and path are the evironment variables . usually , you have to put the jdk/bin to path so that u could use java compiler everywhere , classpath is the path of your .class files . the classpath has a default path a period(.) which means the current directory. but when u used the packages . u would either specify the full path of the .class file or put the .class file path in the classpath which would save a lots of works !
CLASSPATH is an environment variable (i.e., global variables of the operating system available to all the processes) needed for the Java compiler and runtime to locate the Java packages used in a Java program. (Why not call PACKAGEPATH?) This is similar to another environment variable PATH, which is used by the CMD shell to find the executable programs.
CLASSPATH can be set in one of the following ways:
Think of it as Java's answer to the PATH environment variable - OSes search for EXEs on the PATH, Java searches for classes and packages on the classpath.
Like the springsteen-esque question, too.
The classpath in this context is exactly what it is in the general context: anywhere the VM knows it can find classes to be loaded, and resources as well (such as output.vm in your case).
I'd understand Velocity expects to find a file named output.vm anywhere in "no package". This can be a JAR, regular folder, ... The root of any of the locations in the application's classpath.
Static member of a class can be called directly without creating object instance. Since the main method is static Java virtual Machine can call it without creating any instance of a class which contains the main method, which is start point of program.
Setting the CLASSPATH System Variable
To display the current CLASSPATH variable, use these commands in Windows and UNIX (Bourne shell): In Windows:
C:\> set CLASSPATH
In UNIX:% echo $CLASSPATH
To delete the current contents of the CLASSPATH variable, use these commands: In Windows:
C:\> set CLASSPATH=
In UNIX:% unset CLASSPATH; export CLASSPATH
To set the CLASSPATH variable, use these commands (for example): In Windows:
C:\> set CLASSPATH=C:\users\george\java\classes
In UNIX:% CLASSPATH=/home/george/java/classes; export CLASSPATH