This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of TensorFlow 2.0 in Action and have Thushan Ganegedara on-line!
See this thread for details.
Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Set classpath on Debian Linux

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've installed JDK1.5.
I try to set classpath use "export", but it only work on the current console.
When I restart or open another console, the JDK path can't be found.
I used to install JDK on RedHat Linux, there is a file /etc/profile. I can insert my Java Path here. But in Debian, the profile looks like this:


How to set Path in Debian? Thank you in advance.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Linux/Unix forum.
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Before the path is exported, try:

PATH=$PATH:/path/where/jdk5/is/installed/bin

Nart
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to do this is to add a line at the end of /etc/profile to add more paths to the PATH variable. However, this is undesirable because it changes the PATH for every user. If you only have a single user on your machine, then it probably isn't too bad. A more elegant solution is to modify your user's .profile instead. Another option is to modify the rc script for the shell you use. For example, if you use bash, then you can modify .bashrc in your user's home directory to set the PATH the way you want it.

I hope this makes sense. If not, let me know and I will provide more details.

Layne
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It still can't work.
Now my .bashrc looks like this:


The result is
"louis@debian:~$ java
bash: java: command not found
"
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works when I set the Path like this!

I think the "$" here is very important.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a bash script $ means to use the value of a variable. Without the $, the name is not evaluated. In other words, the name just stands for the literal characters. This means that on the left of the = sign, you typically want the variable name without the $, but on the right, you need the $ to get a variable's value rather than the exact characters you typed.

Also, the word "export" is important for the variable's value to last beyond the script's execution. Without the "export", the variable is "local" to the script, so to speak.

Layne
 
You have to be odd to be #1 - Seuss. An odd little ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic