This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to change the path of java installed folder?

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am learning hadoop. on my windows system java is installed at C:/Program files/Java, but the problem is i believe the white space in 'Program files' when i run a namenode -format code it give the following error.

so is there any way by which i can change the java folder location to C:/Java from C:/Program files/Java , without ofcourse uninstalling and reinstalling. i am pretty sure that my environment variables are set correctly. Thanks.
 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think white space in path will create a problem in Windows.
If your Java bin path is set in "path" and "java -version" gives you the correct output, I do not think white space is an issue.

Anyway you can logically change the installation path by creating a softlink (using mklink command). The new path will act as a short cut for existing path.

bin/hadoop: line 350: C:\Program Files\Java\jdk1.7.0_71/bin/java: No such file or directory


Here some of the slashes are forward and some are back slashes. Why is it so?
 
akshay naidu
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops! typing mistakes. tapas
 
Tapas Chand
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

akshay naidu wrote:oops! typing mistakes. tapas


It is good to copy/paste the codes/error messages.
Otherwise people who try to give some solution will not be able to track the cause.
 
akshay naidu
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey, no, thats not typing mistake. i pasted it as it is.
i just checked my path in env variable, its correct there - C:\Program Files\Java\jdk1.7.0_71\bin
let me just check the problem. thanks for pointing out a foolish mistake tapas
 
akshay naidu
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
copy pasting the java folder to C:/Java from C:/Program files/Java and updating the environment variables with new path worked fine for me. but i still would like to know if there are any more ways to do this. thank you.
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

akshay naidu wrote:copy pasting the java folder to C:/Java from C:/Program files/Java


That feels so wrong... When you install Java on Windows, it doesn't just store files on disk, it also puts some entries in the Windows registry. Those are now missing.

I would advise one of two ways:
1) uninstall Java and reinstall it in the other folder.
2) use mklink as already suggested.

The second one is probably easier. First, remove the existing C:/Java. Then enter the following in a command window:
 
akshay naidu
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

2) use mklink as already suggested.


can you explain what will this do ?
thanks
 
Tapas Chand
Ranch Hand
Posts: 624
9
BSD Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

akshay naidu wrote: can you explain what will this do ?


mklink command creates a short cut to an existing directory/file.
For more information go to http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/";" target="_new" rel="nofollow">this link
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic