File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes how to set classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "how to set classpath" Watch "how to set classpath" New topic
Author

how to set classpath

priya pillai
Ranch Hand

Joined: Sep 12, 2007
Posts: 57
How to set the class path in linux

Regards
Philip Thamaravelil
Ranch Hand

Joined: Feb 09, 2006
Posts: 99
in a shell script:



on the command line...



to test:



cheers


philip
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

To set an environment variable persistently, edit the file named .profile in your home directory and put the export command there.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

There isn't a "the" class path. CLASSPATH (all uppercase) is the shell environment variable name that Sun designated for the Java runtime to access in order to get the list of class sources.

Each Linux command shell instance has its own variable environment, although it may simply be a copy of its parent, depending on how that shell was spawned.

Depending on which shell you're using and what implementation of Linux or Unix you're working with, there are multiple places you can setup a "master" CLASSPATH. I normally use bash and set it up per-user, so I define my CLASSPATH in ~/.bash_profile.

Since CLASSPATH is an environment variable, you can set it inside a given shell session to a new value at any time or unset it entirely. That will only affect that shell session unless you export the change out to the shell's parent.

Note that when you invoke a script, it normally creates a new shell instance, so whatever CLASSPATH you set there won't reflect back to the caller unless you export it.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
jQuery in Action, 2nd edition
 
subject: how to set classpath
 
Similar Threads
Email
Can't find class weblogic/ejbc
set the classpath......
To set the F1 key as shortcut for menuitem Help
JNDI error message