echo %JAVA_HOME% works in cmd, but not in git bash
Turns out, git uses a completely different syntax to do echo.
I had been doing echo %JAVA_HOME%
when I should have been doing echo $JAVA_HOME
.
I couldn't see that I was supposed to be using $ and not % sign because the symbols looked so similar in my font. I only found out after copy/pasting an answer out of frustration into bash and having it magically work when it hadn't worked prior.
But yes, the answer is to use $
and not %
because they mean completely different things. Git bash uses $, command prompt uses %. You'd think they'd just use the same symbol to get the job done.
Git-bash do not uses my enviroment variables for maven installation
Put the following into a file named .bash_profile
into your home folder (like you would on a UNIX system):
export M3_HOME=/c/ECG/Maven/mavenCurrent
export JAVA_HOME=/c/ECG/Java/jdk8/jre
PATH=$JAVA_HOME/bin:$PATH
You may also want to add more environmental variables and path entries this way, depending on what you need to run your system.
Why can't Git Follow my Java JDK installation path?
Are you sure you need to set the actual JAVA_HOME variable? If I remember correctly, for git bash it looks at the $PATH variable for the java version. Maybe try appending your java location here.
also, to double check (sorry if you already know this), you can run the env command to list all your environment variables.
$ env
Try setting the path and run the java -v command to verify the installation is correct. If not, what is the exact error?
$ java -v
Edit
Some more info, to set the $PATH in git windows I think you have to update your $HOME. See this or some other posts (google) for an explanation
Git for Windows: .bashrc or equivalent config files for Git Bash shell
Set an environment variable in git bash
A normal variable is set by simply assigning it a value; note that no whitespace is allowed around the =
:
HOME=c
An environment variable is a regular variable that has been marked for export to the environment.
export HOME
HOME=c
You can combine the assignment with the export
statement.
export HOME=c
Extend $PATH variable in git bash under Windows
Here are two ideas.
You can have your path with double quote mark.
export PATH=$PATH:"/C/Program Files (x86)/apache-maven-3.3.3/bin"
Or, You can also make symbolic link for the directory.
ln -s "/C/Program Files (x86)/apache-maven-3.3.3/bin" ./mvnbin
export PATH=$PATH:/your-path/mvnbin
It works for me in mingw32 environment.
BeanUtils copyProperties API to ignore null and specific propertie
If you want to ignore null
-value you have to do it with the following line of code before copying properties:
BeanUtilsBean.getInstance().getConvertUtils().register(false, false, 0);
Related Topics
Selenium Chromedriver Opens a Blank Page Instead of Url on Linux
Search Particular Column Value from CSV File Using Java
Spring Boot Controller Not Mapping
How to Find Out the Exact Requested Url in Servletrequest If That Url Contains Path Variables
Javac Option to Compile All Java Files Under a Given Directory Recursively
Refreshing Existing Windows in Java Swing
Enable Jackson Deserialization of Empty Objects to Null
Use Only One Bufferedreader Object to Read Multiple Files in Java
I Want to Get Time Difference Between Two Time in Milisecond
How to Map an Auto Increment Field in Hibernate
How to Exit an Android App Programmatically
Java Error - Illegal Modifier for Parameter - Only Final Permitted
How to Change Cookie Processor to Legacycookieprocessor in Tomcat 8
Check If Two Objects Are Equal Excluding a Few Properties
Hibernate Error - Querysyntaxexception: Users Is Not Mapped [From Users]
Remove Keys from Anywhere in a Json String Without Deserialization