• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java CLASSPATH on linux

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try what is given in this page?
 
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
Linux is a Unix-like operating system; Solaris is another Unix-like operating system, but Solaris is not a kind of Linux.
 
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Saloon Keeper
Posts: 27762
196
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
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.
 
Wanna see my flashlight? How about this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic