Configuring Java Extension Pack in Remote WSL on VSCode - java

My question is similar to this. I am trying to work with Java in Remote-WSL using VSCode. According to VSCode guidelines, I should install the Java Extension Pack on WSL. However, when I try to install it I get the following error:
The java.home variable defined in Visual Studio Code settings points to a missing or inaccessible folder (C:\Program Files\Java\jdk-9.0.1)
This is what the Java Extension pack shows when I install it on WSL.
I have been able to resolve this issue if I change the path in java.home to be same as JAVA_HOME in settings.json. However, I need to toggle the path back to C:\Program Files\Java\jdk-9.0.1 manually when working on my local machine and not on Remote-WSL.
Is there a better way to make it work?
PS: I've no clue why it says that JDK_HOME is empty. If I echo $JDK_HOME inside WSL, it shows the path same as JAVA_HOME.

If you want to develop Java in WSL, you need to install JDK in WSL. Now from the way you frame your questions I would assume you have done that (it needs to be installed as a Linux program, so if your JAVA_HOME starts with anything like /mnt/c then you don't actually have it on WSL).
I have been able to resolve this issue if I change the path in java.home to be same as JAVA_HOME in settings.json. However, I need to toggle the path back to C:\Program Files\Java\jdk-9.0.1 manually when working on my local machine and not on Remote-WSL.
The problem you mentioned here is relatively simple to solve. All you need to do is to have a WSL specific settings for java.home, and have the normal setting (i.e. C:\Program Files\Java\jdk-9.0.1) remain in your normal VS Code settings. To access WSL specific settings, use CTRL+SHIFT+P then type "Open Remote Settings".

Copied answer to one possible problem/solution from the Q above for visibility here:
I have been able to resolve this issue if I change the path in java.home to be same as JAVA_HOME in settings.json. However, I need to toggle the path back to C:\Program Files\Java\jdk-9.0.1 manually when working on my local machine and not on Remote-WSL.
Before installing the Java Extension Pack on the WSL side of things you should have something similar to this (so, yeah --> Click that button!):

i solved my problem running this comand on WSL
sudo apt install default-jdk

I think you should install JDK in WSL.

Related

Android.bat won't start. Sdk Manager won't run [duplicate]

This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
So I installed the android sdk for Windows:
http://developer.android.com/sdk/index.html (the installation link)
And ran into the path variable problem. So I fixed that by changing "PATH" in enviroment variables to include where my java.exe file is located from the JDK.
But now when I open the android sdk manager, a cmd-like screen just briefly flashes on for half a second then disappears. I have no idea what's going on and how to get this thing working.
Make sure your java\bin directory is in your path statement before the windows\system32 directory.
The SDK Manager uses java and it was finding the one in the system32 folder.
In a CMD window, you can run 'where java'.
Don't forget to restart your CMD after changing the path variable for checking.
Alright, I had the same problem, and none of these answers worked for me (I'm running Windows 8). I tried running tools/android.bat and noticed I got some errors there. I investigated further and it seems there is something wrong in the code that finds your Java path.
This is how you fix it:
Open up tools/android.bat in your favorite text editor
Search for this piece of code:
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
Replace it with this:
set java_exe=D:\Program Files\Java\jdk1.7.0_07\bin\java.exe
where the path is the path to your Java exe.
Run android.bat
(in my case I had to specify the path to java_exe in step 3 with no quotes to make it work.)
There are many reasons as to why the SDK Manager won't open. Rather than trying each one of them blindly, I recommend running the android.bat in a command window so you can read the error message and apply the correct fix.
In the latest version of the Android SDK, running "SDK Manager.exe" and/or "AVD Manager.exe" will not open anymore. Even the "Launch Standalone SDK Manager" link in Android Studio, which can be previously found in Android SDK Settings, is now gone.
It is now recommended to perform manual SDK and AVD management inside Android Studio. But for those who do not have an Android Studio or for those who do not like to open Android Studio just to perform SDK management, you can still manage the SDK using the command line tools, "tools/bin/sdkmanager.bat" and "tools/bin/avdmanager.bat".
This information is available when running "tools/android.bat". I think this is true for those who currently have Android SDK tooks v25.3.1 and above.
Same problem here.
Fixed!
I installed the correct Java stuff, all for 64 bit, because my system is x64, and nothing happened. So I went to C:\Users\[my name] and deleted the directory .android that has been created the first time the SDK ran, apparently with some wrong configuration.
Then it worked. You can try that. Delete that folder or just move it to the desktop and run the SDK.
Google removed the GUI for SDK starting from version 26. If you're using version 26, try downgrading to version 25. You can still open the SDK from Android Studio.
Source: Is GUI for Android SDK manager gone?
There appear to be several ways to launch the SDK Manager:
SDK Manager.exe in the root of the Android SDK.
SDK Manager.exe in sdk\tools\lib of the Android SDK.
Window -> Android SDK Manager menu in Eclipse
android.bat in sdk\tools of the Android SDK.
In my case, it looks like android.bat fails on the line:
for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a
As far as what that line is doing... if I manually run: "[path_to_java]java" -jar lib\archquery.jar
It successfully returns: x86_64
But when the batch file runs that same command, I don't know why but it fails with the error message:
Unable to access jarfile lib\archquery.jar
So the variable swt_path gets set to an empty string. Everything breaks down from there.
The batch file sets the correct value for the variable java_exe. Others have commonly reported this as a problem, but those workarounds weren't relevant in my case.
People have recommended commenting out the problem line by adding REM to the beginning of it, and adding a line to manually set the swt_path variable, which is a valid workaround:
REM for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a
set swt_path=lib\x86
BUT, the critical issue in my case is that it's choosing to load a jar file from either the lib\x86 or the lib\x86_64 folder here. At some point, things were getting confused between the BAT file error, a 32-bit JDK, and a 64-bit Android SDK.
SO, the workaround in my case was to:
Uninstall ALL versions of Java
Install the JDK
You can either use the 32-bit Android SDK and install the 32-bit JDK
Or use the 64-bit Android SDK and install the 64-bit JDK
But the "bitness" of the JDK should match the Android SDK. It appears that either of the 32-bit or the 64-bit will work on a 64-bit computer, AS LONG AS the JDK bitness matches the Android SDK bitness.
Edit "android.bat"
If using the 32-bit Android SDK/JDK, use lib\x86:
REM for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a
set swt_path=lib\x86
If using the 64-bit Android SDK/JDK, use lib\x86_64:
REM for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a
set swt_path=lib\x86_64
After doing this, I can successfully run the SDK Manager by running android.bat, or from the Eclipse menu (but still not by running either of the SDK Manager.exe files directly).
The simplest way is to run the program as administartor.
Right-click the SDK Manager -> Run as Administrator
That should solve the problem :)
I had the same problem, tried setting path variables and everything. What SDK manager needs is not the JDK, but the actual Java SE end user crap. Go to http://www.java.com/en/download/ie_manual.jsp?locale=en and download that. As soon as I finished installing that, it worked like a charm
Try adding the Java path (pointing to the JDK) to the System Environment Variables.
Right-click 'Computer' > Properties > Advanced system settings > Environment Variables
Then under System Variables, add a new variable.
Variable Value
JAVA_PATH C:\Program Files\Java\jdk1.7.0
Then edit the Path variable, prefix it with %JAVA_PATH%\bin;.
Locating the android.bat file in the tools folder worked for me. Funny that it is such a chore to get it to run. In my experience, usually .exe files run as expected. I'm not sure why it doesn't in this case... strange and annoying!
I had something totally different than the other answers.
I ran tools/android.bat and got
java.lang.NullPointerException
at java.io.File.<init>(File.java:251)
at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1623)
at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1584)
at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:357)
at com.android.sdklib.internal.avd.AvdManager.getInstance(AvdManager.java:380)
at com.android.sdklib.internal.repository.updater.UpdaterData.initSdk(UpdaterData.java:259)
at com.android.sdklib.internal.repository.updater.UpdaterData.<init>(UpdaterData.java:127)
at com.android.sdkuilib.internal.repository.SwtUpdaterData.<init>(SwtUpdaterData.java:61)
at com.android.sdkuilib.internal.repository.ui.SdkUpdaterWindowImpl2.<init>(SdkUpdaterWindowImpl2.java:104)
at com.android.sdkuilib.repository.SdkUpdaterWindow.<init>(SdkUpdaterWindow.java:88)
at com.android.sdkmanager.Main.showSdkManagerWindow(Main.java:408)
at com.android.sdkmanager.Main.doAction(Main.java:391)
at com.android.sdkmanager.Main.run(Main.java:151)
at com.android.sdkmanager.Main.main(Main.java:117)
Basically it looked like I had a corrupt AVD configuration, so I went and cleared out my virtual devices and everything started working again! (Files in C:\Users\YourUser\.android\avd for windows users)
I faced the same issue and finally managed to solve it. I then created a step-by-step guide containing the universal fix to help all developers get past this issue asap: http://www.dominantwire.com/2015/03/android-sdk-not-opening.html
All the steps in short:
1.If you have jdk v1.8. Remove it and re-install jdk v1.7.x.x
2.Set paths to jdk and jre bin folders in the environment variables
3.delete (make a backup first) the .android folder present in C: > Users > [user-name] > .android
4.Set the JAVA_HOME variable keeping JAVA_HOME as the variable name and the path to bin folder of jdk as the variable value.
5.Go to [sdk-directory] > tools. Find and right-click on android.bat file and select 'edit' to open it in notepad and make the following modifications.
ORIGINAL
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
MODIFIED
set java_exe=C:\Program Files\Java\jdk1.7.0_75\bin\java.exe
rem call lib\find_java.bat
rem if not defined java_exe goto :EOF
NOTE : Copy and paste your own java.exe path directory as explained previously.
ORIGINAL
for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
MODIFIED
rem for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
set swt_path=lib\x86_64
NOTE : If your android sdk is 64bit then mention set swt_path=lib\x86_64 otherwise if it is 32bit then keep it as set swt_path=lib\x86
Done! Fire up android sdk from android.bat file or from eclipse. It should open up just fine!
I tried almost all the solutions provided here. But nothing worked out. And finally, I downloaded tools(tools_r25.2.3-windows.zip) from the below link and replaced the tools sub-folder in the sdk folder. It started working.
https://developer.android.com/studio/index.html#downloads
Sharing this as an information though it's an old thread.
I recently faced this problem after I installed android emulator using the sdk manager of android studio - which also upgraded my android sdk tools to 26.0.1 (as it was a prerequisite - according to the sdk manager of android studio).
In my case, I simply replaced the tools folder of android sdk with tools folder from an older android sdk. This downgraded the android sdk tools, but now I can open the sdk manager using SDK Manager.exe.
Also make sure there is not as JRE before your JDK in PATH on Windows. Oracle always stuffs its own JRE into the path before anything else (I had installed Oracle Lite after I installed the android sdk).
Same problem here, I tried all solutions but nothing worked. Then I went into C:\Users\User_name and deleted the ".android" folder and then, the SDK Manager could open normally, and automatically created other ".android" folder.
I have solved this issue. If you are not able to open "SDK Manager.exe" from explorer or if you are facing any problem with SDK Manager.
Firstly check Java path is given in Environment Variable. (run Java command on CMD, or run Where Java on CMD as Administrator). If Java command is recognized, there might not be problem with Java
This might be due to broken SDK Tools. To fix it firstly rename tools folder (Android\Sdk\tools) to tools.old. Now download https://dl.google.com/android
/repository/tools_r25.2.3-windows.zip?hl=id.
After that Extract the downloaded zip files to Android\Sdk\ hence new tools folder would be extracted with all the contents for SDK. Now open SDK Manager.exe. If it opens your issue is solved. Please note that SDK Manager.exe is a launcher file that launches Android\Sdk\tools\bin\sdkmanager.bat. if you are satisfied with the answer please Upvote so that maximum users would solve the issue. For further help visit this page https://answers.unity.com/questions/1320150/unable-to-list-target-platform.html
Been trying to get the SDK manager to run for a while now following various threads with similar problems I could find.
Another solution to consider is to move android SDK to a dir without spaces in its name.
For instance in my case it resided in:
e:\Program Files (x86)\Android\android-sdk\
and would fail.
When moved to:
c:\android_sdk_sucks\
It worked.
I tried all the most popular solutions before and no one worked for me, until I realised that the Android SDK folder must not have any spaces, so I changed it from "C:\Android SDK" to "C:\Android_SDK". As simple as that.
Nothing helps me from all this answers, but I found the right steps (Windows 7 64 bit):
1) Open android.bat from your sdk folder for editing;
2) Add exactly this two strings:
set java_exe=c:\Program Files\Java\jdk1.8.0_25\bin\java.exe
rem call lib\find_java.bat
instead of this:
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
Where c:\Program Files\Java\jdk1.8.0_25 is your jdk folder.
3) Enjoy. SDK Manager will launch from Android studio IDE.
I installed Android Studio for Mac. I was not able to access the SDK manager through the IDE. It turns out I just had to have my JAVA_HOME environment variable set. Once I got this set I was able to launch the SDK manager.
I'd encountered the same problem. When running the android.bat I found the solution (if Java is installed in the 'normal' Windows directory, ie 'program files') you need to put quotes surrounding "c:/program files/" etc etc. Otherwise it cannot find java on "C:/program". (me dislikes spaces)
The issue with mine was that I could run SDK manager through double clicking android.bat but not when I double click on the actual SDK manager application. I solved this issue by setting a new environmental variable:
ANDROID_HOME = C:\Development\adt-bundle-windows-x86_64-20130911\sdk\
restarted my pc and now I can double click on the application and run SDK Manager. Hope that helps :)
I saw answers that provide workaround solutions by hard coding java.exe location and x86 / x86_64 architecture string in sdk\tools\android.bat. Those are quick solutions but did not solve the fundamental issue that I am actually curious of.
The actual problem that I encountered is, the batch script is not able to find another script/jar file and thus is failed to proceed. I could say the script was poorly written.
After I made the following changes in sdk\tools\android.bat, everything works like a charm.
Specifically, I added %~dp0\:
set java_exe=
call %~dp0\lib\find_java.bat
if not defined java_exe goto :EOF
...
for /f "delims=" %%a in ('"%java_exe%" -jar %~dp0\lib\archquery.jar') do set swt_path=lib\%%a
Now, try to launch the script and SDK Manager should come out.
p.s. My installation of OS, Java 8 and Android SDK are fresh and I did not do any of the extra configuration.
p.s. You may still need to configure PATH environment variable so that the script could find the suitable java.exe.
I test every way, But only working way was re Installing sdk-manager in same path as old one
http://quantumsupport.blogspot.com/2011/03/android-sdk-managerexe-wont-start.html
Create a new user account, either re-install or just start android.bat and it should work did for me
I encountered a similar problem where SDK manager would flash a command window and die.
This is what worked for me: My processor and OS both are 64-bit. I had installed 64-bit JDK version. The problem wouldn't go away with reinstalling JDK or modifying path. My theory was that SDK Manager may be needed 32-bit version of JDK. Don't know why that should matter but I ended up installing 32-bit version of JDK and magic. And SDK Manager successfully launched.
OS: Windows 7- 64 bit, Android SDK: 64 bit
Introduce a new 'System variable' named: JAVA_HOME with value: C:\Program Files\Java\jdk1.7.0_51
Right-click on SDK Manager.exe -> Run as administrator
A check list:
Make sure the java path in system variable 'Path' is something like: C:\Program Files\Java\jdk1.7.0_51\bin
There is no space in your folder name, replace something like C:\Android SDK with C:\Android_SDK
You can find your java with 'where java' command in command line

Android Studio - No JVM Installation found

I'm having issues trying to boot-up Android Studio
When I try to launch it after installation I'm getting this error:
No JVM Installation found. Please install a 64 bit JDK.
My current system specification:
Operating System: Windows 8.0 64 bit version
JDK installed: JDK 1.8.0
What I have tried:
I have tried what was reported in the error, and also in most of the solutions to set the JDK_HOME variable in environment variables to my JDK path (64 bit version) i.e. C:\Program Files\Java\jdk1.8.0_05
*I also have tried rebooting system, just in case to test if the environment variable is not working without a restart
I have seen these solutions and tried but none of them works, so don't mark it as a duplicate of any of these:
Android Studio installation on Windows 7 fails, no JDK found
With android studio no jvm found, JAVA_HOME has been set
Android Studio start fails on Windows 8 64bit
Android Studio does not launch after installation
Here is the cmd output for java version:
I had the same problem. I tried setting all kind of paths but nothing worked. So I had to do some dirty fix. The only problem with this is that it opens a blank command line window.
I did the following to make it work.
goto the AndroidStudio installation folder.
goto bin folder and open studio.bat in text editor
add set JAVA_HOME=C:\Program Files\Java2\jdk1.8.0//your java path after the ECHO line.
goto Start -> All Programmes -> Android Studio ->
right click on Android Studio and click on properties.
You will see the Target something like <installation path>android-studio\bin\studio64.exe
change it to <installation path>android-studio\bin\studio.bat
Now you can access it by clicking it from the menu.
Note : I tried it with 8, It works.
I reproduced your issue on my Windows 8.1 system :
Installed 64-bit JDK 1.8.0_11.
Installed latest Android Studio Bundle.
Went to Control Panel -> System -> Advanced system settings -> Environment Variables...
Added JDK_HOME pointing to my 64-bit JDK.
Launched studio64.exe
I got the same message you did. Thinking that it might be the environment variable, I did the following :
Went to Control Panel -> System -> Advanced system settings -> Environment Variables...
Changed the name of JDK_HOME to JAVA_HOME.
Launched studio64.exe
It came up successfully !
1 .Download 64 bit version of JDK from here
As shown in next picture, go to Control Panel -> System and Security -> Advanced system settings -> Environment Variables -> New (System variables)
Then add variable name: JAVA_HOME and variable value: C:\Program Files\Java\jdk1.8.0_25
Please note that jdk1.8.0_25 may be vary depending on JDK version.
Click OK button on the rest of the windows left.
1-Right click on Android Studio and click on properties.
2-Replace studio64.exe in link by studio.exe.
Ok, was having this issue as well and this is what fixed it for me. For the record I'm using Windows 8.1 and Java JDK 1.8.31, all 64-bit.
The problem is with the space between "Program" and "Files" in the path set in JAVA_HOME. I've had this problem before but didn't really realize until I was checking the instructions here for setting JAVA HOME, then it all made sense.
In a nutshell, change the JAVA_HOME path from:
C:\Program Files\Java\jdk1.8.0_31
to
C:\Progra~1\Java\jdk1.8.0_31
Make sure to set the correct JDK version number for your installation. Removing the space from the path fixed everything on my system.
As noted on the page linked above,
use C:\Progra~1\ for C:\Program Files\
and C:\Progra~2\ for C:\Program Files(x86)\
depending on where you have the JDK installed on your system.
Note: Just to be clear, before making this change my system correctly echoed the value of JAVA_HOME to be C:\Program Files\Java\jdk1.8.0_31 in the command window, leading me to believe all was well. However, attempting to run %JAVA_HOME%\bin\javac reported that the path could not be found. After removing the space from the JAVA_HOME path the same command runs perfectly.
Uninstall Java 8 and clean your JDK_HOME and your JAVA_HOME enviromental paths. Then install 64bit JAVA 6 or 7 JDK of your preference.
Make sure you set the path in the SYSTEM VARIABLES not in the USER VARIABLES also.....name the variable name as JAVA_HOME and the address as C:\Program Files\Java\jdk1.8.0_25\ be sure that you didn't place any semicolon.
According to Oracle's installation notes, you should download/install JDK for the correct system. For your convenience, I have linked to it from the sentence above. If you still encounter problems, leave a comment. I have written some quick code that will tell you if your JVM is 64 or 32-bit, below. I'd suggest you run this class and leave a comment as to its output:
public class CheckMemoryMode {
public static void main(String[] args) {
System.err.println(System.getProperty("sun.arch.data.model"));
}
}
For me this turns out to be Environment Variables not being inherited.
Quick answer: reboot, than click on studio.bat, not studio.exe or studio64.exe
================ Details =================
"Right Click"-"Run as Administrator" works for me if:
** JDK_HOME or JAVA_HOME was set. (PATH didn't need to be changed for me)
** I run studio.bat, not studio.exe
** Note: By Default I am an administrator on a Microsoft Account (That Microsoft part may be affecting things), and I seldom reboot. I'm running Win8.1 64bit. I installed both JDKv1.8.0.0_25 32bit and 64 bit, and had JRE 32bit and 64 bit already installed (used by other software).
I found there was a difference in clicking on studio.bat, studio.exe, and running studio.bat from a command prompt. There is also a difference if I rebooted or not.
The difference: The System Environment Variables aren't all there depending on how I start the program.
To test:
In start menu drag a copy of "command prompt" to your desktop, then change properties so "Start In" is location of studio.bat
copy studio.bat to studio_debug.bat (one we can mess with)
drag a shortcut of studio_debug.bat to desktop for convenience.
edit studio_debug.bat (right click --> edit)
== Change:
#echo off
== to
#echo on
echo Set===================
set
echo ======================
pause
This may also help in debugging studio.bat:
== change:
"%JAVA_EXE%" %ALL_JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*
== to
echo =================
echo Starting: "%JAVA_EXE%" %ALL_JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*
pause
"%JAVA_EXE%" %ALL_JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*
echo =================
Now when you run studio.bat from command prompt versus double clicking you may see difference in environment variables including JAVA_HOME and PATH. If you do you have same problem as me.
The problem seems to depend on:
did you reboot since changing environment variables?
didn't seem to matter if I was local or microsoft account
may depend whether you are an administrator or other account type
whether you start using studio.bat, studio.exe, or studio64.exe
.
FYI: The actual successful startup command executed by studio.bat on my system was as follows (includes studio64.exe):
"C:\Program Files\Java\jdk1.8.0_25\bin\java.exe" "-Xms128m" "-Xmx750m" "-XX:MaxPermSize=350m" "-XX:ReservedCodeCacheSize=96m" "-ea" "-Dsun.io.useCanonCaches=false" "-Djava.net.preferIPv4Stack=true" "-Djsse.enableSNIExtension=false" "-XX:+UseCodeCacheFlushing" "-XX:+UseConcMarkSweepGC" "-XX:SoftRefLRUPolicyMSPerMB=50" "-XX:+HeapDumpOnOutOfMemoryError" "-Didea.platform.prefix=AndroidStudio" "-Didea.paths.selector=AndroidStudioBeta" -Djb.vmOptionsFile="C:\android-studio\bin\studio64.exe.vmoptions" "-Xbootclasspath/a:C:\android-studio\bin\../lib/boot.jar" -Didea.paths.selector=AndroidStudioBeta -Didea.platform.prefix=AndroidStudio -cp "C:\android-studio\bin\..\lib\bootstrap.jar;C:\android-studio\bin\..\lib\extensions.jar;C:\android-studio\bin\..\lib\util.jar;C:\android-studio\bin\..\lib\jdom.jar;C:\android-studio\bin\..\lib\log4j.jar;C:\android-studio\bin\..\lib\trove4j.jar;C:\android-studio\bin\..\lib\jna.jar;C:\Program Files\Java\jdk1.8.0_25\lib\tools.jar" com.intellij.idea.Main
Hope that helps someone else.
Just make sure that the installed version of both, Android Studio and JDK, are of either 32-bit or 64-bit. If JDK is of 32-bit and Android Studio of 64-bit or vice-verse, then it won't work though you set up JAVA_HOME.
My fix was to remove the double quotes that I had enclosed the JAVA_HOME path in.
Instead of declaring JAVA_HOME as "C\Program Files..."
I removed the " and declared JAVA_HOME as C\Program Files...
I am on Win 7, x64
I also faced the same issue. The solution which helped me was I downloaded and installed 64 bit JDK from this link and set the "java_home" variable to the new JDK installed path like C:\Program Files\Java\jdk1.7.0_45. Hope this helps.
Had the same problem after upgrading my machine from 7 to 10 had to reinstall the JDK all overgain and took me only a few seconds.
Here are the steps I followed.
Go to this link
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Agree to oracle contact agreement.Then pick your windows version in my case is 64 bit after that its ..Next..Next,,once compete you can relaunch your Android studio without any problem. Hope this helps
Here comes the solution.
Just start ANDROID STUDIO as administrator if you are using a non administrator windows profile!
If your environment variables are correct that will do the trick. Enjoy!
Android Studio Works Perfectly fine with Java 1.8 or Java 8. I was also having invalid JVM error. The reason was including ";" (semicolon) at the end of JAVA_HOME path value. The correct format for path value is:
C:\Program Files\Java\jdk1.8.0_xx (Replace xx with your current version)
Do not include ; (semicolon) at the end of JAVA_HOME value
In my case
In Control Panel -> System -> Advanced system settings -> Environment Variables there is no JDK_HOME OR JAVA_HOME
SO
I added an entry named: JDK_HOME pointing to: C:\Program Files\Java\jdk1.8.0_25\ (you have to point this to your JDK instalation path)
And all seems to work fine now
You must just install jdk1.8.0 and then right click on my computer icon and then select properties,then in left panel, select advanced system settings, then in dialog bog select Environment Variables, then in that's dialog box,in section user variables create new variable that's name must be JAVA_HOME and path is C:\Program Files\Java\jdk1.8.0(in my pc) then sytem variable section, select PATH variable and append it's end this path C:\Program Files\Java\jdk1.8.0\bin and then select ok for all dialog box and after this steps run Android studio. And for test, run cmd in windows and run this command java -version if returned a java version and ... it is installed correctly.
Note: I get answer in windows 8.1 64 bit.
This is tested on my Windows 7 64Bit machine.
Quite strange... I had the same issue - WHILE IntelliJ Idea (including the Android Plug-in) was working perfectly.
However, here is what I did to get Android Studio 1.0 working (no step missing -> maybe it will help programming beginners).
Just set up a new environment variable by...
pressing Windows-Key and typing env... you'll see "Edit the system environment variables". Click!
Now click "Environment Variables..."
Under System variables (NOT "User variables") add a new entry named JAVA_HOME and set the value to your Java folder (like C:\Program Files\Java\jdk1.8.0_25)
apply and you are good to go.
PS: I don't know why some people writing about nuclear science when they want to explain how to set the Java path..
The solution is given in the error itself, Goto My computer(Right click)-->properties-->Advanced system settings-->Environment variables-->Create new variable.
Give the following details to it:
Variable name : JAVA_HOME.
Variable value : (your path to java jdk installation folder).
To find the path for java installation, go to program files in your window installation drive (normally C drive). Find folder named JAVA, in that navigate to JDK folder.
Copy the link address from the top, and paste it in the Variable value .
Now Press Ok and once environment variable gets created restart the android studio.
Hope it helps.
if your "enviornment variables" set well, than try to update
Start > All Programs > Android Studio > Android Studio
do right click, click Properties and set android studio sdk path
in
shortcut > Target
If you are using windows 7, make sure you install jdk-xxxx-windows-x64.exe.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I had previously installed 32 bit instead of 64 bit version hence it was installed in program files x(86) folder. But if you install 64 bit sdk setup, its installed in program files folder.
Then set the JAVA_HOME='C:\Program Files\Java\jdk1.8.0_65'
It should work fine.
My variables pointed to other system variables so JDK_HOME was
%programfiles%\Java\jdk1.8.0_45
and i had to explicitly change it to
C:\Program Files\Java\jdk1.8.0_45
Similar for JAVA_HOME
My JAVA_HOME was pointing to c:/jre directly. So I changed it to C:/java/jre because it was confused to pick up which one to use, so I changed it to the specific one and it works for me. Note: It is better to have only one JRE install on your machine
I solved the problem in my case by deleting file
C:\Users\username.AndroidStudioX\studio64.exe.vmoptions
( x denotes the version of your android studio so it can be different ) , because I created it before to customize VM options.
It's that simple
Add the your installation path and java path to the default system path by separating the ;
Right click on My Computer-->Properties-->Advances System Setting-->Advanced -->Environment Variables-->Under System Variables category find the "Path"-->add the android installation path and java path by separating with ;...
Believe it works
If it does not work after setting paths in environment variables correctly,
Reinstall Android Studio and it worked for me.
Under my Android Studio\bin there are two folder
studio.exe and studio64.exe
I tried to run the first program and it gives me the mentioned error.
But when running studio64.exe it works.
If setting JAVA_HOME not works, install Visual Studio C++, you can download "all versions in one" installer here: https://www.techpowerup.com/download/visual-c-redistributable-runtime-package-all-in-one/
I think Android does not support Java 8. Officially android need java 6 as mentioned at the below:
https://developer.android.com/sdk/installing/installing-adt.html
Here I'm providing you a good link, hope those will clear this question :
Is it possible to use Java 8 for Android development?
For crying out loud this is so VERY EASY TO Fix!!
Go to : "Control Panel\All Control Panel Items\System" once there click on "Advanced system settings" on the left hand side
The window that pops shows a box that says says Environment Variables! Click it.
Click "add new" to add new variable.
Type JAVA_HOME in the first box and in the second box the address to, IE / in my case C:\Program Files\Java\jdk1.8.0_25 save it. exit everything. THATS IT!!
Enjoy Android Studio!
Obviously for the above to work you have to install java first or how else can you use it or point to it on your pc and all that. The above instructions are amazingly mislead and complicated. For the record I am on widows 8.1, YES it works on latest windows and is ridiculously simple to fix.
-OSG

JAVA_HOME does not point to the JDK

I am trying to follow a tutorial about how to use ant to build and run your application. I've followed all the steps and have created the build file, but when I try to run ant it gives me this error.
BUILD FAILED
/home/bilal/tmp/ant/build.xml:19: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-6-openjdk/jre"
Any ideas how to resolve this issue ?
Make JAVA_HOME variable point to a jdk installation, not jre.
You are referencing the runtime environment, not the development kit - it can't find the compiler because its not there.
From the line you posted, which states you have open-jdk you can just remove the jre at end:
export JAVA_HOME='/usr/lib/jvm/java-6-openjdk/'
You installed java...
apt-get install default-jre
But not the JDK...
apt-get install default-jdk
This is by design. You cannot use ant's java.home (which is a java.lang.System property) interchangeably with how JAVA_HOME is set in the OS environment. You are probably trying to assert the location of the Java compiler with a fundamentally different value from a different property layer -- i.e. java.home (from Ant's Java internals) points to the Java Runtime Environment at <any_installed_java_pointed_to_by_ant>/jre while JDK_HOME (from the OS environment) is usually set to <DOWNLOADED_AND_INSTALLED_JAVA_DEVELOPMENT_KIT>.
See my question and answer here for more details: Where does Ant set its 'java.home' (and is it wrong) and is it supposed to append '/jre'?
The solution is to access the system environment property within Ant by using ${env.JAVA_HOME}. Specify which java to use explicitly in the Javac Task by setting the executable property to the javac path and the fork property to yes (see Ant's Javac Task Documentation). That way, it doesn't matter what Java environment Ant is running inside, the compiler is always clearly specified!
I know this question is old but the accepted answer does not work anymore and since this is the fist link on google search i'll tell how i solved this problem.
for eclipse using ubuntu:
go to Window->Preferences->Ant->Runtime->Select Ant_Home_Entries and click on add external jars then find in file explorer where your jdk is (default is in /usr/lib/jvm/) and in the lib folder of your jdk you will find the tool.jar. select this one and click apply.
try to build your project and things should work!
note: i hadn't used ant for a long time but needed it for ycsb couchbase workload generator (http://www.couchbase.com/wiki/display/couchbase/Load+Generator+Setup) if anyone is/was stuck on this.
It looks like you are currently pointing JAVA_HOME to /usr/lib/jvm/java-6-openjdk/jre which appears to be a JRE not a JDK. Try setting JAVA_HOME to /usr/lib/jvm/java-6-openjdk.
The JRE does not contain the Java compiler, only the JDK (Java Developer Kit) contains it.
I am using Windows 7 and have struggled with the same issue. I fixed it by changing my environment variables.
To change your environment variables click here
I added ";%JAVA_HOME%/bin" to the end of paths variable and added a new "JAVA_HOME" variable and set its value to the location of my JDK "C:\Program Files\Java\jdk1.8.0_11". After that I restarted my Node.js command prompt and it worked.
Please note you JDK directory may be different then mine. Also depending on your setup, you may need to restart you computer after setting the environment variables.
The JAVA_HOME you have above only points to the JRE, which does not contain the compiler. Set your JAVA_HOME to
/usr/lib/jvm/java-6-openjdk
...and try again.
I had a similar problem and it turned out the issue was having both versions 6 & 7 of OpenJDK. The answer comes from r-senior on ubuntu forums (http://ubuntuforums.org/showthread.php?t=1977619) --- just uninstall version 6:
sudo apt-get remove openjdk-6-*
make sure that JAVA_HOME and CLASSPATH aren't set to anything since that isn't actually the problem.
for centos yum -y install java-1.7.0-openjdk-devel.x86_64
and update JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86-64
I just copied tools.jar file from JDK\lib folder to JRE\lib folder. Since then it worked like a champ.
Experienced this issue when trying to run the android emulator with Meteor 1.0 on elementary OS Luna (based on Ubuntu 12.04 LTS sources).
openjdk-6-jdk was installed, as well as the jre. In the end, not expecting any success, I tried:
sudo apt-get remove openjdk-6-*
this resulted in fully expected errors, so I followed up with
sudo apt-get install openjdk-6-jdk
and things worked. Go figure.
On Ubuntu 14.04, I found two parts to solving the problem:
Remove /jre from the environment variable. For me: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
Install the JDK as well as the JRE: sudo apt-get install default-jdk
Once you update the JAVA_HOME path as stated in the answer, you should do this:
$source ~/.bashrc
This will refresh bashrc show the updated path in $JAVA_HOME when you check again.
Execute:
$ export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-3.b16.el6_9.x86_64
and set operating system environment:
vi /etc/environment
Then follow these steps:
Press i
Paste
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-3.b16.el6_9.x86_64
Press esc
Press :wq
I met this issue in rhel, my "JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk"(which is a symbolic link), and ant complains.
MY solution for this is to use the real jdk path in JAVA_HOME, like:
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64
It works for me.
Under Jenkins it complains like :
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/ doesn’t look like a JDK directory
Reason : Unable to found any Dev Kit for JDK.
Solution:
Please make sure to install openjdk-devel package as well along with your JDK-1.8* version and reexport with : # source ~/.bash_profile

SDK Manager.exe doesn't work

When I clicked SDK Manager on Program Files or run it in cmd, nothing happened. I did:
Installed latest JDK
Installed latest Android SDK
Set environment JAVA_HOME and put %JAVA_HOME%\bin in path variable**
Actually a black cmd window appears and disappears a milliseconds.
How to fix it?
Edit:
I Googled day by day but can't find a solution for this. Even I set path for ANDROID_SWT it also can't run. I suspect that Android SDK has bug in its installation package.
Android installation - sdk manager.exe does not work
Android installation/SDK Manager issues
I'm totally exhausted and this is the last my try:
Uninstall JDK, Android SDK, remove all ANDROID or JAVA environment variables
reinstall JDK and Android SDK
But nothing changes.
Edit:
Actually this is the second time I meet this problem. I got this problem only after I added more Environment variables for Ant and Maven. This is the summary:
Install Windows XP SP3 --> Install JDK --> Install Android SDK --> Open SDK Manager and it works! --> append some more "bin" path of Ant and Maven in "path" variable --> Open SDK Manager and it doesn't open --> I rolled back by removing all environment variables --> SDK Manager still no opens! That's very strange! --> It is stranger when I reinstall JDK and Android SDK, it still no opens! :(
Step #1: Open up a command prompt.
Step #2: Use the cd command to move to wherever you installed your Android SDK.
Step #3: Run tools\android.
If that does not work, you should have information dumped to the command prompt that will help you diagnose your setup problem.
I was getting the error "C:\Program is not recognized as an internal or external command"
Followed by loads of "unable to copy file"
Followed by something about Android_SWT not being able to be found.
The way I fixed the problem on my system (Windows 8, 64 bit, JDK 7) was:
Create JAVA_HOME environment variable and point it to C:\Program Files\Java\jdk1.7.0_10\bin
Open ANDROID SDK DIRECTORY\tools\android.bat in your favorite text editor
Find the lines set java_exe= call lib\find_java.bat (it's split over 2 lines)
Replace the lines with set java_exe="%JAVA_HOME%\java.exe"
Save and run tools\android.bat
The problem was that the the space in the path was not being handled correctly. By wrapping the path in quotation marks, the space is then correctly catered for.
I had the same problem.
when i run \tools\android.bat, i got the exception:
Exception in thread main
java.lang.NoClassDefFoundError: com/android/sdkmanager/Main
My resolved method:
edit \tools\android.bat
find "%jar_path%;%swt_path%\swt.jar"
modify to "%tools_dir%\%jar_path%;%tools_dir%\%swt_path%\swt.jar"
save, and run SDK Manager.exe again
After a lot of searching and trying different methods, I found the solution to the problem at my end: SDK Manager couldn't find my profile directory. After setting the environment variable ANDROID_SDK_HOME (I set mine to a newly created folder C:\Android), SDK manager started no prob.
I have Wondows 7 64 bit (MacBook Pro), installed both Java JDK x86 and x64 with JAVA_HOME pointing at x32 during installation of Android SDK, later after installation JAVA_HOME pointing at x64.
My problem was that Android SDK manager didn't launch, cmd window just flashes for a second and that's it. Like many others looked around and tried many suggestions with no juice!
My solution was in adding bin the JAVA_HOME path:
C:\Program Files\Java\jdk1.7.0_09\bin
instead of what I entered for the start:
C:\Program Files\Java\jdk1.7.0_09
Hope this helps others.... good luck!
My issue was the following error on windows 7:
C:\dev\Android\android-sdk-windows\tools>android
[INFO] Starting Android SDK and AVD Manager
No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3550 or
swt-win32 in swt.library.path, java.library.path or the jar file
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
at com.android.sdkmanager.Main.showMainWindow(Main.java:292)
at com.android.sdkmanager.Main.doAction(Main.java:276)
at com.android.sdkmanager.Main.run(Main.java:99)
at com.android.sdkmanager.Main.main(Main.java:88)
The solution was to disable McAfee 8.8. Apparently some recent update is now blocking my Android environment.
The way I solved your last problem was by right clicking the android.bat file, and chose edit with notepad++. I then went down to the part of the program where it had this bit of code:
cd /d %~dp0
It was also some other lines of code, but I deleted them. After deleting these other lines I simply just wrote(under the cd /d %~dp0):
cd Program Files
cd java
cd jdk1.7.0_03
cd bin
I dont know here you java.exe file is located but mine was at lest located there.
I ran into this problem: I'd get the error
C:\projects\Android\android-sdk-windows-1.5_r1\tools\lib>ddms
02:03:07 E/ddms: shutting down due to uncaught exception
02:03:07 E/ddms: no swt-win32-3550 or swt-win32 in swt.library.path, java.library.path or the jar file
java.lang.UnsatisfiedLinkError: no swt-win32-3550 or swt-win32 in swt.library.path, java.library.path or the j
ar file
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.graphics.FontData.<init>(Unknown Source)
at com.android.ddms.PrefsDialog.setDefaults(PrefsDialog.java:221)
at com.android.ddms.PrefsDialog.init(PrefsDialog.java:150)
at com.android.ddms.Main.main(Main.java:74)
I got this solved by copying the swt file from eclipse into the tools directory. If you search in the directory you have Eclipse installed there is an SWT dll, named something like swt-win32-<4-digits>.dll (mine was named swt-win32-3740.dll): I copied that into the tools directory, and everything worked after that.
I solved my problem opening android.bat inside sdk/tools and setting the java_exe property, which was empty.
set java_exe="C:\Program Files\Java\jre6\bin\java"
Similar to sixty9 I renamed java.exe, javaw.exe, javaws.exe (I never delete files when troubleshooting) after I created a JAVA_HOME environment variable and added path variables.
I had installed the Java SDK on my D:\ drive ( instead of the default).
Create a JAVA_HOME variable: Variable Name: %JAVA_HOME% Value: D:\Program Files\Java.
Added the following to the Path variable:
%JAVA_HOME%\jre7\bin;%JAVA_HOME%\jdk1.7.0_03\bin;
Renamed java.exe, javaw.exe and javaws.exe.
Restarted the system and the Android SDK installer found my JDK and installed successfully.
I add new environment variable "ANDROID_SDK_HOME" and set it, like my path to android SDK folder (c:/Android) and it's work!
And if tools\android works for you while .exe doesn't, it's probably the x64 java.
It started working when i completely uninstalled JDK with JRE (shows as separate option in windows uninstal control panel applet) and android sdk and reinstalled using x86 version.
Why does it worth the time, you may ask? Well, such an inconsistency obvoiusly means that amount of testing with x64 java is zero and so you can probably experience many other failures in the future.
Finally got this torterous SDK to run.
When installing 32bit Java on 64bit windows system, set ANDROID_SWT to e:\android-sdk\tools\lib\x86
not ..\x86_64
Dear Android SDK team,
I genuinely hope some serious attention is being paid to these problems. SDK should be effortless to set up. This is how you lose customers to other platforms where this kind of thing is a one-click ordeal.
I was going to buy another android device to test my game on, but after last 2 days trying to traverse the maze of your incompetence I think i'll just stick with iOS as my main development target.
I solved this problem, which occured for me after manually installing the ADT (4.2/api 17) bundle on Windows 7 64 bit in C:\Program Files.
The steps I had to take:
Set the JAVA_HOME environment variable to the installation directory of the (64 bit) JDK, C:\Program Files\Java\jdk1.7.0_11 in my case.
Run SDK Manager as administrator at least once. SDK Manager allows you to change files in Program Files, so you should give it the proper access rights.
None of the Solution worked for me
Just open sdk/tools/
Edit android.bat
Replace set java_exe="C:\Program Files\Java\jdk1.7.0_13\bin\java.exe" //your java path
Copy the sdk manager and avd from any tools/lib if its not in sdk/ base folder
I FINALLY GOT THIS WORKING AFTER 2 SOUL DESTROYING EVENINGS OF TRYING! IF I EVER MEET AN ANDROID SDK DEVELOPER I WILL HACK HIM TO DEATH WITH HIS OWN KEYBOARD
Anyway, tips for getting it working on Windows 7 64 bit...
I suspect for me it was multiple problems as none of the suggestions worked so I will list all the things I did to finally get it working
1) Install the 32 BIT version of Java JDK (yes, even if you are running 64bit Windows)
2) Install both the SDK and the JDK to paths that have no spaces in (I used C:\Android and C:\Java32)
3) In the Windows environment variables screen (System Properties > Advanced Settings > Env vars), there's two places you can enter the variables, the "User Variables" and "System variables". I put them in both and included the "bin" bit in both e.g.
JAVA_HOME = C:\Java32\jdk1.8.0_20\bin
Path = C:\Java32\jdk1.8.0_20\bin;other paths should come AFTER the jdk...
4) Edit the file tools\android.bat and look for the following:
set java_exe=
call lib\find_java.bat
change this to:
set java_exe="C:\Java32\jdk1.8.0_20\bin\java.exe"
rem call lib\find_java.bat
You can also put the "#echo off" to "#echo on" at the top of the file for debugging purposes
Good luck!
I had this same problem and after trying a variety of things like changing the path variables I went to java.com on a whim and downloaded java, installed, and lo and behold the sdk manager worked after that.
Had the same problem and tried everything I browse in several forums till I found a clue, then finally solved the problem.
Basically I installed the SDK and worked ok, then my Windows Vista crashed, on restart I run SDK again but it only opened a CMD window which closed immediately.
So here's a list of useless things I did:
Went to CMD "d:/java/android/tool" and execute "android.bat", didn't work and show an pointer exception error.
Reinstalled the whole thing JDK + SDK
Changed the system path to a new folder
I traced and deleted all android occurrences on Regedit
At this point I was seriously considering start learning objetive-c was not a bad idea, finally I did this:
delete ".android" folder from "c:/users/youruser/"
delete all files within "c:/users/youruser/AppData/Local/Temp"
reinstall SDK
it WORKED !! I'm not sure though if is necessary to uninstall SDK (since I had again to download all packages & platforms) and just clear the temp folder.
Hope this helps.
I fixed this issue by reinstalling it in Program Files, it originally tried to install it in c:/Users/.../AppData/Android/....
Mine was caused by a user permission issue that running as admin didn't seem to fix (perhaps because they call batch files?).
I had the same problem, running X64 Java (1.7.0_03-b05). Even though I had both C:\Program Files\Java\jre7\bin and C:\Program Files\Java\jdk1.7.0_03\bin listed in my path, it wouldn't start - just flashed a command prompt.
The tools\lib\find_java.bat file was reporting that it was attempting to run C:\Windows\system32\java.exe but failed. Huh? I checked, and found outdated copies of java.exe, javaw.exe and javaws.exe in my C:\Windows\system32. How did those get there, I didn't put them there!
I deleted those three files from C:\Windows\system32 and the problem was fixed.
Thinking about it, the problem likely would have been fixed by making sure thatC:\Program Files\Java\jre7\bin and C:\Program Files\Java\jdk1.7.0_03\bin were at the START of my PATH variable instead of tacked onto the end.
I was experiencing the UnsatisfiedLinkError on Windows 7 64-bit after installing adt-bundle-windows-x86_64-20130717.zip:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3550 or swt-win32 in swt.library.path, java.library.path or the jar file
The root cause was that McAfee has a feature that blocks loading DLL's from the temporary directory. This is a problem because android.bat copies a bunch of JAR and DLL files to a temporary directory and runs the program from there, to make it easy to upgrade the app in-place.
This feature can be disabled, however. You can either disable "Access Protection" altogether or only disable the feature that blocks loading DLLs from temporary folders.
I had the same issue!
I had installed the ADT bundle 64-bit, so I downloaded Java 64-bit. I messed around with paths and things, but the thing that fixed it in the end was installing Java 32-bit.
The easy fix is to install both versions. You can download them manually here.
Good luck!
When I clicked SDK Manager on Program Files or run it in cmd, nothing happened
One of your problems is Long File Names in Windows. A number of the Android tools cannot handle them. I filed a bug report on them years ago, but I can't find it at the moment. I also seem to recall something about it in the INSTALL or README.
So you should install the tools in a location without spaces. Use something like C:\Android\ or C:\Android-SDK\.
#Steve and #MeatPopsicle already mentioned spaces in the pathames, but it can't be overstated.
Actually a black cmd window appears and disappears a milliseconds.
...
Even I set path for ANDROID_SWT
Out of curiosity, where did ANDROID_SWT come from?
I know Android does use ANDROID_HOME, ANDROID_SDK_ROOT and ANDROID_NDK_ROOT, and the last two should both be set because the tools use them internally. Here's the reference on ANDROID_SDK_ROOT and ANDROID_NDK_ROOT: Recommended NDK Directory?.
So you should set the three environmental variables (after ensuring the installation directory does not contain spaces):
ANDROID_HOME
ANDROID_SDK_ROOT
ANDROID_NDK_ROOT
ANDROID_HOME is set to the directory where the hidden directory .android is.
ANDROID_SDK_ROOT is set to the directory where the SDK is installed, like C:\Android-SDK\.
ANDROID_NDK_ROOT is set to the directory where the NDK is installed, like C:\Android-NDK\. If its not installed, then don't set it.
Once you have ANDROID_SDK_ROOT set, you can put %ANDROID_SDK_ROOT%\tools and %ANDROID_SDK_ROOT%\platform-tools on PATH. Then, you can drop into a command line and issue something like this (and it just works):
adb list
What I did was:
set a new environment variable in the top user section.
VARIABLE NAME: JAVA_HOME
VARIABLE VALUE: set it to the installation directory of your most recent JDK.
For me it was, C:\Program Files\Java\jdk1.7.0_13 . Run SDK Manager as administrator at least once. I use windows 7. This method worked for me after a lot of research.
What I dont understand is when using 'where java' in the command prompt it still references C:\Windows\System32\java.exe. My SDK Manager now opens when I need it so I solved my problem.
find_java.exe doesn't seem to like the openjdk "java -version" output. I edited find_java.bat like this:
for /f %%a in ('%~dps0\find_java.exe -s') do set java_exe=%%a
set java_exe="C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.242.08-hotspot\bin\java.exe"
rem ...
for /f %%a in ('%~dps0\find_java.exe -s -w') do set javaw_exe=%%a
set javaw_exe="C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.242.08-hotspot\bin\javaw.exe"

eclipse not working - No java virtual machine was found

I installed eclipse and netbeans on mac osx 10.6
I installed android sdk and everything was working perfectly.
Now I installed mac ports
and installed ImageMagick using macports
Now after restarting the system neither netbeans work nor eclipse.
Net beans closes without any error. and eclipse give following error :
A JDK or JRE must be installed in
order to run eclipse No java virtual
machine is found after searching the
following location:
/Users....../eclipse.app
ContentsMacOS/jre/bin/java java in you
current PATH
I thought the problem might be with the path.
So I tried running java and javac from terminal. But these two commands run properly.
note: I don't have javaw (I am not sure whether we have this file in mac or not.
Can I know what can be the problem and how can I fix it ?
In the Eclipse.app/Contents/MacOS/eclipse.ini file put
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java
right before
-vmargs
should help, I hope ... I hope
Check your Eclipse directory -- and look in eclipse.ini for this line:
-vm
<path to java.exe - e.g. C:/Program Files (x86)/Java/jdk1.6.0_18/bin/javaw.exe>
You're probably missing that
For newer versions: Mac OS X El Capitan Version 10.11.6 path to current Java version is:
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
For Eclipse Neon.1 open the eclipse.ini file from
Eclipse.app/Contents/Eclipse/eclipse.ini
and update the vm argument to:
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
just before
-vmargs
For me updating the eclipse.ini with -vm did not help. Rather, I had to update Eclipse.app/Contents/info.plist with below content(replace $Actual Java location$ with location of java:
<string>-vm</string><string>*$Actual Java location$*</string>
For windows 7 - 64 bit users ( may work for others too )
you may do the following
1. If the java Runtime is NOT already installed, (Note it does not get installed along with Android SDK, you need to download it separately ). You can download from here http://www.oracle.com/technetwork/java/javase/downloads/index.html (select 'Java Platform (JDK) 7u21' out of the three option the first button :) )
after install you will find javaw.exe in " C:\Program Files (x86)\Java\jre6\bin"
2. set the environment variable the steps as below
a) Right click Computer, select properties, select 'advance system setting'
b) Under Advanced tab select the last button 'Environment Variable'
c) Under System settings in the window that comes next search for 'Path'
d) select 'Path' click edit
e) Add the '; C:\Program Files (x86)\Java\jre6\bin' (this path or which ever path its installed in your machine, semi colon is used to separate other pre-existing path variables, and no need of quote ;) )
Thats all !! Now try running Eclipse.exe ( note : if you have added the entry in eclipse.ini as suggested by some ..please remove it else it will throw another exception)
Remember no need to change the eclipse.ini
It works Just double click the eclipse.exe :)
OK. So I did add
`-vm
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java`
to eclipse.ini file but it was always overwritten when I restarted the Eclipse.
So, the thing I have done is:
I've created the folder structure mkdir -p jre/Contents/Home/jre/bin/ in main eclipse folder
Changed dir to: cd jre/Contents/Home/jre/bin/
Made symlink to $JAVA_HOME/bin/java folder: ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
And after that Eclipse works every time!
Hope this helps :)
In eclipse Go to Windows --> Preferences --> Java --> Installed JRE's and see whether any JRE in mentioned there.
Caveat: I don't know anything about the Mac, so YMMV.
Check your JAVAHOME environment variable. On most systems, that is how the JRE broadcasts its location to apps that want to run under the current JRE.
Download the offline executable file on Java.com and make sure that if your system is 32-bit or 64-bit you should download the one that is appropriate with your system. After installing Java try running eclipse and it should run.
Go to "environment variables" from "advance system settings".
Add JAVA_HOME variable (both user and system variables) and value= "path of jre" example: "C:\Program Files\Java\JDK_1.8\jre\bin".
Add jre path to "Path" variable "...; C:\Program Files\Java\JDK_1.8\jre\bin".
Then it works..
If still there is a problem, copy jre directory to path where Eclipse IDE Application works.
Launching eclipse via terminal worked for me. Try that.
#all thanks a lot.
It some or how works after two restarts don no why..
Thanks and sorry for the trouble

Categories