Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is this writting for JAVA_OPTS correct?

 
Thomas Chang
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Jboss AS is installed on Linux. I see in the file jboss followings. I am not sure if the definition writting for JAVA_OPTS correct or not





I think it should be followings:


The difference is the position or usage of "

Which one is correct?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither. It should be:



Always put the quotes around everything after the equals sign when setting env vars in Linux
 
Thomas Chang
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:Neither. It should be:



Always put the quotes around everything after the equals sign when setting env vars in Linux


But I use the followings and it works.

 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas Chang wrote:But I use the followings and it works.



It may work in some cases, but it is highly dependent on the value. If the values have no spaces (or other special characters), it can work. If the values have spaces it will break.

If you don't understand why, you should get a book on UNIX Shell Programming, as it will cover how to set environment variables, and why you need to quote them. For now, if you want it to work all the time, you need to do as Peter said. It is the only correct way to do it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic