while using unix I got java : command not found error. So I referred to this stack overflow post Java command not found on Linux. But when i gave the path of Java as suggested in the answer of the above post (C:\Program Files\Java\jdk1.6.0_41\jre ), i got export: `FilesJavajdk1.6.0_41jre': not a valid identifier. Could anyone please help me out here.
Asked
Active
Viewed 3,864 times
0
-
3Directories and paths on Linux work differently than on Windows. `C:\Program Files\...` is a Windows path, that is not going to work on Linux. – Jesper Oct 24 '14 at 07:45
-
That answer was for windows obviously. You need to locate java in your system. try `find / -name java` – talex Oct 24 '14 at 07:46
-
1You will have to remove the dots in ` jdk1.6.0_41jre . Better change the it to `jre6` – Aditya Singh Oct 24 '14 at 07:48
-
Where do you see `c:\Program Files` anywhere in the post you've linked to? Fundamentally it sounds like Java probably isn't installed on your machine... – Jon Skeet Oct 24 '14 at 07:54
-
The StackOverflow post you linked to has no mention of anything in 'C:Program Files'. Are you sure you are on Unix, and if so, what happens if you follow the actual advice in that post (update alternatives)? – RealSkeptic Oct 24 '14 at 07:54
-
Removed the dots. Guess what!! it's working. Thank you all for your time, appreciate it. – TheNightsWatch Oct 24 '14 at 07:54
1 Answers
0
you can set the path in this way
JAVA_HOME="C:\Program Files\Java\jdk1.6.0_41" export JAVA_HOME export PATH=$JAVA_HOME/bin:$PATH
the problem is coming because of the space between Program and Files
-
1Welcome to SO! Please note, that your answer is mixing up Unix and Windows. A syntax like `$JAVA_HOME` and the `export` command exist in Unix shells only, whereas a directory structure like `C:\Program Files\...` is Windows specific. – ahuemmer Aug 26 '22 at 08:33