Cannot set JAVA_HOME - android

I am currently trying to compile a qt project to run on an android tablet and the build process works as expected, but when I try to deploy it, it quits saying it can't find the javac compiler because JAVA_HOME is set to the place where the JRE resides.
I have already tried adding JAVA_HOME to the build environment in Qt Creator, then in the/etc/profile file and finally outputting the JAVA_HOME variable from the script that starts ant and they all point to the correct path.
I have also tried to grep through all the files for the JRE path string literal, but this didn't yield any results.

You'd want to install the JDK. Just the JRE won't be enough.
This is because only the JDK has the Java compiler, JRE is just the Java Runtime Environment.

After a few unsuccessful attempts I found that it was in fact looking for the tools.jar file that got moved to another location in openjdk 7, even though the error messages were referring to JAVA_HOME.
I installed openjdk 6 and it works now

Related

RAPT: Whats wrong with my JDK?

Well, as the question says I have some trouble getting RAPT to run the command:
python android.py installsdk
It usually returns:
I'm compiling a short test program, to see if you have a working JDK
on your system.
I was unable to use javac to compile a test file. If you haven't
installed the Java Development Kit yet, please download it from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
The JDK is different from the JRE, so it's possible you have Java
without having the JDK. Without a working JDK, I can't continue.
I have tried many versions of JDK, I have checked the variable "PATH" and I can run javac with no problem. I need a specific version of JDK? (I´m using Python 2.7, 32 bits)
JDK is java development tool kit
JRE is java run-time environment only.
If you have compiled java jar or class file jre is good enough, you do not require jdk.
but if you want to compile java source code you will require javac that comes with JDK.
Try setting JAVA_HOME environment variable.

Gradle sync failed Invalid Project Jdk

Getting fed up with this problem, heard android studio is better than eclipse in many ways, but I cant even start a single project with it because of this error, tried many solutions still its showing same thing, First i thought it was only when importing old eclipse project, but its not.
1) I tried uninstalling every jdk and jre and installed latest JDK 1.8.0_65 and set all paths and JAVA_HOME
C:\Users\username>java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
C:\Users\username>javac -version
javac 1.8.0_65
C:\Users\username>set JAVA_HOME
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
2) Reinstalled android studio
3) Updated all sdk using sdk manager
still if i try to start a new project, i am getting the error
8:10:45 PM Invalid Project JDK
Please choose a valid JDK directory
Open JDK Settings
8:10:45 PM Gradle sync started
8:10:45 PM Gradle sync failed: Invalid Project Jdk
JDK Location by default it is showing C:\Program Files\Java\jdk1.7.0_10, And i am changing it to C:\Program Files\Java\jdk1.8.0_65, But seems like its not getting applied.
By the way, I am using 64 bit windows 7 and installed 64 bit java.Hope someone can guide me from this mess, its been few night am wasting time on this.
Adding screenshot of my JAVA_HOME
Below is the screenshot of JDK location that is showing inside android studio
In Android Studio 1.5.1, this error was shown in red: "Android SDK location should not contain whitespace, as this can cause problems with the NDK tools." The problem was never with the JDK location. It was with the SDK Location.
I moved the SDK folder out of Program Files because of the whitespace, changed D:\Program Files\Android\sdk to D:\Android\sdk, and the JDK location then stayed. Android Studio does not seem to like saving the JDK location value if there is an error with the SDK location.
Don't use cmd line, just do it normally.
if you use a error path, it will warn you .
go to your
C:\programFiles\Java
copy your Java folder
then go to your
C:\programFiles(x86)
paste the files there.
then go back to your androidstudio change your JDK directory to this
C:\programFiles(x86)\java\jdk1.8.0_74.
"mine is jdk1.8.074 yours might be different, put whatever yours is"

cordova add platform - Error executing command 'ant'

In the beginning..
I know that this question has been asked way too many times and.. I checked all ansers on SO. Tried every combination and every solution I found but nothing has worked for me so far.
The problem
I've succesfully installed cordova downloading it from the official site and I've been following the Guide.
I've added wp8 platform succesfully first. Then I tried to add android as well.
After executing the command cordova platform add android, I got the following error.
Error: executing command 'ant', make sure you have ant installed and added to your path.
Here's a screenshot with more details:
My efforts
I've installed ANT, the last Java JDK and added all necessary Enviroment Variables to my System.
ANT and JAVA both gets executed fine from any source path.
ant -version outputs
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
java -version outputs
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
Enviroment Variables
I've set up every necessary variable. From ANT_HOME to PATH. Everything is as it should be
ANT_HOME: C:\Program Files\Ant
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_05
ANDROID_HOME: C:\Users\Kevin\Desktop\Cellulare\Development\sdk
PATH: %JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
As everyone can see, I've also added android platform-tools and tools to my PATH. Same thing for Ant and Java (\bin dirs).
Needless to say but every path is correct.
Having this things said, Why this still doesn't work? I've also restarted my PC as well but with no results.
Solution
Thanks to Kerri Shotts.
My problems were from those spaces in my paths.
So I changed C:\Program Files\... to C:\Progra~1\....
IMPORTANT!
I also noticed there were 2 □ characters in my strings. Like this ..\C□□ellulare\... They probably came from a wrong copy-paste format. After fixing these things everything worked!
Due to the nature of languages, whitespaces are executed in some whilst ignored in others.
Utilizing a file name such as "Program(whitespace)Files" does produce errors when compiling from \bin directories.
Next time you declare an environmental variable, be sure that your folder does not contain any whitespaces or gaps between the various names.
FYI: camelCase scripts where introduced tow work around this concept.
Thanks.

CodenameOne :"Path to javac not found" error

I start working with CodenameOne tool for multiplatform mobile dev. When I created "hello world" app and tried to build an .apk android file, I received
[echo] Error! Path to Javac not found!
[echo] Make sure the JAVA_HOME enviroment variable is pointing to the JDK
[echo] or define javac path in build.xml manually!
I added JRE reference to the project, but this didn't solve the issue. How can I solve it?
Codename One needs to use the actual javac compiler and not ADT since some of our server code has some issues with ADT.
The JRE doesn't contain javac, you need to install a JDK (if you don't have one already) then make sure your OS defines the JAVA_HOME environment variable so it points at the root of the JDK dir (not the bin directory).
If this doesn't work (you might need to restart Eclipse to update environment within the process), then just double click the build.xml file and look for jdk. Update the path to the proper JDK path.
Your best bet is to just setup the JAVA_HOME environment variable to point to your JDK directory

Error : set an Environment variable JAVA_HOME to point to it?

I am trying to plug-in android in to my laptop
Configuration: vista OS, 64 bit and RAM 4GB
I install the Eclipse, JDK 7 and installer_r18_windows.exe file from android site. when I try to run the windows installer it shows the message
Error:Failed to find the java version for C:\Windows\System32\java.exe: the system cannot find the file specified. and at last
if you believe you have a JDK installed and it was not properly recognized,simply set an environment variable JAVA_HOME to point to it
I don't know how to set an environment variable. How to solve this problem ?
Step 1
Make sure You have installed Java 64 bit version
Step2 copy c:\windows\system32\java.exe to c:\windows\syswow64
And last to learn How to set Environment Variables here you go
http://java.com/en/download/help/path.xml
Last Thing
If you are installing 32bit java version
Installation path will be
C:\Program Files (x86)\Java\jdk1.6.0_21\bin
If you are installing 64but java version
Installation path will be
C:\Program Files\Java\jdk1.6.0_21\bin
So set this path in Environment variables.

Categories

Resources