I am unable to set up env variables in my machine - maven

What are the steps setting up env variables in my machine?
I used path
Java_Home:C:\Program Files\Java\jdk1.8.0_181;
Path :C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files\Java\jre1.8.0_181\bin;C:\Program Files\Maven\apache-maven-3.6.0-bin\apache-maven-3.6.0\bin
Maven_Home:C:\Program Files\Maven\apache-maven-3.6.0-bin\apache-maven-3.6.0C:\Program Files\Maven\apache-maven-3.6.0-bin\apache-maven-3.6.0
C:\Users\user 2>java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) Client VM (build 25.181-b13, mixed mode)
C:\Users\user 2>mvn --version
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
'cmd' is not recognized as an internal or external command,
operable program or batch file.

Your JAVA HOME should be
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_181
Your MAVEN HOME should be
MAVEN_HOME= D:\Software\apache-maven-3.6.0
Append path variable with following entry
Path :%JAVA_HOME%\bin;%MAVEN_HOME%\bin;

Related

Jasperserver 6.3.0 (Tomcat 8.0.14) startup.bat: Unrecognized option: --JvmMs

As mentioned in the question:
Why can't I start it out of my tomcat\bin dir?
> apache-tomcat\bin\startup.bat
Unrecognized option: --JvmMs
> java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
(It works running it as a service though, there it's started differently: C:\JASPER~1\JASPER~1.0\APACHE~1\bin\tomcat8.exe //RS//jasperreportsTomcat)
(I did not set it up though)
Outcommenting (via rem) the following line in apache-tomcat\bin\setenv.bat did the job:
rem set JAVA_OPTS= --JvmMs 1024 --JvmMx 2048 --JvmSs 2 %JAVA_OPTS%
Since I use it as a test instance, I don't care about the JVM memory settings too much here, but maybe somebody knows the cause and a more appropriate solution?

Could not find JAVA home Elastcisearch

I installed Elasticsearch 6.2,Kibanaandlogstash.
I created a file in bin\elasticsearch\launchELK.cmd, that contain just 2 lines:
set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_161"
elasticsearch.bat
I added on a system variable a JAVA_HOME.
When I write java -version:
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
When I write echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_161
And finally when I run elasticsearch by the file launchELK.cmd, this is the rsult:
bin> lancerELK.cmd
bin> set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_161"
bin> elasticsearch.bat
Le chemin d'accès spécifié est introuvable
could not find java; set JAVA_HOME or ensure java is in PATH
Someone can help me please ?
Thank you
Try setting the JAVA_HOME variable in elasticsearch.bat file then try to start elasticsearch.

Apache Maven install “'mvn' not recognized as an internal or external command” after setting OS environmental variables?

I have Windows 7. I downloaded and unzipped apache-maven-3.3.3-bin.tar.gz.
1) M2 and M2_HOME are under "System variables"
M2 is set to my maven bin folder(ex:C:\Program Files\Java\apache-maven-3.3.3\bin
M2_HOME is set to my maven main directory(ex:C:\Program Files\Java\apache-maven-3.3.3)
2) PATH and MAVEN OPS are under "User Variables"
PATH is C:\Program Files\Java\jdk1.8.0_60\bin; %M2%
MAVEN_OPS set to -Xms256m -Xmx512m
------Things i've tried: restarting, running command prompt as system admin.
Ensure JAVA_HOME environment variable is set and points to your JDK installation.
Update system variables "PATH" : add "C:\Program Files\Java\apache-maven-3.3.3\bin"

Doesn't work macros for environment variables in Windows 7

I have set JAVA_HOME variable
And also I have set path variable:
C:\>set java_home
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_38
C:\>set path
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\To
rtoiseSVN\bin;%JAVA_HOME%\bin;C:\Program Files\apach\apache-maven-3.2.3\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\>
At this way java is not recognized.
Lets change a bit(replace %JAVA_HOME%\bin with C:\Program Files\Java\jdk1.6.0_38\bin):
C:\>set java_home
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_38
C:\>set path
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\To
rtoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_38\bin;C:\Program Files\apach\apache-maven-3.2.3\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
C:\>java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
For this way it is working good.
What do I wrong?
"%JAVA_HOME%\bin" is a perfectly valid directory name. cmd would need to evaluate its value before it could be used.
call set path=%path%
should work for you.
Expansion
path is loaded with the system value, then merged with the 'user' value, when any %var% in the path is replaced by its then-current value. If you add another %var% into the path (like for instance, as a "user" variable) then you need to re-evaluate to resolve the value.
The upshot is: set the path as a system variable, not a user variable if it contains a value to be resolved.

How to set ANT_HOME with Windows?

How can I easily set ANT_HOME under Windows? I added "D:\Installz\apache-ant-1.8.2\bin;" to my system environment variable PATH and I also created an ANT_HOME variable.
In Windows 7 you can go to Control Panel\All Control Panel Items\System or right click on Computer and then to “Advance system setting”
Choose Advanced Tab
Click "Environment Variables" button
In System Variables, click "New" button
Set Variable Name: ANT_HOME and value as {directoryPath}\apache-ant-1.8.2 (Ex: D:\Installz\apache-ant-1.8.2)
Click OK
Either click again on New button if you do not have ‘Path’ Variable in there
OR
Select it and edit by adding the value : %ANT_HOME%\bin;
Click OK
To check if ANT is properly configured - In command prompt, type ant -version
It should give the ant version installed on your machine
I expect you to be running on Windows (since you are using %).
Simply add a new environment variable (Right-click on My Computer > Properties > Advanced > environment Variable) or using SET ANT_HOME=<path> using command line (in that cas, it will only be active on that command line).
Once set you should be able to verify its value by doing echo %ANT_HOME% in command line
The % sign around the variable indicates it is an environment variable.
For linux use the export ANT_HOME=<path> in command line or in your ~/.profile (persistent, require logout/login). Use echo $ANT_HOME for verification.
I had a similar problem of installing JAVA JDK & ANT.
I tried installing JDK this way.
Oracle site --> download JDK setup --> double click on the set up file (on your desktop) --> accept all defaults --> finish.
we need to set environment variable in the deployment system.
mycomputer (right click) --> properties --> advanced settings --> Environment variable --> system variable --> add new --> variable name: JAVA_HOME, Variable path: installation path of jdk on you computer --> click ok, ok.
To check the successful installation of Java .
windows + R --> cmd --> Java -Version
you would see the response as below
C:\Users\PRAX>java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
This shows that you have successfully installed JDK & set an environment variable too.
ANT installation:
download ant file from http://ant.apache.org/bindownload.cgi
choose a mirror & download the zip (zip is the easiest method to set)
unzip the file on your computer --> copy the path (traverse till bin folder).
Now, we need to set an environment variable,
Cmd --> set ANT_HOME = installation path --> press Enter
if you have correctly entered, it wont throw any error.
now execute, echo %ANT_HOME%
you would see the result as your installation path.
your work is done.
you can check the environment variable even in computer properties by default after executing the above set up.
Hope, its useful.
ANT_HOME is the path to your ant installation dir, in your case "D:\Installz\apache-ant-1.8.2"
and JAVA_HOME is java install dir e.g. "C:\Program Files\Java\jdk1.7.0", that's on my machine
On Windows, %% (percent) symbols are used to signify variables.
so to set both variables you can do either
in command prompt, only valid for the session of the particular command propmt
SET ANT_HOME=D:\Installz\apache-ant-1.8.2
SET JAVA_HOME="C:\Program Files\Java\jdk1.7.0"
or
go to System Properties -> Advanced -> Environment Variables and set to new variables
A more flexible solution is to do all that 'environment stuff' in a batch file that starts your ant script, works also when there are no rights to change the environment variables.See a similar question that came up recently for details.

Resources