• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Classpath for new package

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I am a complete begginer so hold back the abuse for now

I have downloaded a new package called javabook. I am using a new text book (author = Wu), in which they use a package that i need to download.

My classpath is .;C:\j2sdk1.4.2_04\lib\tools.jar

Where do i put the javabook package so that i can use it in my programs.

Thanks

Kap
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Kay,

Where do i put the javabook package so that i can use it in my programs.



Just put your jar in your classpath

The simplest way to set up the classpath is :

javac -classpath /mypackagename/javabook.jar ...

Note that javac required that your jar must be in /mypackagename directory.

You may take a look at this article to quickly understand how classpath works.

Hope that helps,
 
Kay Kumar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
posted February 28, 2005 05:04 AM
--------------------------------------------------------------------------------
Hi there,

I am a complete begginer so hold back the abuse for now

I have downloaded a new package called javabook. I am using a new text book (author = Wu), in which they use a package that i need to download.

My classpath is .;C:\j2sdk1.4.2_04\lib\tools.jar

Where do i put the javabook package so that i can use it in my programs.

Thanks

Kap
--------------------------------------------------------------------------------
Posts: 1 | Registered: Feb 2005 | IP: Logged

Lionel Badiou
ranch hand
Member # 89965
posted February 28, 2005 05:24 AM
--------------------------------------------------------------------------------
Hello Kay,


quote:
--------------------------------------------------------------------------------
Where do i put the javabook package so that i can use it in my programs.
--------------------------------------------------------------------------------



Just put your jar in your classpath

The simplest way to set up the classpath is :

javac -classpath /mypackagename/javabook.jar ...

Note that javac required that your jar must be in /mypackagename directory.

You may take a look at this article to quickly understand how classpath works.

Hope that helps,
--------------------


Rite

So do i add another classpath which is

.;C:\j2sdk1.4.2_04\javabook.jar

Is that rite?

Or, would i just add as below
.;C:\j2sdk1.4.2_04\lib\javabook.jar

Sorry if being very thick
 
Lionel Badiou
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Kay,

You have two ways to set up a classpath :

1 - Specify classpath to the javac compiler (through the -classpath option)
2 - Set classpath at system level (that implies to modify an environnement variable of your operating system). This is the variable you mentionned in your posts.

I suggest you to use the first method this way :
javac -classpath %CLASSPATH%;pathToMylibs\javabook.jar pathToMyCode\myCode.java

(assuming windows os)

This command line compiles myCode.java and sets the classpath to the system classpath + javabook.jar (a .jar file should be considered as a directory). Doing this, myCode.java may use javabook.jar methods.

Check out this article for details.

Hope that helps,
 
Kay Kumar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks

I'l give it a go.

If i get stuck il give you a shout.

Thanks again
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may also want to take a look at "How to Set the CLASSPATH" in our FAQ.

Layne
 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic