Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

How to modify classpath ?

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a package and placed a .java file in it.When i tried to import the package & the file into another source file,i get a error,saying that the package was not found.
Pl.help.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to include "to be" imported file in your class path ?
Are you developing on windows platform or Unix?
If classpath is already defined in your session, you can add the following in your startup script or in windows in env variables (control panel - system)
Unix - setenv CLASSPATH $CLASSPATH /java/xxx /your_dir_path
Windows - set classpath=%classpath%;d:\your_dir_path
hope it helps ..
[ May 20, 2002: Message edited by: Gaurav Mantro ]
 
geetha nagarajan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No,it's not.
This is the first time iam working with packages.So,it would be very helpful,if the concept could be explained in great detail.Thanks in advance.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out Sun's Java Tutorial on Creating and Using Packages (the section on packages is listed at the bottom of the page).
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
you can make a jar file and giving the exact path of that jar file as a Classpath..this will better for a beginner's..way's to create a jar file is
jar -cvf test.jar [package's root directory ex: com\]
try it out
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rajasekaran,
I disagree entirely that constructing and using jar files would be easier for a beginner or even an advanced programmer.
Use of jar files would add another layer of complication to the matter. The packages would still need to be constructed and referenced correctly and classpath settings may still need to be altered.
 
Do Re Mi Fa So La Tiny Ad
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic