By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,843 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,843 IT Pros & Developers. It's quick & easy.

java CLASSPATH Environement var

P: n/a
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
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Abdelhalim MIMOUNI wrote:
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.


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.
Jul 18 '05 #2

P: n/a
//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\MASTERPOINT\My Documents\Cours\Java\Pers
Teach\Prope_Obj\myPackage>set CLASSPATH=.;D:\DOCUME~1\MASTERPOINT\My
Documents\Cours\Java\Pers Teach\Prope_Obj\myPackage;

DrawaRect.java:10: cannot resolve symbol

symbol : class firstClass

location: class figure.DrawaClass

public class DrawaClass extends firstClass

^

DrawaRect.java:70: cannot resolve symbol

symbol : variable width

location: class myPackage.DrawaClass

02 errors


--
AbdelHalim MIMOUNI
"Raymond DeCampo" <no****@twcny.rr.com> a écrit dans le message de news:
T0******************@twister.nyroc.rr.com...
Abdelhalim MIMOUNI wrote:
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.


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.

Jul 18 '05 #3

P: n/a
Abdelhalim MIMOUNI wrote:
And my command line command is a follow:

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


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\MASTERPOINT\My Documents\Cours\Java\Pers
Teach\Prope_Obj\myPackage>set CLASSPATH=D:\DOCUME~1\MASTERPOINT\My
Documents\Cours\Java\Pers Teach\Prope_Obj;

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 18 '05 #4

P: n/a
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" <no****@twcny.rr.com> a écrit dans le message de news:
aM*******************@twister.nyroc.rr.com...
Abdelhalim MIMOUNI wrote:
And my command line command is a follow:

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


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\MASTERPOINT\My Documents\Cours\Java\Pers
Teach\Prope_Obj\myPackage>set CLASSPATH=D:\DOCUME~1\MASTERPOINT\My
Documents\Cours\Java\Pers Teach\Prope_Obj;

HTH,
Ray

--
XML is the programmer's duct tape.

Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.