This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classpath

 
Romka Abcd
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where can i find this thing and how can i add *.jar file to it...
please give me an example, i really need it.
 
Richard Jensen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Romka Abcd:
where can i find this thing and how can i add *.jar file to it...
please give me an example, i really need i

CLASSPATH is typically an environment variable that is set by a script (or batch file). How you find its current value and change it depends on the operating system. For example on Windows 2000 I can examine the value with: and on Unix I might do something like env | grep CLASSPATH.
You can also tell java to use a particular value for CLASSPATH by invoking it with -cp or -classpath. You would then supply the classpath values separated by the appropriate delimiter (';' on Windows) like so:
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the simplest ways to import JAR archives into an application is to add the -classpath attribute (correct term?) on the command line when invoking the JVM for the application. For example:
java -classpath %1;%2;%3; MyClass.java
Where your replace %1, %2 and %3 with your jar file list, directories, or zip archives. The Java runtime will load classes from any of these location as and when required.

The other way (which is more permanent) is to set an environment variable called CLASSPATH under your operating system's architecture.
On Windows, you could do this by opening up the Environment Variables system property (Windows NT, 2000 or XP), or by using the parameter set CLASSPATH=... in the autoexec.bat file (Windows 9x).
Under Linux/Solaris, you need to refer to your particular implementation's documentation regarding the shell files (*.csh and *.sh files) and setting environment variables (env).
[ June 09, 2003: Message edited by: Charles Lyons ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic