Set JDK location for Android Studio without an Enviroment Vairable - java

I am running Windows 7 and just upgraded my Android Studio and it is not working anymore. I get a dialog that says it cant find the jdk. I have version .9 now. I do not have admin rights so I can not edit my Enviroment Variables. Is there a way I can tell Android Studio where the JDK is. Maybe command line args? I havent found any source that outlines if there are any.
Please note that I can not run Android Studio, so I cant update it from inside the application.
Also, I do have Cygwin.

Since, Android Studio was working before and only broke after the update, please check the Studio shortcut you're using to launch the IDE. By default, Android Studio points it to studio64.exe. If you have a 32-bit Java JDK installed use the studio.exe to launch the IDE.
If that doesn't help, see if you can create a JAVA_HOME user variable? You maybe able to do that even though you have a limited account. If you are unable to do so, as a last resort, move/copy the JRE (not JDK) into the Android Studio install location (right next to bin). You need to name the folder jre or jre64 depending on which launcher you use studio.exe or studio64.exe.

I solved this. I download the Server JRE from the Oracle page. I then decompressed the gzip and untared it. I then then added to my ~/.bashrc file in cygwin "export JAVE_HOME=". Studio was able to find this.

Related

Android Studio: "Gradle sync failed: Could not run JVM from the selected JDK."

Ever since installing Android Studio 3.2, I haven't been able to run Java, I have tried jdk-8u181-windows-x64, jdk-10.0.2_windows-x64_bin, jdk-11_windows-x64_bin, setting PATH and reinstalling everything umpteen times, the result is the same - no "java" appears and the error message is: -
Gradle sync failed: Could not run JVM from the selected JDK.
Please ensure JDK installation is valid and compatible with the current OS (Windows 8.1 6.3, amd64).
If you are using embedded JDK, please make sure to download Android Studio bundle compatible
with the current OS. For example, for x86 systems please choose a 32 bits download option. (369 ms)
Notes: I used to be able to open the java folder but after playing with it too much, something went wrong, so, I decided to start afresh... and I am dead ever since.
Is Studio 3.2 flawed? Not compatible with Java at all? Or am I missing something? is there a older Android Studio I can test? Thanks for any help you may provide.
In my case, the following solved it:
File->Other settings->Default Project Structure...
In "JDK Location", I previously had the oracle jdk selected. To fix this issue, I instead checked "Use embedded JDK (recommended)"
Solved YES
Other Settings ---> Default Project Structure ---> Uncheck Embedded jdk ( Write Your Own jdk Location )
In my case, the following solved it:
File->Other settings->Default Project Structure...
setting the JAVA_HOME environment variable to C:\Program Files\Java\jdk1.8.0_181
my JDK Source File
Try setting your SDK location. I had the same problem with Android Studio 3.2 (but I also switched to openjdk, so that could be the source of my problem). Anyway, after pointing SDK location to the root of my JDK it worked like a charm.
To change SDK location click on the Android project Window and then press F4. In the new Window choose SDK location and set it to point to the root of your JDK.
i got mine working by setting the JAVA_HOME environment variable to C:\Program Files\Java\jdk1.8.0_181\bin my jdk folder

Android Studio is NOT detecting my newest version of JDK, and instead using my old one >:(

Ok so anyone answering please be aware that I am a complete beginner to all of this. But I have installed jdk1.8.0 because that is what the newest version of android studio needs, but when I open Android studio up, it says I still need to change it. So after a lot of research I made a new Java_Home variable and set the directory to where my jdk file was. I then went into android studio file, project structure, then changed that jdk directory as well. However, when I click ok, It still doesn't work, and when I go back to the project structure, it changes from jdk version 8, to my old jdk version 7 directory. For some reason it isn't saving :(. I would really appreciate some help here.
You could try to disable the old JDK in the "Java Control Panel" (JCPL). Start the JCPL by double-clicking on jre\bin\javacpl.exe (it's a Swing application, i.e. it has a GUI). Choose tab "Java" and click on the button "View ..." to see a table with all installed JDKs. Each JDK has a checkbox "Enabled", which should be unchecked for the old JDK.
When you restart Android Studio after this it should ask you for the path of the JDK.
The following question might also be helpful to solve this issue: Android Studio JDK location changes back to 1.7 every time it is updated to 1.8 path

JAVA_HOME Path works for Java but not for Android Studio

THIS QUESTION DOESNT HAVE AN ANSWER, THERE IS NO DAMN BACK BUTTON IN MY CASE!!!
Solution: ITS STILL NOT WORKING IN JDK8, you have to use ordinary Android SDK or Android Studio with JDK7! Thanks to Elliot Frisch's comment.
i hope thats the right metasite for that kind of stuff. i have properly installed java JRE and Java JDK. I can compila and execute java from commandline but if i try to install androi studio i get an error that JAVA_HOME doesnt point to a valid JVM installation.
are there additional things i have to install before using android studio or is the JAVA_HOME path different for android studio?
i put
C:/.../jre.x.x
C:/.../jre.x.x/bin
C:/.../jdk.x.x
C:/.../jdkx.x/bin
to my JAVA_HOME Path.
First, set your JAVA_HOME to only one folder (and it's the parent of bin)
set "JAVA_HOME=C:/.../jdk.x.x"
Add it to your path like
set "PATH=%PATH%;%JAVA_HOME%\bin"
I recommend to see these pages for more information, and always search before asking, I'm sure you can find the answer more quickly.
Android SDK installation doesn't find JDK
Setting JAVA_HOME at Android SDK
in windows just setting
JAVA_HOME environment variable to only "C:\Program Files\Java\jdkx.x.x_xx" is enough.
x x x -> relate to your JDK version.
C:\Program Files\Java\ -> depend to your java installation directory

Setting environment variable for Eclipse?

I have set the CLASSPATH and HOME_PATH for my JDK in the windows environment variables, do I need to set anything similar for Eclipse in order to compile Android programmes?
The problem I'm having is that Eclipse can be opened and create a program as simple as the Helloworld example, seems to be not an exact way to compile and then I can pack into any execution file so my little Android phone can install with.
Android requires more than just Java, but also the Android SDK. To get it working with Eclipse, you'll also need the Eclipse Android plugin. So, if you can run the HelloWorld program, Java is working. Follow instructions to get Android working here:
http://developer.android.com/sdk/index.html
Also, there's a couple links under the "ADT Bundle" section to just download a self-contained version of Eclipse bundled with the Android SDK to save you from installing the Eclipse Android plugin and configuring anything. You'll unzip the folder in a convenient directory, then see two folders: the Android SDK and another containing Eclipse. You can just run the Eclipse.exe in the Eclipse folder and your Android environment is good to go.
Do you have the android SDK? If not, get it here. It comes with eclipse IDE with all the required things already set up.

Android SDK Zip - Windows 64bit Home Variable

I'm using the android_sdk.zip version, since I don't feel comfortable using installers on Windows systems. However, I understand that I need to set the Home variable in order for the SDKManager.exe to run properly. I tried another method posted on stackoverflow, but if I do that, then both Eclipse and Netbeans, won't find Java anymore.
"C:\Program Files\Java\jdk1.6.0_25\bin';'"
Any ideas?
Thanks!
I believe there may be a bug in the installer for Windows, as I haven't seen it work properly at detecting a JDK on Windows 7 at all.
If you are planning on developing in Eclipse, it isn't even required. You'll save yourself a lot of time and headache if you just download and install the SDK zip file (instead of the installer EXE).
Download and unpack this file somewhere on your machine
Install the ADT plugin into Eclipse
Point ADT to the location you unzipped the SDK in Preferences
HTH

Categories