I’m trying to make my first app using Phonegap and I got this while running in command
Any help would be greatly appreciated Thank you
2 Answers 2
You have to do two things to get it fixed.
Firstly go to My Computer right click open properties and open Advanced System Setting and then open Environment variables. Open the Path variable and insert a semicolon at the end and add the path of your bin folder of your jdk it will be something like C:/Program Files/Java/ Jdk X.Y/bin save and close it.
Secondly create a new system variable named JAVA_HOME and in its value write C:/Program Files/ Java/ Jdk X.Y save and close and now retry by writing the create command
P.S find the version number go to your java folder and copy those version number hopefully this will help
If you do not already have the JDK software installed or if the JAVA_HOME environment variable is not set, the GlassFish ESB installation will not be successful. The following tasks provide the information you need to install the JDK software and set JAVA_HOME on UNIX or Windows systems.
To find out which JDK versions are supported for the platform you are using, see JDK and JAVA_HOME in Planning for GlassFish ESB Installation .
The GlassFish ESB Installer does not support JDK release 1.6.0_04 in the 64–bit version on the Solaris SPARC or AMD 64–bit environments.
To Install the JDK Software and Set JAVA_HOME on a UNIX System
To install the JDK software, do the following:
Select the appropriate JDK version and click Download.
The JDK software is installed on your computer in the default location; for example, at /usr/jdk/jdk1.6.0_02. You can change this location.
To set JAVA_HOME, do one of the following:
For Korn and bash shells, run the following commands:
export JAVA_HOME= jdk-install-dir
For the bourne shell, run the following commands:
For the C shell, run the following commands:
setenv JAVA_HOME jdk-install-dir
setenv PATH $JAVA_HOME/bin:$PATH
Change the permissions to enable you to run the GlassFish ESB Installer by running the following command:
chmod 755 JavaCAPS.bin
To Install the JDK Software and Set JAVA_HOME on a Windows System
To install the JDK software, do the following:
Select the appropriate JDK software and click Download.
The JDK software is installed on your computer in the default location; for example, at C:Program FilesJavajdk1.6.0_02. You can move the JDK software to another location.
To set JAVA_HOME, do the following:
Right click My Computer and select Properties.
On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:Program FilesJavajdk1.6.0_02.
What is JAVA_HOME?
By convention, JAVA_HOME is the name of an environment variable on the operating system that points to the installation directory of JDK (Java Development Kit) or JRE (Java Runtime Environment) – thus the name Java Home. For example:
Why is JAVA_HOME needed?
To develop Java applications, you need to update the PATH environment variable of the operating system so development tools like Eclipse, NetBeans, Tomcat… can be executed because these programs need JDK/JRE to function. So the PATH environment variable should include JAVA_HOME :
Other paths are set by various programs installed in the operating system. If the PATH environment variable doesn’t contain a path to JRE/JDK, a Java-based program might not be able to run. For example, typing java in the command prompt showing this error:
Or Eclipse will fail to launch:
How to set JAVA_HOME on Windows 10
Here are the visual steps to properly set value for the JAVA_HOME and update the PATH environment variables in order to setup Java development environment on your computer:
1. Firstly, you need to > C:Program FilesJava directory. Open My Computer and navigate to this directory, you will see:
Here, the home of JDK is under C:Program FilesJavajdk1.80_201 . The version number may vary, depending on the JDK you installed.
2. Open the System Environment Variables dialog by typing environment in the search area on Start menu. Click the suggested item Edit the system environment variables:
The System Properties dialog appears, click the button Environment Variables.
Then you will see this dialog:
3.Create the JAVA_HOME environment variable by clicking the New button at the bottom. In the New System Variable form, enter the name and value as follows:
Click OK, and you will see the JAVA_HOME variable is added to the list.
4.Update the PATH system variable. In the Environment Variables dialog, select the Path variable and click Edit:
Then in the Edit environment variable dialog, double click on the empty row just below the last text line, and enter %JAVA_HOME%in as follows:
The percent signs tell Windows that it refers to a variable – JAVA_HOME , and the in specifies the location of java.exe and javac.exe programs which are used to run and compile Java programs, as well as other tools in the JDK.
Click OK button to close all the dialogs, and you’re all set. Now you can open Eclipse or NetBeans to verify. Or open a command prompt and type in javac –version , you should see:
You can add the path to the bin directory of Java home directly into the PATH variable. But it’s strongly recommend to follow the above steps to setup a JAVA_HOME variable because many Java programs depend on it.
When you installed a JDK, you might not need to update the system variable because the installer already did it for you.
About the Author:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook.