i configured maven home in uservaribles and tested it using the command mvn --version ,system proment me as "mvn is not a command" . But if i configure it to System variables its working. i did configuring to system variables in my laptop. But at my office i dnt have previlage of changing system variables.
Here my question is.
a) Why system recognises when it is configured from system variable but not in user variables
b) is there any alternative to configure it and work smoothly at my office laptop.
well what I did at my job (I was having the same problem) is making a user variable that's called PATH, to the binaries. And then it seems to work here.
Right click my computer
Click on properties
On the left you will find advanced system settings (windows 7). Click on it
Then go to the tab Advanced and click on Environment Variables
Now create a new user variable with the name PATH and the value, is the path to your maven installation. (eg: C:\maven\bin)
Related
I tried setting an installer variable with a custom script, but then noticed that the 'Directory name' and 'Custom base directory' fields in the media wizard do not accept installer variables.
I also tried not using the 'Custom base directory' option in the media wizard, and setting the sys.installationDir variable with a custom script just before the 'Installation location' screen, but it seems like that screen computes the install dir based on the media wizard settings.
Context: We build a production and a test installer. The prod version should suggest to install in sys.programFilesDir. The test installer does not request privileges and should suggest to install in the user home.
A compiler variable is defined to distinguish between prod and test version.
Never mind, setting the sys.installationDir after the Welcome-screen but before the Installation location-screen does seem to work after all.
The Only if undefined-option needs to be unchecked, because the Welcome-screen seems to always initialize this variable. Unfortunately this means that for upgrade installations where the user opts to choose a new install dir, this script also runs and will not show the previous install dir (seems to be an ok trade-off).
I know this is SUPER basic. I am very new to all of this. I tried to download java and run a helloworld by following these instructions: https://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html
I got an error when I tried to use the "javac" command to compile. This is what appears in the command prompt:
C:\Users\USer18\Desktop>javac HelloWorldApp.java
'javac' is not recognized as an internal or external command, operable program or batch file.
Does this mean I downloaded java incorrectly? When I downloaded it, there were 3 different things to choose from, but I could only choose one, so I chose the first one. I tried to download java again and select the second one, but it said it didn't work.
Thanks in advance for helping me!
From the tutorial you linked, it tells you to "consult the installation instructions" found here: https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html
For Windows JDK, the instructions linked are here: https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jdk_install.html#CHDEBCCJ
The part you need to look for is "Updating the PATH Environment Variable"
Updating the PATH Environment Variable
If you do not set the PATH variable, you need to specify the full path
to the executable file every time you run it, such as:
C:> "C:\Program Files\Java\jdk1.8.0\bin\javac" MyClass.java
It is useful to set the PATH variable permanently so it will persist
after rebooting.
To set the PATH variable permanently, add the full path of the
jdk1.8.0\bin directory to the PATH variable. Typically, this full path
looks something like C:\Program Files\Java\jdk1.8.0\bin. Set the PATH
variable as follows on Microsoft Windows:
Click Start, then Control Panel, then System.
Click Advanced, then Environment Variables.
Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value
for the PATH variable:
C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0\bin
Note:
The PATH environment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks
for programs in the PATH directories in order, from left to right.
You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.
If you are not sure where to add the JDK path, append it.
The new path takes effect in each new command window you open after setting the PATH variable.
When ever we execute any command, it is searched in the directory where we are current in or mentioned in PATH environment variable. The oly thing which you need is just add <path of yourjdk>\bin to PATH
Windows 10 and Windows 8
In Search, search for and then select: System (Control Panel)
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
Windows 7
From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click the Advanced system settings link.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
Reopen Command prompt window, and run your java code.
I've searched around a bunch and could not find an answer that could help me.
I get this message when building my Ionic project for Android. I have verified, that both java -version and javac work in the folder, so both are accessible via the %path%.
What can I do to resolve this, and did I miss something?
I'm not familiar with Ionic but apparently it is not using %PATH% , it is using %JAVA_HOME%. You need to set it.
Determine the directory of a Java JDK (not JRE) in your system. It could be something like C:\Program Files\Java\jdk1.8.0_65. Since javac responds, you must have a JDK in the path somewhere. This directory will be the value for JAVA_HOME. (NOTE: This is not the same as the Java bin directory in the path! There should not be a bin on the end of the directory.)
Open the System page in your Control Panel.
You can do this in various ways:
Open an Explorer window, right-click on This PC and click on Properties in the menu.
Open Control Panel, click on System and Security, click on System.
Click on Advanced System Settings.
The System Properties window opens. Select the Advanced tab.
Click on the Environment Variables... button.
The Environment Variables window opens. Look at the bottom section labeled System Variables. You should see a variable named JAVA_HOME in the list. If you have this variable, double-check that the directory in the value exists and is a valid JDK directory.
If you don't see JAVA_HOME in the list, click the New... button. If JAVA_HOME is there but it's the wrong value, select JAVA_HOME in the list and click the Edit... button.
The New System Variable or Edit System Variable window will open (they look about the same.) Enter "JAVA_HOME" for variable name and the JDK directory for variable value. You can use the Browse Directory... button to make sure you have a valid directory for the value.
Click the Okay button on the New/Edit System Variable window, then the Environment Variables window, and then the System Properties window.
You will need to log out and log in again for the JAVA_HOME variable to take effect.
I have downloaded a .jar file and it won't run on my computer. I have installed Java RE 5.0 and have Java 7 update 72. Every time I double click on the file it pops up and closes.
I have reinstalled the java re and java 7u72 and still no success.
Any help with running executable .jar file on windows 7?
By default, java does not run in windows mode, maybe it's just a console java program.
The .jar file must have a lib folder in the folder the .jar is in to open a window (without using native java libraries). If it doesn't, then the .jar won't open any windows, as it needs external libraries to do so.
However, if your .jar isn't meant to open any windows, then it has been performing as expected. Try running your .jar from the command line:
java -jar <jar-file-name>.jar
Have you checked the Environment Variables? Maybe the variable PATH is not specified. Besides, you can try this:
Start - "Control Panel"
Click on "Default Programs"
Click on "Associate a file type or protocol with a specific program"
Double click on the .jar
Browse C:\Program Files\Java\jre7\bin\javaw.exe
Click on the button Open
Click on the button OK
If it doesn't work, try to configure the Environment Variables:
From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
Note: You may see a PATH environment variable similar to the following when editing it from the Control Panel:
%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
Variables enclosed in percentage signs (%) are existing environment variables. If one of these variables is listed in the Environment Variables window from the Control Panel (such as JAVA_HOME), then you can edit its value. If it does not appear, then it is a special environment variable that the operating system has defined. For example, SystemRoot is the location of the Microsoft Windows system folder. To obtain the value of a environment variable, enter the following at a command prompt. (This example obtains the value of the SystemRoot environment variable):
echo %SystemRoot%
More info here
Hope it helps.
Clemencio Morales Lucas.
Hi I have set the environment variable for java in windows.
when I type java in cmd, it works,but when I type javac ,it doesn't work saying javac' is not recognized as an internal or external command,
Doing Path="C:\Program Files\Java\jdk1.7.0_09\bin works but when I close the command prompt and reopen again same error.
Is there anyway out to set this permanently.
You can add C:\Program Files\Java\jdk1.7.0_09\bin to your path using the System Control Panel in Windows.
Go to Control Panel -> System -> Advanced System Settings -> Environment Variables...
Find Path, and edit it to add your jdk path.
It sounds like you simply setting the PATH variable of the current session. What you need to do it go to "Computer/My Computer", right click and select "Properties". From there click "Advanced System Settings" and then the "Environment Variables button. Navigate to the PATH variable and append to the end of the string. Directory paths must be separated by a semi-colon.
All of the variables in this section are loaded each time a new process is launched. You can also add a default CLASSPATH variable here and include all of your go-to jars.
Recently I have faced this problem and my finding is for Windows 7 adding javac to the "path" environment variable works but for windows 10, you can do anything means Add a new environment variable or update the existing one.