RAPT: Whats wrong with my JDK? - android

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.

Related

How to well manage a build environment for different target?

I'm trying to build different version AOSP and android in ubuntu 14.04. However, I need to switch between different versions of OpenJDK and JAVA SE JDK.
I know I can use update-alternative to deal with different installation. But, JAVA SE JDK doesn't appear in update-alternative. It's just the contents of a tar ball.
Could anyone suggest a better to deal with different tools for building different targets?
By default when you build AOSP it will use your JAVA_HOME which is really frustrating when they are stuck on 1.6 and everyone else is using 1.7.
AOSP will look for an environment variable ANDROID_JAVA_HOME before it builds, so you can set this prior to building and have it point at a different location. This doesn't seem to work on all versions of Android, it definitely does not work on my Marshmallow build, but if it does work it might be more convenient for you.
Go and manually pick up the version of java you need from Oracle, and then find some convenient way to call export JAVA_HOME=/path/to/java/ . I always use 1.6 because I am not building master yet so I just put it into my .bashrc, but you could just put it in a build script.
You can add your JDK installation into update-alternative manually.
How you can achieve that:
download JDK you need, e.g. jdk-6u45-linux-x64.bin
extract it; for example, chmod +x jdk-6u45-linux-x64.bin && ./jdk-6u45-linux-x64.bin
move it in the place you want; personally I prefer /opt, so sudo mv jdk1.6.0_45 /opt
you can skip this step, but I'd recommend using symbolic links sudo ln -fs /opt/jdk1.6.0_45 /opt/jdk1.6
add manually this version sudo update-alternatives --install /usr/bin/java java /opt/jdk1.6/bin/java 1
Note: I'm using symbolic links there.
Then you can always change current JDK with
sudo update-alternatives --config java.
And then you can check current version of Java being used in the system.
>java - version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
More information you can find in manual page of update-alternatives.
I had the same issue to switch between JDK version which is not coming in update-alternative. I already had JDK 7 and I want to switch to KDK 6. I had downloaded JDK 6 as .bin and installed. But it is not shown in update-alternative. At last I found the solution which is worked for me.
I installed update-java-0.5b which will open GUI which is useful to switch between JDK version.
wget http://webupd8.googlecode.com/files/update-java-0.5b
chmod +x update-java-0.5b
sudo ./update-java-0.5b
Hope it will help!!

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.

IBM Worklight 6.1 - "Missing .project file" error while trying to build the Android environment

After I installed Worklight 6.1 and the Android plug-in and SDK, I got the below exception when trying to build an app:
[2013-12-13 13:27:07] Starting build process: application 'WorklightTest', all environments
[2013-12-13 13:27:10] Failed importing native project for 'Android phones and tablets' Failed to read project description file from location
D:\Development\worklight_dev\WorklightTestApp\apps\WorklightTest\android\native.project.
[2013-12-13 13:27:10] A core eclipse exception has occurred: Failed to
read project description file from location
D:\Development\worklight_dev\WorklightTestApp\apps\WorklightTest\android\native.project.
Actually, I did it with worklight 6.0...
I had the exact same problem and on my Windows 7 Machine it was also a Java Install / Version problems as it seems.
I am an IBMer, so I had the IBM Java JRE and SDKs for version 7 installed. Also the Oracle JRE and JDK. Also both for 32bit and 64bit. The command line always referred to the IBM JDK.
Once I removed all the IBM JREs and JDKs and left only the two, Oracle JDK 7-21 in 32bit and 64bit, on my machine, the creation of the Android project was successful.
I had the same issue and got it resolved (under Ubuntu) by updating Java alternative to the same Java SDK (openjdk-7) that is required by Worklight; using:
sudo update-alternatives --config java
Also checked the SDK alternative points to the same:
sudo update-alternatives --config javac
I have ran across this issue many times haven't yet found a solid resolution. In my latest experience today, this combination of things worked for me consistently for 3 different occurrences on Windows 7
delete native folder in android environment
set -vm flag in eclipse.ini to use Oracle JRE
start eclipse with -clean flag
From: IBM Worklight 6.0 - Build issues
Try to:
Delete the native folder and build the project again
Create a new workspace for Eclipse
Run Eclipse with the -clean flag
I have installed a fresh copy (not upgraded) of Worklight 6.1, created new project+app+environment and the build passed successfully.
I suggest to try the above suggestions as they are ordered.

Cannot set JAVA_HOME

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

Necessitas (Qt/Android NDK) qmake paths

I am running openSUSE 12.2 64-bit trying to compile an app in Necessitas alpha 4.1. It's a basic app and the code is likely not the issue. Through the course of tracing the issue I made sure to have all dependencies and tools.jar, which can apparently cause similar errors. When compiling I get:
Packaging Error: Command '/usr/bin/ant clean debug' failed.Exit code: 1
File not found:
No file is actually listed. I copy/pasted this line from Projects->Build Steps->qmake:
/home/mark/Software/necessitas/Android/Qt/482/armeabi-v7a/bin/qmake /home/mark/Dev/qt/myProject/myProject.pro -r -spec android-g++ CONFIG+=debug CONFIG+=declarative_debug
Then I pasted in a terminal window and the result is:
sh: /home/mark/necessitas/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: No such file or directory
This is obviously incorrect as my path is ~/Software/necessitas not ~/necessitas. I have checked through every tab of Tools->Options but see nowhere that references the incorrect folder. Any clue where this is supposed to go?
I had this exact error last night. However I noticed that the Google documentation specifically said java-6-openjdk. So I installed the older JDK using synaptic and then ran:
sudo update-alternatives --config java
I selected the version 6 and re-ran the process. Which completed successfully.
(To be fair I was using Qt 5.1 beta 1 and freshly downloaded NDK and SDK's, ant was 1.8.1 from the repositories)
Were you able to resolve your problem in the mean time ?
This has to do with the Java environment variables, more precisely with JAVA_HOME.
Did you install OpenJDK right before you tried to launch your app ?
I am not certain where OpenJDK installs in OpenSUSE, but on my ArchLinux the variable had to be set to :
JAVA_HOME=/usr/lib/jvm/java-7-openjdk
in order for QtCreator to compile the project properly.
In my case, I had Oracle's JDK installed, so right after installing OpenJDK, loging out and reloging updated my environment variables as wished.
There is also a similar post to yours:
How to build my HelloWorld Android application with Necessitas (qt port)?
And you'll find a good necessitas starter video here :
http://youtu.be/suPeZ7XC1xk

Categories

Resources