• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Using Classpaths

 
Greenhorn
Posts: 29
Mac Java ME Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want mak somme test for that i creat 2 class



so for compile using command line

javac -cp /com/data/cour ; F.java


i have error i don't know why ?
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javac -cp /com/data/cour ; F.java

If you are using windows OS, First skip the First '/' because it is used in solaris for the root folder. and skip the ';' . Instead of semicolon (;) use a single space...
I think it will work fine ...

-cp or -classpath works for same . As an example. After the -cp tag you must specify the fully qualified name of the class.
So use

javac -cp com.data.cour -d . com/data/classeur/F.java

from root of com folder. -d . means where you want to save the class files...
[ simply to understand : -cp is followed by a fully classified class path and -d is followed by a directory location to store class]

Pictorially Example :

root
|
com
|
data
|
----cour
| |
| D.java & D.class
|
-----classur
|
F.java & F.class



Commands from root directory:

javac -d . com/data/cour/D.java
javac -cp com.data.cour.D -d . com/data/classur/F.java


To run :

java -cp com.data.cour.D F



I think this will work..


Oh check your code... You just import package not package Class
change that into

import com.data.cour.D
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic