PATH not working on Mac OS X 10.10.3 - macos

I want to configure maven and wildfly on my local mac computer. in terminal I use zsh shell. so, I input maven and wildfly home in .zshrc file as
MAVEN_HOME="/Users/myuser/Development/maven"
JBOSS_HOME="/Users/myuser/Development/wildfly"
and then
export PATH="$PATH:$JBOSS_HOME/bin:$MAVEN_HOME/bin"
but when I type maven command in terminal, it shows me this response
zsh: command not found: maven
then I put all 3 commands in .bashrc and .bash_profile files. but nothing. even after reboot. what is wrong?

Maven command is mvn, not maven :)

Related

How to use IntelliJ bundled maven in terminal?

Using MacOS Catalina. Installed IntelliJ. Maven works fine but in terminal mvn comand is not found. How to use IntelliJs maven in terminal?
Locating mvn installed using IntelliJ
If you are specifically looking for mvn location, installed using IntelliJ on MacOS: /Applications/IntelliJ IDEA CE.app/Contents/plugins/maven/lib/mvn
Executing mvn from terminal
Now, if you want to execute mvn from terminal, you need to add to your path.
Assuming that you'are using zshrc, which is my case, you'll need to add the following command to ~/.zshrc
export PATH="$PATH:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin"
Now, reopen your terminal, and you can call mvn.
Obs.: Thanks to nbro's answer
Solving "Permission Denied"
If you try to execute mvn and get "Permission Denied", you need to give execution permission:
chmod +x "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/mvn"
In my case, I added the following 2 commands to ~/.zshrc (which is what I am using)
export PATH="/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin:$PATH"
# Otherwise we get a "permission denied"
chmod +x "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/mvn"
Now, I can call mvn from the terminal.
On linux (Ubuntu) when installed by toolbox, it might be something like this:
/home/<username>/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7142.45/plugins/maven/lib/..
In Windows You may find Idea location by env variable
PS > Get-ChildItem env:"Intellij IDEA"
Name Value
---- -----
IntelliJ IDEA C:\Users\unknownuser\AppData\Local\JetBrains\IntelliJ IDEA 2020.3.4\bin;
then use M2_HOME env variable to store related maven path
C:\Users\unknownuser\AppData\Local\JetBrains\IntelliJ IDEA 2020.3.4\plugins\maven\lib\maven3
and use it in the path
%M2_HOME%\bin
Mine under windows is under a weird location:
C:\Users\changeMe\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\222.3345.118\plugins\maven\lib\maven3
Note that on Windows, from a Terminal console using CMD, you can execute mvn command using CTRL+Enter in IntelliJ :
As of the feature description under https://blog.jetbrains.com/idea/2020/07/run-ide-features-from-the-terminal/, this feature is also supported for MacOs with Cmd+Enter.
Run highlighted command using IDE (default shortcut: Ctrl + Enter or Cmd + Enter)
Debug highlighted command using IDE (default shortcut: Ctrl + Shift + Enter or Cmd + Shift + Enter)

Git-bash do not uses my enviroment variables for maven installation

I'm trying to run my maven installation locally from the git bash under windows 7.
With the cmd, everything is working but the git bash use allways the javaversion from \system32\java.exe instead of the regular java installtion from \Java\jdk8\bin\java.exe
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.

Installing Glassfish, Wildfly using homebrew on Mac OSX

Trying to install Glassfish(Java EE App. Server) and Wildfly App Server using Homebrew .
http://macappstore.org/wildfly-as/
http://macappstore.org/glassfish/
used these above mentioned tutorials .
I got the following errors while trying to run them by typing just "glassfish" & "wildfly-as" respectively.
Output(Error):
-bash: glassfish: command not found
-bash: wildfly-as: command not found
Searched about it and I think it has something to do with $PATH. I don't understand $PATH Variable . Need help.
The issue is that there are two asadmin scripts. One at $GLASSFISH_HOME/bin and one at $GLASSFISH_HOME/glassfish/bin
Here are full instructions to get your domain up
brew update
brew install glassfish
you should see message, add that line to your .bash_profile
==> Caveats
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec
Open a new terminal then, cd $GLASSFISH_HOME/glassfish/bin
./asadmin start-domain --verbose
Browse to http://localhost:8080 for welcome page and http://localhost:4848 for admin console
I actually installed Wildfly-Application Server using homebrew but could not find a way to run it.
https://tomylab.wordpress.com/2016/07/03/how-to-install-wildfly-on-mac/
This tutorial helped me .
And for glassfish, my installation was again successful using homebrew but was not able to run it . I did figure it out when I ran the following commands.
$ cd /usr/local/opt/glassfish/libexec/bin
$ ./asadmin
asadmin> start-domain
You need to understand about the PATH variable. It is an environment variable on Unix-like operating systems, specifying a set of directories in which executable programs are located. In general, each executing process, or user session, has its own PATH setting.
So, you need to add the glassfish home path to your actual path variable.
Now, as per your problem with running the Glassfish server; try this:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec/
export PATH=$PATH:$GLASSFISH_HOME/bin
Add it to your bash profile, if you do not want to do this everytime.

Idea's cmd and git bash don't see mvn command

Idea's cmd and git bash don't see mvn command.
If I run this out of Idea it works:
But in Idea's CMD or Bash I see "mvn: command not found"
Why this happens? I set path to C:\Maven\apache-maven-3.5.0\bin.
On Linux it works well.
these are issue with maven path configuration into your system. try to reconfigure the maven, you can also refer this link to configure.
https://www.mkyong.com/maven/how-to-install-maven-in-windows/
Set path as below
export PATH=$PATH:/c/Program\ Files/Java/jdk1.8.0_221/bin:/c/Program\ Files/apache-maven-3.6.1/bin

OSX: env variable is not available

In my gradle project, I am using Dropwizard Crypto for encrypting passwords. I have added the passphrase to IntelliJ env variable and when running "gradlew run" task got the error that can't decrypt.
I have also added the env variable to ~/.bash_profile and run the IntelliJ from terminal and got same error. It works perfectly fine on Windows but on Mac not working (My os is Sierra 10.12)
I have tried running the gradlew run task from terminal and got same error. Any help appreciated.
It should probably be in
~/.bash_profile (with a dot)
or
~/.profile
Try to
export IntelliJ=passphrase
from a terminal session and run gradlew from the same session.

Resources