Results 1 to 4 of 4
  1. #1
    kumarkumar is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default what is the need and use of .; in classpath ?

    I kept FirstProgram.java in Test folder of D drive.I set path as C:\Program Files\Java\jdk1.6.0_32\bin in environment variable.
    I compiled and got FirstProgram.class in Test folder of D drive.

    FirstProgram.java
    public class FirstProgram{

    public static void main(String args[]){
    System.out.println("Welcome");
    }
    }

    I set classpath as D:\Test;.; in environment variable.
    When I run the above code by typing java FirstProgram in C drive in DOS prompt,It gave Welcome output.
    I modified classpath as D:\Test; in environment variable.
    I removed .; from classpath.
    When I run the above code by typing java FirstProgram in C drive in DOS prompt,It gave same output.

    Then,what is the need and use of adding .; in classpath ?.
    Last edited by kumarkumar; 05-20-2012 at 03:02 PM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,338
    Rep Power
    25

    Default Re: what is the need and use of .; in classpath ?

    The dot is a way to reference the current folder.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    kumarkumar is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default Re: what is the need and use of .; in classpath ?

    1. Does Current folder represent the directory of dos prompt from where I run java program ?.
    Here I run the above code from C drive in DOS prompt.So here does Current folder (.) represent C directory?.

    2. Even after I removed .; from classpath environment variable,code runs perfectly.so what is the need to keep .; in classpath ?.
    Last edited by kumarkumar; 05-20-2012 at 03:59 PM.

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,338
    Rep Power
    25

    Default Re: what is the need and use of .; in classpath ?

    The current directory is the default.
    java Classname
    The above works IF the environment variable is NOT set or if it includes the dot.
    The above won't work if Classname is in the current directory and the current directory is not on the classpath.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. ClassPath
    By homka in forum New To Java
    Replies: 0
    Last Post: 10-05-2011, 01:18 PM
  2. Replies: 1
    Last Post: 05-03-2011, 02:28 AM
  3. DTD on a classpath
    By frenk_castle in forum XML
    Replies: 0
    Last Post: 03-29-2011, 07:26 PM
  4. Classpath
    By Parneel in forum Enterprise JavaBeans (EJB)
    Replies: 4
    Last Post: 04-01-2009, 12:22 PM
  5. j3d classpath
    By sales1 in forum New To Java
    Replies: 3
    Last Post: 12-23-2008, 01:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •