Java path set wrongly - java

I have installed Java on a new system. Some random path in my C drive is automatically set for my PATH variable. Whenever I try to run Java, it shows java.exe not found in that wrong path!
I'm trying to change the PATH variable using the SET command, but the new path is only getting added along with the old one. I could not run Java on the system.
set PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_71\bin
I've tried setting PATH variable in Windows Environment Variables list also after setting JAVA_HOME!
When I type Java in cmd, i get:
The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe.
This path is the old unknown automatically set path.
Is there any way to run Java! I'm using windows 8.

if you are using windows system, please create java_home as a variable and set java home path i.e. till C:\Program Files\Java\jdk1.7.0_71, and in path variable do not delete existing just append new with ;%java_home%\bin
this will work
in you case SET is valid till command prompt is open.
do the above changes in my computer -> properties -> advanced ->environment variables

I know this post id very old. I faced this issue recently. Please follow the following steps to resolve your issue:
Search for "Regedit" in "start menu".
Once found, right-click it and choose "run as Administrator" option.
Enter your administrator credentials and Enter.
Go to "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.7"
Double-click on "JavaHome" name and change its value to "C:\Program Files\Java\jdk1.7.0_71".
Close all your command prompts and open a new Command prompt and it should reflect.

set PATH=C:\Program Files\Java\jdk1.7.0_71\bin;
will set the path of java only
and the old path will not get added and that will be till the command prompt
session lasts.
to keep the existing path setting intact and add the java path use below command.
set PATH=C:\Program Files\Java\jdk1.7.0_71\bin;%PATH%

Related

Java run command not opening

I had installed Java to work with Android Studio. Java works fine on Android Studio but when I try to use Java run command on my computer, it opens and closes immediately. How do I run Java on my computer?
Open command window (cmd on Windows)
Type java -version
You should see the installed java version output.
u need to add this path C:\Program Files\Java\jdk1.8.0_05\bin wheres javac.exe locate copy the path
1. go to System properties then click on advanced system setting .
2. click on Environment variables as picture describe
3. choose the path from system variables and edit it
4. go to end of the line and important to separate between variable values before paste javac.exe path make sure to put semi-colon and paste the path
There is a possibility that you have the following Registry setting configured:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System!DisableCMD
If you see the value 'DisableCMD' in the above location then simply delete it.
If you are not comfortable with editing the Registry then you will find this setting by going to:
Start > RUN
Type gpedit.msc and press OK
Navigate to: User Configuration > Administrative Templates > System
Look for the option 'Prevent access to the command prompt'
Double click it and choose 'Not Configured'

SQLdeveloper doesn't start

When I try to run SQLdeveloper, appears window with text "Please specify the path to the Java JDK home (e.g. C:\Program Files\Java\jdk):". I enter my path, window appear again. I enter my path again, and that's all. Nothing happens. What I should do for SQLDeveloper start?
JAVA_HOME set to H:\programs\Java\jdk1.8.0_11 .
File sqldeveloper.conf has text "SetJavaHome..."
C:\Users\username\AppData\Roaming\sqldeveloper\1.0.0.0.0\product.conf has text "SetJavaHome..." too.
First you need to set java classpath in order to run sqldeveloper.
Steps To Set java ClassPath
1.Right click on mycoputer.
2.Select Properties.
3.Left side of the my computer properties select Advanced System Settings.
4.Select Environment Variables.
5.Select path in System variables.
6.Click edit, at the end of the text add ; then past your java/bin path.
in my system it is--> "C:\Program Files\Java\jdk1.7.0_51\bin"
7.Now open your sqldeveloper, it will open for sure.
Delete the java.exe and javaw.exe in the following path
"C:\Windows\System32"
Set Environmental Settings for your account or for the entire system if you are a admin
Setting for Entire System
Mycomputericon >Right click>select properties>select Advanced System Properties>click Advanced Tab>click Environmental Variables>create a
System variable names "JAVA_HOME"(any thing can be given but
specific to name is better) in Vairable Name and for Value give the
JDK path up to "bin"
-Put JAVA_HOME in the Path vairable's value.
For User Variable same process but in UserVariable section
Hope this helps!
.
I think supported library files of sqldeveloper in your system are deleted,affected by virus or corrupted. So download fresh copy of sqldeveloper and try again.

Java command not found

I'm trying to get the java command to work on my computer. Whenever I try to use it, I get the error "'java' is not recognized as an internal or..."
What I've done
So far I've traced the issue through my system environment variables, which has a variable PATH that links to "C:\ProgramData\Oracle\Java\javapath" or javapath for short.
There are 3 files in the javapath folder, and if you click on them a popup says:
But when I examine the properties of the shortcut and click "open folder location" it sends me to the right place (?? what is this).
Just in case, I tried to recreate the shortcut; I called it java2 and it now works (opens a command box for a split second and closes) when I click on it. However, testing it in command prompt with the line "java2 -version" returns "'java2' is not recognized as an internal or external..."
Details
I just installed java 8, and I've verified that it was installed correctly
I'm running a 64 bit windows 7 OS
Have you checked your environment variables for Windows? When you installed the JDK/JRE the directory should have been added to the PATH variable. The directory added needs to contain the java.exe executable. It should be located in C:\Program Files\Java or something like that if you installed it using the default settings. Once you find that directory find the bin directory inside it.
In order to check that:
Right click My Computer and hit Properties
On the left side hit Advanced System Settings
Hit the Advanced tab and then Environment Variables down at the bottom
Find the PATH variable and then hit edit. Confirm that the location of the JDK /bin directory is there, if it is not then add it.
Also, if the JAVA_HOME variable isn't already set, this may be a good idea.

Do I need to restart my system after setting JAVA in system environment's path variable?

I did the following steps but java does not seem to be working for me, do I need to restart my system if yes then why?
1. Right click My Computer->Advence Option->Environment Varibles->System Variables
2. variable : Path->Edit
3. Copy your jdk bin directory i.e.C:\Program Files\Java\jdk1.7.0_51\bin
4. Paste it after putting a semi-colon(;) in value section
i am getting below error while running java in cmd
C:\Users\User>java -version
Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
No, but you will need to close and recreate any cmd windows, running java programs, or the like.
To check it's correct, open a new cmd window and type set -> review the information for PATH and JAVA_HOME.
You should set two things:
JAVA_HOME
PATH
The first lies under the "User variables for [your user name]" section. Add the JAVA_HOME variable and set it to where your jdk is installed. i.e. C:\Program Files\Java\jdk1.7.0_51\
The second lies under the "System variables" section. You should find the "path" variable, and edit it. Then, append ";%JAVA_HOME%\bin" (minus the quotes) to the end of the path variable.
After you have done this, save the variables and close that window clicking the "ok" button. Close down all instances of the command prompt (and any IDE you may be developing with such as Eclipse or NetBeans), and reopen one command prompt. Then, if you would like to test whether or not your changes worked and are in effect, try the following:
echo %JAVA_HOME%
This should output where you set your java home variable to.
echo %PATH%
At the end of what is output, you should see your java home\bin addition to the path variable
java -version
If you can run this command from the command line, it means that your environment was set up correctly and java is now in your path.
Not necessary. Quit and Open the command prompt again (if any) that runs the java process and type java -version to check if it installed successfully.
If you are using mac, source ~/.bashrc or source ~/.zshrc should refresh your environmental variable. No need to re-start the terminal even.
No, you don't need to restart your system.
However, you have to restart your command prompt application to update the changes done on Environment variables.
NO.
You don't need to restart the system, but just the application like cmd or any IDE you are using for java development (i.e Eclipse) need to restart.
And to confirm that the java path is set that you have mentioned in JAVA_HOME environment variable, you can open cmd and you can check with commands echo %JAVA_HOME% or echo %PATH%.
I reinstall the JDK and set the JAVA_HOME and PATH variable again. now it's working.
In my case under user variable section(for particularuser) JAVA_HOME set to jre not jdk path . I change it to JDK path , It worked for me
yes need to restart cmd prompt after env variable change

I'm trying to set my JAVA_HOME path to use my javac.exe?

I'm on Windows 7 and I'm trying to set my JAVA_HOME path to use PhoneGap on android, when i create a project using the command line "cmd" it tells me that it can't find javac.exe? although i'm sure that I've set the variable right
here's my stuff:
Variable name: JAVA_HOME
Variable value: C:\Progra~1\Java\jdk1.7.0_17\bin
(I've also tried to use: C:\Progra~1\Java\jdk1.7.0_17\bin\javac.exe)
My javac.exe location on my laptop C:\Program Files\Java\jdk1.7.0_17\bin\javac.exe
and it still tells me that it can't locate the javac.exe
What I type to create the project and i meet this problem is this:
C:\Users\user>cd C:\Users\user\Desktop\phonegap-2.8.1\lib\android\bin
C:\Users\user\Desktop\phonegap-2.8.1\lib\android\bin>create.bat
Cannot locate javac.exe using the PATH environment variable.
Retry after adding directory containing javac.exe to the PATH variable.
Remember to open a new command window after updating the PATH variable.
Visit http://java.oracle.com if you need to install Java (JDK).
Also, i've tries restarting the windows and closing the command prompt and redownloading the JDK.
Thank You.
cmd is using the values from the PATH variable to locate javac :
set "PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_17\bin"
For other softwares (Tomcat, Maven, etc.) JAVA_HOME must indicate the root of your JDK :
set "JAVA_HOME=C:\Program Files\Java\jdk1.7.0_17\"
No need to restart Windows. When using set the changes are taken immediately.
If you choose to modify those variables in the Control Panel, you have to close and relaunch cmd for the changes to take effect.
You have to add java
C:\Program Files\Java\jdk1.7.0_17\bin
Note that your path may be different.
to your environment variables and restart your console.
You can find how to set your variables here:
http://www.itechtalk.com/thread3595.html
Set the JAVA_HOME Variable
Right-click the My Computer icon on your desktop and select Properties.
Click the Advanced system settings. Click the
Environment Variables button. Under System Variables, click New.
Enter the variable name as JAVA_HOME.
Enter the variable value as the installation path for the Java Development Kit(C:\Program Files\Java\jdk1.7.0_17).
Click OK.
Click Apply Changes.
You might need to restart windows.
Set the JAVA_HOME environmental variable to
C:\Program Files\Java\jdk1.7.0_17
Press
Win + Break > Advanced System Settings > Environment Variables > System Variables
Modify/set JAVA_HOME to the above. (No need to restart)
I already had this error when I tried to create a new phonegap project for android but unfortunately I don't remember how exactly I have fixed this.
I don't know if you have followed the phonegap documentation so here is the link : new project, especially the part 3B (be careful about ; in your PATH).
If you don't know what to do now, maybe you should do it again step by step.
May be a little old, but since this is the first goolge result, I might as well add a little something.
You need to create the JAVA_HOME variable AND edit the PATH variable, adding ;%JAVA_HOME%\bin (with a ;) so cmd and some other apps can actually use javac and the rest of the tools

Categories