I am unable to launch the UI Automator viewer can anyone help me ?how can I launch it? when I double click on "uiautomatorviewer" for some time black window opens but closed automatically even I had set variables in windows path variable
ANDROID_HOME%\tools;
%ANDROID_HOME%\platform-tools;
even i am not sure how I can alaunch it?
If your using JDK 9 or 10 Please downgrade it to JDK 8. It should solve the problem.
Also ensure you have set the below path's correctly.
ANDROID_HOME C:\Users\xxx\AppData\Local\Android\Sdk
JAVA_HOME C:\Program Files\Java\jdk1.8.0_181
Under path in System variables
C:\Users\xxx\AppData\Local\Android\Sdk\tools\bin
C:\Users\xxx\AppData\Local\Android\Sdk\tools
C:\Users\xxx\AppData\Local\Android\Sdk\platform-tools
C:\Program Files\Java\jdk1.8.0_181\bin
Adding here as Answer so that It should be clear to everyone.
Found a solution which DON'T NEED ONE TO DOWNGRADE TO JAVA 8+
so, there is an option for JRE to run VM for "uiautomatorviewer".
Step:1
One needs to install Android Studio
Step:2
Add the below location to "path" System Variable-
C:\Program Files\Android\Android Studio\jre\bin
I have jdk-11.0.6 and "uiautomatorviewer" is working fine
I add this to Path C:\Program Files\Android\Android Studio\jre\bin in system variable
>>> java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
OpenJDK 64-Bit Server VM (build 11.0.13+0-b1751.21-8125866, mixed mode)
>>> javac --version
javac 11.0.13
I also try by set
JAVA_HOME C:\Program Files\Android\Android Studio\jre
ANDROID_HOME C:\... ...\Android\SDK
add bellow lines into Path
%ANDROID_HOME%\tools;
%ANDROID_HOME%\tools\bin;
%ANDROID_HOME%\platform-tools;
but when I try to open uiautomatorviewer.bat it show me error :-(
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
Edit the uiautomatorviewer.bat file
rem set java_exe=
call ..\lib\find_java.bat
edit to
set java_exe=C:\Program Files\Android\Android Studio\jre\bin\java.exe
rem call ..\lib\find_java.bat
try to run uiautomatorviewer.bat it show me error :-(
-Djava.ext.dirs=..\lib\x86_64;..\lib is not supported. Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
is there no way except downgrade jdk1.8.xx.xx.xx!!!!
Related
I have recently uninstalled JDK 11 and installed JDK 8. For confirmation, I want to check which JDK is installed on my Windows 10 machine. I typed java -version on cmd then get the error message
java is not recognized as an internal or external command
How to know which JDK version installed on my PC?
you might need to add path in environment variables which you can find in Control Panel
open the Jdk where you installed and add until /bin in the path in environment variables.
Add until /bin in path variable in System Variables which is residing in Environment Variables.
Then do
java -version
which might show up.
If still problem persists, try restarting your pc and see.
You need to update your Windows path to include your %JAVA_HOME%\bin directory. %JAVA_HOME% is the directory that you installed Java into and is also an environment variable that you need to configure for command line execution of your applications. You can edit both of these in the Windows control panel and you should restart.
When you run java -version you will see the internal version number. This is explained here: https://en.wikipedia.org/wiki/Java_version_history.
Basically, you can ignore the 1. when reading version number. The _xxx is a reference to the most recent patch or build release.
On Windows 10, this required mapping the environment variable for JAVA_HOME to the JDK installation directory. Use these steps:
Run the installer for the JDK. (available for windows here: https://www.oracle.com/java/technologies/downloads/#jdk17-windows)
windows key -> Environment Variables, select the only result
In the System Properties window that opened, select Environment Variables
Select new button under the User variables section
Variable name: JAVA_HOME, Variable Value: <The JDK filepath from step 0>
ok all open menus
Close any open cmd prompt windows
open a new cmd window and type echo %JAVA_HOME% It should print the installation path for the JDK.
To get your jdk location in Windows, run this at a command prompt:
where java
This lists any and all locations of java.exe, including from your JAVA_HOME. For example, the 3rd line here reflects my JAVA_HOME location, where I'm pointing to JDK 8:
C:\Users\me> where java
C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe
C:\Program Files\Java\jdk1.8.0_202\bin\java.exe
Note for comparison that java -version does not reflect my JAVA_HOME location and in fact shows java version 11 instead of 8:
C:\Users\me> java -version
java version "11.0.15" 2022-04-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.15+8-LTS-149)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.15+8-LTS-149, mixed mode)
This is confusing because my Java compiles (e.g., via mvn) use JDK 8 since that's what my JAVA_HOME is pointing to. (I'm not even sure where the version 11 it found came from; possibly from when I installed maven.)
Determining the difference between the JRE and JDK you're running has never been straightforward. Seems like java -version used to be a way to do this, but no longer.
Adding to the complexity, you can also supposedly get your Java version info from Control Panel > Programs > Java > About. For me, that shows Version 8. That's despite java -version showing version 11.0.15. And it doesn't change even if I point my JAVA_HOME to JDK 11.
Note that this answer is also helpful. In my case, that helped me determine that I have java.exe and javac.exe at C:\Program Files (x86)\Common Files\Oracle\Java\javapath and C:\Program Files\Common Files\Oracle\Java\javapath. Depending on which one I have listed first in my Path variable, I get different results when i run java -version or java --version. The former seems to work when Java 8 is listed first; the latter when Java 11 is first.
(node:16112) UnhandledPromiseRejectionWarning: CordovaError: Failed to run "javac -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: C:\Program Files (x86)\Java\jre1.8.0_171
I checked my user environment variable and I have the variable JAVA_HOME and set to "C:\Program Files (x86)\Java\jre1.8.0_171"
I also have C:\Program Files (x86)\Java\jre1.8.0_171 appended to the user environment variable PATH.
make sure you have a JDK installed
This is the relevant part of this error message. Your JAVA_HOME points to a Java Runtime Environment (JRE), not to a Java Development Kit (JDK).
javac is the Java compilation command, which Cordova is attempting to execute in this case. However, javac is not shipped with the JRE as it is a development tool.
You need to download and install a JDK and set JAVA_HOME to point to it
I get an error trying to install Eclipse 4.7 (Oxygen) Oracle Corporation using the installer program, eclipse-inst-win64.exe Am I missing a system variable? Am I missing a prerequisite? This computer is locked down pretty tight. However I am installing by running as an administer.
First I installed the Oracle JDK 8.162 64-bit - No problems
Then I ran the eclipse-inst-win64.exe installer and quickly got the following error:
The Eclipse Installer executable launcher was unable to locate its companion shared library.
I thought this could be just that the program did not know where the JDK was installed. The JDK installer does not set any environment variables except for adding the path to the JDK to the PATH variable. So I searched StackOverflow for a list of JDK variables to add. I added the following new system variables:
CLASSPATH = .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_162
JAVA_TOOL_OPTIONS = -Dfile.encoding="UTF-8"
JDK_HOME = %JAVA_HOME%
JRE_HOME = %JAVA_HOME%\jre
I modified the Path variable to put the bin directory first:
PATH = %JAVA_HOME%\bin;C:\windows\system32;C:\windows… rest of the existing path variable
I ran the eclipse-inst-win64.exe installer again and got the same error:
I rebooted but still got this error.
I tried to "run as administrator" but got the same error.
Some people suggest that the path can get too long with the default installation directory so I tried installing the JDK in C:\JDK\ but still got the same problem.
Java seems to be installed properly:
H:>java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
I still assume that I made a mistake with my system variables or my JDK installation.
I assumed the "companion shared library" was inside the JDK installation. I extracted the installation files to another directory (C:\eclipse) and then it ran. The "companion shared library" must have been inside the zipped installer. I fixated on the idea that the problem had to be a failure to connect to the JDK that I did not consider any other possibilities. It is installed now.
I have just switched from Windows7 to Windows8.1 and I'm having trouble making Android Studio work now.
I have installed Android Studio and the JDK. First I tried it out with the latest versions Android Studio v.0.8.14 and JDK 1.8, but I could not get it to work. I then tried to use the versions I used on my previous Windows7, and installed Android Studio 0.8.2 and JDK 1.7.0_67, but I still can't get it to work.
The error I'm getting is:
Failed to load JVM DLL C:\Program Files\Java\jdk1.7.0_67\jre. If you
already have a 64-bit JDK installed, define JAVA_HOME variable in
Computer > System Properties > System Settings > Environment
Variables
I have set JAVA_HOME to my JDK path. I've tried to add \bin to that path, which didn't help. I've tried to add the JDK_HOME variable and set path to it, which didn't help either. I have also added "C:\Program Files\Java\jdk1.7.0_67\" to my PATH variable, which also didn't help. I tried editing studio.bat adding a string to point to my JDK folder, which also didn't work.
When I check my Java from console (cmd) I get the msg that it works find:
C:\Users\Igor>java -version java version "1.7.0_67" Java(TM) SE
Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit
Server VM (build 24.65-b04, mixed mode)
Is Windows 8.1 the problem? Do I have to do something different on it?
Follow these steps:
Control Panel>>System>>Advanced(tab)>>Environment Variables>>System Variables
New
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
I had exactly the similar problem:
failed to create JVM: error code -6
JVM PATH: .............
If you already have a 64-bit JDK installed, define a JAVA_HOME variable in Computer > System Properties > System Settings> Environment Variables.
Note: Do *not* choose a Java "JRE". You need to point to a full JDK, otherwise the IDE may fail to start. See http://tools.android.com/knownissues for more details.
Solution for me
I solved it with the help of Rahul Wadhai:
1) Go to C:\users\<your_user>.AndroidStudio2.2\ and open studio.vmoptions
2) change -Xmx and XX:MaxPermSize to lower values(then you have currently) and try to run AS again. ( If it does, then you can increase the values back. )
3) If it doesnt help, then try to rename .AndroidStudioX.X and then open AS again.
4) If it doesnt help, then you can search the problem within this android folder (using TextCrawler) , maybe somewhere in config files, there needed to change something. And then you can import settings from old folder.
You need to mention the JDK folder path in the Environment variable:
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_51
Don't use build number coming in cmd.
To get this working, I put my JDK path in the Path variable as the first item. For some reason, when it's the last item it does not work.
You have to create a new variable in the System variable named JAVA_HOME = "C:\Program Files\Java\jdk1.7.0_67", in your PATH variable.
I tweaked the studio.vmoptions file when I followed a method in making it run faster and it stopped working showing the same JDK error.. I did most of the fix mentioned above and none worked for me. What worked for me though was deleting the studio.vmoptions file and everything was great again.
Go to your c:\ users\yourcomputername\ for example .AndroidStudio1.5
You will see config and system folder in it then delete the .AndroidStudio1.5 using it as example .
Go and relaunch the studio64
This is the solution that worked for me after many frustrated attempts:
go to the folder C:\program files\Android\Android Studio\bin
rename the file 'studio.64' to 'studio.bat' and run this file.
I am using Maven for the first time on Windows 7 and getting this error:
ERROR: JAVA_HOME is set to an invalid directory.
JAVA_HOME = "C:\Program Files\Java\jdk1.7.0_03\bin"
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation
Java version "1.6.0_29" Java(TM) SE Runtime Environment (build
1.6.0_29-b11) Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode)
I've read everywhere online about how to set up the variables properly in windows for a Maven installation, also on this site, but, I can't seem to get my installation working.
Here's my set-up:
System Variables:
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_03\bin
Path
C:\apache-maven\src\bin
Any help would be greatly appreciated.
thats because your JAVA_HOME is incorrect
set JAVA_HOME to C:\Program Files\Java\jdk1.7.0_03
also some systems , maven might still throw error because if the path to Java Directory has space i.e Space between Program and Files in the path
You might as well move the java to someother path without space
instead of
C:\Program Files\Java\jdk1.7.0_03
to
C:\Java\jdk1.7.0_03
Edit
Double-quoting the value of JAVA_HOME can also cause this problem
set JAVA_HOME="C:\Program Files\Java\jdk1.6.0"
doesn't work for me, but this does:
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0
set JAVA_HOME to C:\Program Files\Java\jdk1.7.0_03 (without bin)
For environment variable of JAVA_HOME should be like this "C:\Program Files\Java\jdk1.7.0_03\" without bin. Please note that likely you have 2 version of Java installed. Make sure which one that you want to use.
Seemed it was a problem with the latest version of Maven. I used Maven 2.2.1 with the same set-up and it run with no problems.
JAVA_HOME should be like this C:\PROGRA~1\Java\jdk1.7.0_03
Hope this will work!