can't get Ant to work - java

I am trying to run Cordova on my ubuntu 12.04. When I try to create the project, its throwing me this error
k#k-cm:~/Development/Android/ionic/hello$ cordova platform add android
Checking Android requirements...
Creating android project...
[Error: An error occured during creation of android sub-project. Looks like your environment fully supports cordova-android development!
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.ionic.toderp
Name: toderp
Android target: android-17
Building cordova-3.2.0.jar
{ [Error: Command failed:
BUILD FAILED
/home/k/Dev/android-sdk-linux/tools/ant/build.xml:710: The following error occurred while executing this line:
/home/k/Dev/android-sdk-linux/tools/ant/build.xml:723: 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-7-openjdk-i386/jre"
Total time: 0 seconds
] killed: false, code: 1, signal: null }
]
Here is my PATH
/usr/lib/jvm/java-7-openjdk-i386:/home/k/Dev/android-sdk-linux/tools:/home/k/Dev/android-sdk-linux/tools:/home/k/Downloads/android-ndk-r8e:/home/k/Downloads/android-ndk-r8e:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/k/Home/k/Dev/android-sdk-linux/tools:/home/k/Home/k/Dev/android-sdk-linux/platform-tools:/usr/lib/jvm/java-7-openjdk-i386/bin
JAVA_HOME
/usr/lib/jvm/java-7-openjdk-i386
Please help!

This issue is due to that Ant can not find the tools.jar file.
You need to copy the tools.jar file and put it in the lib folder for the ant to work.
Do a search for tools.jar file in the lib folders from other sdk libraries and put that in the above path in error.

Related

Android builds fail when building with launchctl

I am trying to write a script to automate my build process and push builds every so often. So ever everything seems to be working except for my JAVA_HOME environment variable.
When building the app normally from command line I specify my JAVA_HOME as:
/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
However if I add this as an environment variable to my launchctl.plist I get the following error:
ERROR: JAVA_HOME is set to an invalid directory: /Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
This directory does exist and works fine when building the app normally.
If I do not specify the JAVA_HOME then I get the following error on building my app:
General error during semantic analysis: Unsupported class file major version 60.
Is there something I am doing wrong or can change to allow launchd to either build without the specified JAVA_HOME or to recognize the JAVA_HOME I am setting?
Add the code below to your environment's path .zshenv file in your home directory.
Run source ~/.zshenv to update terminal or Quit the terminal and reopen it again
Android Studio Dolphin and below:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
Android Studio Electric Eel and above:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home

Java : Error on build

I made an application in Java with Netbeans, but when I wanted to export it (build) an error message is displayed :
C:\Users\DALY\Documents\NetBeansProjects\VacheTaureau\nbproject\build-impl.xml:926: The following error occurred while executing this line:
C:\Users\DALY\Documents\NetBeansProjects\VacheTaureau\nbproject\build-impl.xml:268: Class not found: javac1.8
BUILD FAILED (total time: 1 second)
here is a screen print
Yes my friends, I found the solution to this problem!
In fact I downloaded Apatch Ant (TM) version 1.96 and it works!
here's the ant link
Apatch Ant V 1.96
Description:
We must extract the file 'apache-ant-1.9.6-bin.zip' downloaded to folder and you must put this folder under the following path :
C: \ Program Files (x86) \ NetBeans 7.3.1 \ java.
Then in NetBeans, go to the menu:
Tools> Options> Java
then you must change the way Ant home of the folder ( 'apache-ant-1.9.6-bin').
print Screen

Installing opencv on openshift for java development

I am trying to install opencv on openshift. following the post mentioned here
http://codingexodus.blogspot.in/2013/04/how-to-install-opencv-on-openshift.html
I am developing in java so i have installed jdk1.8 and apache ant into the $OPENSHIFT_DATA_DIR
I had to install apache ant also so i did the same again in the $OPENSHIFT_DATA_DIR
my JAVA_HOME is set to the jdk and even ANT_HOME is also pointing to the right place
JAVA_HOME="$OPENSHIFT_DATA_DIR/jdk1.8.0_05"
I am doing a cmake in the end to generate the makefile with the command
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_SHARED_LIBS=OFF ..
going through the cmake output i do see that for java it has found the ant, jni etc. finally when i execute a
make
make install
i get the error
make: *** No targets specified and no makefile found. Stop.
there is no make file generated. what am missing.

Unable to use PhoneGap and not detecting Apache ANT

I have installed PhoneGap via command prompt. I have installed java, ADT and Apache ANT and setup their environment variables as follows:
ANDROID_HOME - C:\Program Files\ADT\adt-bundle-windows-x86_64\sdk\platform-tools
ANT_HOME - C:\Users\myname\Downloads\apache-ant-1.9.3-bin\apache-ant-1.9.3
JAVA_HOME - C:\Program Files\Java\jdk1.7.0_51
When I use command prompt to check on Java via the commands java or javac, I get a list of print out which I believe indicates that it is working.
Similarly when I try to type ant, it is not recognized which I am assuming is the problem. I did look through past questions here from which I have come to the current setup and it is still not working.
When I go into the created PhoneGap project folder and input the command:
phonegap run android
It returns the following error message:
An error occurred during the creation of android sub-project.
Please advice what I am doing wrong. Thanks.
Edit:
adb - it prints out a long list
android - The system cannot find the path specified
Failed to create c:/Program Files/ADT/sdk/add-ons
Error: unable to parse SDK content.
android is returning error as above. I checked the path and it is
correct less the last part. I don't have a folder called add-ons
inside sdk folder.

Building android-maven project in netbeans

I am trying to get up and running a new android-maven project in Netbeans 7.1.1. I keep getting this error
Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:dex (default-dex) on project myproject: MojoExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_03\jre\bin\java" -Xmx1024M -jar "C:\Program Files\Android\android-sdk\platform-tools\lib\dx.jar" --dex "--output=C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\MyProject\target\classes.dex" "C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\MyProject\target\classes"", Result = 1 -> [Help 1]
This is the pom file: http://pastebin.com/k1ZzfEYY
No. You don't have to downgrade to a Java 6 SDK from Java 7 SDK to use Maven with Android.
The problem is that after you made some updates with the SDK Manager something got corrupted and you no longer have the dx.jar file in your android-sdk\platform-tools\lib folder, and when you try to build with Maven your project doesn't have that jar in the path and it fails to build.
To fix this you need to open the SDK Manager and delete the "Android SDK Platform-tools" that you currently have installed and reinstall it. After that go to the android-sdk\platform-tools\lib folder and see if the dx.jar file is there and try to build your project with mvn clean install android:deploy.
I've tested this with the sample helloflashlight application and it worked correctly after I've reinstalled the platform tools.
Also make sure that you have the environment variables JAVA_HOME, ANDROID_HOME, M2_HOME pointing to the right paths.

Categories

Resources