dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: java path

  1. #1
    feroz Guest

    java path


    hello sir,

    I am beginner of java.

    For running java code we set path (path=%path%;c:/jdk1.2/bin)
    this for calling java classes from any directory.

    For running java servlet(jsdk) we want to set path as well as class path.

    1.what is classpath?
    2.why we want to set classpath?
    3.how to set classpath for servlet?
    4.why we don't set for jdk?


  2. #2
    Rick Guest

    Re: java path


    Feroz,

    I cut and pasted this from sun.com for you.
    If you go to www.sun.com and search on 'class path', you can get more information.

    Best of luck,

    Rick

    Setting the class path
    Synopsis
    The class path can be set using either the -classpath option when
    calling a JDK tool (the preferred method) or by setting the CLASSPATH environment
    *variable. The -classpath option is preferred because you can set it *individually
    for each application without affecting other applications *and without other
    applications modifying its value.
    % jdkTool -classpath path1ath2...

    -or-

    % CLASSPATH=path1ath2...
    % export CLASSPATH

    where:

    jdkTool
    A command-line tool, such as java, javac, or javadoc. For a listing, see
    JDK Development Tools.

    path1ath2
    Paths to the .jar, .zip or .class files. Each path should end with a filename
    or directory depending on what you are setting the class path to:
    For a .jar or .zip file that contains .class files, the path ends with the
    name of the .zip or .jar file.
    For .class files in an unnamed package, the path ends with the directory
    that contains the .class files.
    For .class files in a named package, the path ends with the directory that
    contains the "root" package (the first package in the full package name).

    Multiple path entries are separated by colons.

    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.

    Classpath entries that are not either a directory or an archive (.zip or
    .jar file) are ignored.

    Description
    The class path tells Java tools and applications where to find third-party
    and user-defined classes -- that is, classes that are not Java extensions
    or part of the Java platform. The class path needs to find any classes you've
    compiled with the javac compiler -- its default is the current directory
    to conveniently enable those classes to be found.

    JDK 1.2, the JVM and other JDK tools find classes by searching the Java platform
    (bootstrap) classes, any extension classes, and the class path, in that order.
    (For details on the search strategy, see How Classes Are Found.) Class libraries
    for most applications will want to take advantage of the extensions mechanism.
    You only need to set the class path when you want to load a class that's
    (a) not in the current directory or in any of its subdirectories, and (b)
    not in a location specified by the extensions mechanism.


    ******
    "feroz" <ferozismail@yahoo.com> wrote:
    >
    >hello sir,
    >
    > I am beginner of java.
    >
    > For running java code we set path (path=%path%;c:/jdk1.2/bin)
    >this for calling java classes from any directory.
    >
    >For running java servlet(jsdk) we want to set path as well as class path.
    >
    >1.what is classpath?
    >2.why we want to set classpath?
    >3.how to set classpath for servlet?
    >4.why we don't set for jdk?
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center