java CLASSPATH Environement var

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Abdelhalim MIMOUNI

    #1

    java CLASSPATH Environement var

    hi, i'm new to java, and using sun last JDK, and i'm trying to understand
    how work this feature when we want to compile at command line ? i'm trying
    to set the classpath to the directory of the package but still always not
    working!
    thank's.

    --
    AbdelHalim MIMOUNI


  • Raymond DeCampo

    #2
    Re: java CLASSPATH Environement var

    Abdelhalim MIMOUNI wrote:[color=blue]
    > hi, i'm new to java, and using sun last JDK, and i'm trying to understand
    > how work this feature when we want to compile at command line ? i'm trying
    > to set the classpath to the directory of the package but still always not
    > working!
    > thank's.
    >[/color]

    The best way to get an answer to your question is to post everything you
    can. Post the exact command line you are using, the output from it.
    Post your directory structure, and which files exist where. In your
    case, post the package declaration of your java source files as well.

    Ray

    --
    XML is the programmer's duct tape.

    Comment

    • Abdelhalim MIMOUNI

      #3
      Re: java CLASSPATH Environement var

      //the super classe



      package myPackage;

      public class firstClass

      {
      //class data
      int dataField_One;
      int dataField_Two;



      public firstClass ()

      {

      //constructor declaration

      }



      } //end firstClass



      ---------------------------------------------



      package myPackage;

      import java.awt.*;

      public class DrawClass extends firstClass
      {
      //class data

      //private declaration


      //methods
      //constructors
      public DrawClass()// constructor

      {

      //constructor declaration

      }



      //other declarations

      } //end DrawClass

      ----------------------------------------------
      my directory files located in the directory named as the package name is:

      myPackage.

      The files are: firstClass.java (the super classe) and DrawClass.java



      And my command line command is a follow:

      D:\DOCUME~1\MAS TERPOINT\My Documents\Cours \Java\Pers
      Teach\Prope_Obj \myPackage>set CLASSPATH=.;D:\ DOCUME~1\MASTER POINT\My
      Documents\Cours \Java\Pers Teach\Prope_Obj \myPackage;



      DrawaRect.java: 10: cannot resolve symbol

      symbol : class firstClass

      location: class figure.DrawaCla ss

      public class DrawaClass extends firstClass

      ^

      DrawaRect.java: 70: cannot resolve symbol

      symbol : variable width

      location: class myPackage.Drawa Class

      02 errors




      --
      AbdelHalim MIMOUNI
      "Raymond DeCampo" <nospam@twcny.r r.com> a écrit dans le message de news:
      T09ke.16423$i42 .4499@twister.n yroc.rr.com...[color=blue]
      > Abdelhalim MIMOUNI wrote:[color=green]
      > > hi, i'm new to java, and using sun last JDK, and i'm trying to[/color][/color]
      understand[color=blue][color=green]
      > > how work this feature when we want to compile at command line ? i'm[/color][/color]
      trying[color=blue][color=green]
      > > to set the classpath to the directory of the package but still always[/color][/color]
      not[color=blue][color=green]
      > > working!
      > > thank's.
      > >[/color]
      >
      > The best way to get an answer to your question is to post everything you
      > can. Post the exact command line you are using, the output from it.
      > Post your directory structure, and which files exist where. In your
      > case, post the package declaration of your java source files as well.
      >
      > Ray
      >
      > --
      > XML is the programmer's duct tape.[/color]


      Comment

      • Raymond DeCampo

        #4
        Re: java CLASSPATH Environement var

        Abdelhalim MIMOUNI wrote:[color=blue]
        > And my command line command is a follow:
        >
        > D:\DOCUME~1\MAS TERPOINT\My Documents\Cours \Java\Pers
        > Teach\Prope_Obj \myPackage>set CLASSPATH=.;D:\ DOCUME~1\MASTER POINT\My
        > Documents\Cours \Java\Pers Teach\Prope_Obj \myPackage;
        >
        >[/color]

        Abdelhalim,

        The problem is that you are including the name of the package in the
        CLASSPATH. The javac and java programs will append the package name to
        the CLASSPATH entries. So what you want is:

        D:\DOCUME~1\MAS TERPOINT\My Documents\Cours \Java\Pers
        Teach\Prope_Obj \myPackage>set CLASSPATH=D:\DO CUME~1\MASTERPO INT\My
        Documents\Cours \Java\Pers Teach\Prope_Obj ;

        HTH,
        Ray

        --
        XML is the programmer's duct tape.

        Comment

        • Abdelhalim MIMOUNI

          #5
          Re: java CLASSPATH Environement var

          ok, it's working, so as i understand the classpath var should always be set
          to the directory containing the package directory itself!
          thank's

          --
          AbdelHalim MIMOUNI
          "Raymond DeCampo" <nospam@twcny.r r.com> a écrit dans le message de news:
          aMmke.16181$tM3 .15084@twister. nyroc.rr.com...[color=blue]
          > Abdelhalim MIMOUNI wrote:[color=green]
          > > And my command line command is a follow:
          > >
          > > D:\DOCUME~1\MAS TERPOINT\My Documents\Cours \Java\Pers
          > > Teach\Prope_Obj \myPackage>set CLASSPATH=.;D:\ DOCUME~1\MASTER POINT\My
          > > Documents\Cours \Java\Pers Teach\Prope_Obj \myPackage;
          > >
          > >[/color]
          >
          > Abdelhalim,
          >
          > The problem is that you are including the name of the package in the
          > CLASSPATH. The javac and java programs will append the package name to
          > the CLASSPATH entries. So what you want is:
          >
          > D:\DOCUME~1\MAS TERPOINT\My Documents\Cours \Java\Pers
          > Teach\Prope_Obj \myPackage>set CLASSPATH=D:\DO CUME~1\MASTERPO INT\My
          > Documents\Cours \Java\Pers Teach\Prope_Obj ;
          >
          > HTH,
          > Ray
          >
          > --
          > XML is the programmer's duct tape.[/color]


          Comment

          Working...