aspose file tools*
The moose likes Linux / UNIX and the fly likes Java CLASSPATH on linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Java CLASSPATH on linux" Watch "Java CLASSPATH on linux" New topic
Author

Java CLASSPATH on linux

Suranga P. Kulasekara
Greenhorn

Joined: Dec 08, 2008
Posts: 1
HI,I'm new Linux, and I want to know that ,how to set classpath for java permantly on linux.I'm using Oracle Solaris 11.

Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3054
    
  33

Did you try what is given in this page?


Mohamed Sanaulla | My Blog
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

Linux is a Unix-like operating system; Solaris is another Unix-like operating system, but Solaris is not a kind of Linux.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Suranga P. Kulasekara wrote:HI,I'm new Linux, and I want to know that ,how to set classpath for java permantly on linux.I'm using Oracle Solaris 11.



By this I think you mean you dont want to issue the SET classpath command everytime. To do this , you will have to set up your variable either on Environment level or on user level
Note. Setting the variable on user level would require that all users RE_LOGIN to the machine after logout . While on the other hand if you set at the environment level , then your machine will need to be re-booted.

For Environment level . Edit the file /etc/environment and set the java class path . I'll paste a dummy environment file so you can compare yours

Save and close and re-boot the machine.

For User level . Edit the /etc/bashrc ( or the /etc/profile ) and export the java path at the top of the file as follows

Save and close . Now the user for which you have set the variable needs to logout and log back in so that the bashrc file will re-execute for that session.


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

I would be wary of setting Java environment variables in /etc/environment. That file is the basis for every single process on the system. It's better to set them in one of the /etc/profile files (for all users) or one of the individual user's profile files as Mohamed Sanaulla's link instructs.

Incidentally, Solaris is not Linux, in case you were thinking it is. However, the two OS's are similar enough at that level that the same instructions mostly apply to both Solaris and Linux, as well as almost any other Unix or Unix-like OS.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java CLASSPATH on linux
 
Similar Threads
Classpath
Just learning
Class Path in linux
-classpath list
How to set classpath for java in Linux