• 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:

how to set classpath

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to set the class path in linux

Regards
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in a shell script:



on the command line...



to test:



cheers


philip
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To set an environment variable persistently, edit the file named .profile in your home directory and put the export command there.
 
Saloon Keeper
Posts: 28667
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic