Problems with maven installation - java

Hi I'm trying to install MAVEN, to my computer using this tutorial, I've set my enviroment variable MAVEN_HOME to point to my maven directory, and I put value of path_to_maven/bin inside another enviroment variable named Path and I get this error message:
C:\>mvn -version
'mvn' is not recognized as an in
operable program or batch file.
I've tried also to use PATH instead of Path but that doesn't solve it, what else can I do? I'm using windows 7..

Go to path_to_maven/bin and type mvn -version. If that works then it's a PATH problem.
In MS-DOS's prompt type set PATH=path_to_maven/bin;%PATH%

You may need to restart your computer for the changes to PATH to take effect.

I had a similar problem while configuring maven.
I've installed Maven 2 on my computer and I had problems when invoking mvn --version from cmd.
I've set the M2_HOME and M2_REPO environment variables and I have added to the system variable PATH the path_to_maven/bin.
In order to be able to invoke mvn from cmd I had to add still another environment variable named PATH with value path_to_maven/bin.
I hope this will help anyone caught in this issue.

If it helps someone:
Try to add the entire directory path in the PATH variable instead of using the referrals like %M2%.

Close the Command Prompt and then re-open it again.
Hit the command mvn -version. It should work if the environment/system variables are set properly.

Related

java is not recognized as an internal or external command, variables are set already

After setting JAVA_HOME to C:\Program Files\Java\jdk1.8.0_171 and adding %JAVA_HOME%\bin to my path, I am still getting this error. I have checked that the path is correct multiple times and every solution online just says to add these two variables. Is there any other step to fix this?
I'm getting this error when trying to run "java -jar start.jar" for solr.
You have not added Java Location as the Path variable in your system. The Command Prompt or Powershell can only take you to the path/paths you have already specified.
Add "C:\Program Files\Java\jdk1.8.0_171\bin\" to the Path variable in your Advanced System Settings->Enviroment Variables->Path.
Make sure you run the command in a new DOS shell. If you are using the same one you ran the java command in before setting the path, it won't have the path update.
Don't type path manualy - choose path by [Browse directory] button.
Path looks the same but can be different (maybe encoding of signs)

Even when I defined the class path, javac is not recognizing it

I am using Windows 7 and 8 in my PC .
I have installed jdk 7 and created class path for bin as it should be. But when I enter javac in the command prompt, it throws an error:
`javac is not recognizing as internal and external`.
I have searched for a solution in many websites but nothing could solve my problem.
Would you please help me and suggest where my mistake could be?
You need to set the environmental variables. Run sysdm.cpl from run dialog box to open advanced system properties.
In the environmental variables, add a new one like in this dialog.
Name : JAVA_HOME
VALUE: C:\Program Files\Java\jdk1.7.0_21\
Now edit the value of the PATH variable and add ;%JAVA_HOME%\bin\; at the end of it's value.
Now, restart your system and you can run java related commands from command prompt.
also set path in your *System variables:path=c:/..../jdk/bin/;c:/..../JRE/bin;.;
user Variables:CLASSPATH=c:/..../jdk/bin/;c:/..../JRE/bin;.;
Double check your system variable "Path" on System Properties appending %PATH_TO_JDK%\bin. Don't forget to restart the command prompt after.
It is path not classpath - -till your bin folder
and restart cmd

Cannot get Maven working on Windows 7 [duplicate]

I just installed Maven and added the \bin directory of maven to my path variables. When I try to use the mvn command in the Command Prompt I just get a message:
mvn: command not found
Everything else I found on here did not help yet.
Edit:
I used https://maven.apache.org/install.html to install maven.
SET PATH=%PATH%;C:\Program Files\Maven\apache-maven-3.5.0\bin\mvn.cmd
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
You have included the file in the path:
C:\Program Files\Maven\apache-maven-3.5.0\bin\mvn.cmd
That is not good. The PATH environment variable should only include a path to where files, like exe and cmd's can be found.
Adapt your PATH to read like this:
C:\Program Files\Maven\apache-maven-3.5.0\bin
(so remove the \mvn.cmd). Make sure to start a new command prompt to verify if your path settings are correct.
See How can I set user environmental variables (such as PATH) from a non-administrator account on Windows 7 to find the correct Windows dialog to adapt the settings among many more.
Following this tutorial by mkyong, I was able to get this to work on Windows 10 (v10.0.15063):
Install JDK and setup JAVA_HOME system variable
Download Maven zip, extract it and setup M2_HOME and MAVEN_HOME system variables to point to root maven folder (without \bin)
Update PATH system variable to include %M2_HOME%\bin (this is what will let you run "mvn" in Command Prompt).
Open Command Prompt (cmd.exe) and execute mvn -version
You can download Maven (apache-maven-3.5.0-bin.zip) here, if you don't have it already.
The Java SDK (jdk-8u144-windows-x64.exe) can be downloaded from Oracle here.
This is my working maven configuration on Windows 10. Was more cumbersome to configure on W10 than on WXP or W7.
I've faced the same problem. I installed Maven and added the \bin directory of maven to my path variables in System Variables, so I can only use MAVEN commands using admin rights (run cmd in windows as administrator)
I solved this by creating all under User variables (including the PATH variable).

Javac Command Not Working

My javac command is not working.
"javac is not recognized as an internal or external command, operable program or batch file."
-java version WORKS
I've tried setting classpath successfully in command prompt. SET CLASSPATH "C:\Program Files\Java\jdk1.7.0_09\bin";
Ive adding it in environment variables. ;C:\Program Files\Java\jdk1.7.0_09\bin ;C:\Program Files\Java\jre7\bin
Ive checked the bin folder java.exe is there aswell as javac.exe.
^ Tried all of these still doesn't work. I've also restarted command prompt still does not not work.
Why is not working?
You're using the correct path apparently, but you should assign it to the PATH variable, not to the CLASSPATH variable.
You're trying to set the access path to the executable files, not to the class files.
Just do this
In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK,
e.g. C:\Program Files\Java\jdk1.5.0_02 and that %JAVA_HOME%\bin is in your Path environment variable.
Just set JAVA_HOME to
C:\Program Files\Java\jdk1.7.0_09
After adding the path to the jre7\bin-Folder to the PATH-Variable, you need to restart your Computer in most cases.
Did you tried to create a JAVA_HOME variable? The value should be the path of the java without the bin.
Also, try to open Eclipse.
If nothing helps, the last thing that you can do is install netbeans, it will configurate everything.

Problems setting up Maven [duplicate]

This question already has answers here:
Adding a directory to the PATH environment variable in Windows
(21 answers)
Closed 8 years ago.
I am having difficulties installing Maven.
I have set all the enviromental variables according to this: http://maven.apache.org/download.html
Although I am using windows 7, when I try and run the command mvn --version, I get, mvn is not recognized as an internal or external command etc.
When I run it from within src\bin, I get the error:
Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
at java.net.URLClassLoader$1.run<URLClassLoader.java:202>
at java.security.AccessController.doPrivleged(Native Method)
...etc
then:
Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher.
Check that you don't have an M2_HOME environment variable.
I ended up on this question with the same problem, however, I had committed an elementary mistake of downloading the apache-maven-..*-src.zip instead of the apache-maven-..*-bin.zip
Once I realised that mistake, it was smooth sailing as soon as I corrected it. I suppose the instructions on the download page should be more than adequate
All you should need to do to install and use maven:
1) Download maven 3. The ZIP should be fine. Install it in a known place; I use c:\tools\ as the parent directory but your mileage may vary.
2) Set your PATH to point to the bin directory in the installation directory. If Maven is in c:\tools\maven-3.0.3 (as it is on my system), you'd add c:\tools\maven-3.0.3\bin to PATH:
set PATH=%PATH%;c:\tools\maven-3.0.3
You may also want to set MVN_HOME:
set MVN_HOME=c:\tools\maven-3.0.3
3) start a new command shell (cmd.exe). mvn should work; if not, you've skipped something here or something's badly wrong in your configuration.
blanking out M2_HOME worked for me on Ubuntu. Can test with just: 'export M2_HOME='
Your first problem is because you do not have maven in your PATH.
The second problem is what I had. I had both Maven 2 and 3 on my computer and even though I removed Maven 2 links from my PATH, it was still interfering with my new Maven.
You need to remove or rename the system variable M2_HOME.
1. Right click My Computer -> Properties
2. Advanced system settings
3. Environment Variables
4. Rename or delete M2_HOME
I setup M2_HOME like this:
export M2_HOME="~/app/apache-maven-3.1.1"
and saw the same exception:
Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher`.
I changed to use absolute path and it worked:
export M2_HOME="Users/myaccount/app/apache-maven-3.1.1"
In my case, the M2_HOME env variable wasn't the problem. I think that java and/or mvn startup script doesn't expand the tilde in classpath cmd line args.
This is a question from long ago but recently i encountered this problem. In my case it was because i had M2_HOME set from a previous installation from months ago. I just unset the variable and after that was good to go.
I got the same error
In my case configuration which generate error
export M2_HOME="/home/ashoka/apache-maven-3.0.4/bin/"
PATH=$M2_HOME/bin:$PATH
Working configuration
export M2_HOME="/home/ashoka/apache-maven-3.0.4/"
PATH=$M2_HOME/bin:$PATH
Ashok Kumara
"mvn is not recognized as an internal or external command etc." means you haven't set your environment variable in windows. Read the whole http://maven.apache.org/download.html :-)
Do you have maven 2 also installed?
I found one link in searching, see if it helps
http://blogs.oracle.com/sreekanth/entry/java_lang_noclassdeffounderror_org_codehaus
and also double check your environment variables to make sure you have set all the variables mentioned in the doc.
For this error "mvn is not recognized as an internal or external command", add src/bin folder in 'path' environment variable.
Like Joseph Ottinger said, you have to put Maven installation directory to your PATH environment variables or User variables. You can edit user variables by running command "rundll32 sysdm.cpl,EditEnvironmentVariables" without quotes.
First add new variable called MAVEN_HOME and for it's value Mavens installation directory ie. c:\tools\maven-3.0.3\ then edit PATH variable and add end of the value ;%MAVEN_HOME%\bin (notice semicolon)
After re-login or opening new command prompt mvn command should work perfectly.
Some people seem to have trouble with adding Maven bin folders to the System PATH vs the User PATH. You could try defining your environment under your User variables, but this would be more of a workaround than a solution.
PATH=%PATH%;%JAVA_HOME%\bin;%JRE_HOME%\bin;%MAVEN_HOME%\bin
You can diagnose these access errors with Rapid Environment Editor, which will tell you if certain PATH locations are invalid or inaccessible to you.

Categories

Resources