processing / processing-android-archive

96 stars 50 forks source link

Unable to locate javac #60

Open smoothmango opened 10 years ago

smoothmango commented 10 years ago

I just downloaded Processing 2.1.1, and when I try to run my Android sketch, I get the following error in the console: [javac] Unable to locate an executable at "/Applications/Processing.app/Contents/PlugIns/jdk1.7.0_51.jdk/Contents/Home/jre/bin/javac" (-1) If I open the Processing.app package and navigate to the mentioned folder, I find an executable called java but nothing called javac. I tried renaming java to javac but this just creates more (and different) errors.

smoothmango commented 10 years ago

Solution found based on comments on improperly filed issue in main Processing repo. You need to create a symbolic link in the Processing.app package to javac from your system's java installation. For me that means navigating to /Applications/Processing.app/Contents/PlugIns/jdk1.7.0_45.jdk/Contents/Home/jre/bin and running: ln -s /Library/Java/Home/bin/javac javac to create the symbolic link in Processing.app

rruubboott commented 10 years ago

Thanks for this! Worked a treat. I hoe there are plans to fix this issue so you don't need to use the command line to fix it. Still not resolved in 2.1.2

wanglongly commented 10 years ago

still get error

[taskdef] Could not load definitions from resource emma_ant.properties. It could not be found.

-set-mode-check:

-set-debug-files:

-check-env: Android SDK Tools Revision 23.0.0 Installed at /Applications/Android/sdk

-setup: [echo] Project Name: sketch_140628b Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup: Using latest Build Tools: 20.0.0 [echo] Resolving Build Target for sketch_140628b... Project Target: Android 2.3.3 API level: 10 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin [mkdir] Created dir: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin/res [mkdir] Created dir: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin/rsObj [mkdir] Created dir: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin/rsLibs [mkdir] Created dir: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/gen [mkdir] Created dir: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin/classes [mkdir] Created dir: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin/dexedLibs [echo] ---------- [echo] Resolving Dependencies for sketch_140628b... Library dependencies: No Libraries


API<=15: Adding annotations.jar to the classpath. [echo] ---------- [echo] Building Libraries with 'debug'... [subant] No sub-builds to iterate on

-code-gen: Merging AndroidManifest files into one. Manifest merger disabled. Using project manifest only. [echo] Handling aidl files... No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... Generating BuildConfig class.

-pre-compile:

-compile: [javac] Compiling 3 source files to /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin/classes

-post-compile:

-obfuscate:

-dex: input: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin/classes input: /Applications/Android/sdk/tools/support/annotations.jar input: /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/libs/processing-core.jar Pre-Dexing /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/libs/processing-core.jar -> processing-core-3a195c1200c69bb17bcb3e703526adec.jar Converting compiled files and external libraries into /var/folders/yv/cp4w9xj10sv0xvbgym5125pc0000gn/T/android8248936923325436970sketch/bin/classes.dex... [dx] [dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] java.io.FileNotFoundException: /Applications/Android/sdk/tools/support/annotations.jar (No such file or directory) [dx] at java.util.zip.ZipFile.open(Native Method) [dx] at java.util.zip.ZipFile.(ZipFile.java:215) [dx] at java.util.zip.ZipFile.(ZipFile.java:145) [dx] at java.util.zip.ZipFile.(ZipFile.java:159) [dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244) [dx] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) [dx] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) [dx] at com.android.dx.command.dexer.Main.processOne(Main.java:596) [dx] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) [dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) [dx] at com.android.dx.command.dexer.Main.run(Main.java:230) [dx] at com.android.dx.command.dexer.Main.main(Main.java:199) [dx] at com.android.dx.command.Main.main(Main.java:103) [dx] 1 error; aborting

BUILD FAILED /Applications/Android/sdk/tools/ant/build.xml:892: The following error occurred while executing this line: /Applications/Android/sdk/tools/ant/build.xml:894: The following error occurred while executing this line: /Applications/Android/sdk/tools/ant/build.xml:906: The following error occurred while executing this line: /Applications/Android/sdk/tools/ant/build.xml:283: null returned: 1

Total time: 9 seconds

rogeriob commented 10 years ago

I´m having the same issue that wanglongly mentioned above.

[taskdef] Could not load definitions from resource emma_ant.properties. It could not be found.

-set-mode-check:

-set-debug-files:

-check-env: Android SDK Tools Revision 23.0.0 Installed at /Developer/AndroidSDK

-setup: [echo] Project Name: sketch_140628a Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup: Using latest Build Tools: 20.0.0 [echo] Resolving Build Target for sketch_140628a... Project Target: Android 2.3.3 API level: 10 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin [mkdir] Created dir: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin/res [mkdir] Created dir: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin/rsObj [mkdir] Created dir: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin/rsLibs [mkdir] Created dir: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/gen [mkdir] Created dir: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin/classes [mkdir] Created dir: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin/dexedLibs [echo] ---------- [echo] Resolving Dependencies for sketch_140628a... Library dependencies: No Libraries


API<=15: Adding annotations.jar to the classpath. [echo] ---------- [echo] Building Libraries with 'debug'... [subant] No sub-builds to iterate on

-code-gen: Merging AndroidManifest files into one. Manifest merger disabled. Using project manifest only. [echo] Handling aidl files... No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... Generating BuildConfig class.

-pre-compile:

-compile: [javac] Compiling 3 source files to /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin/classes

-post-compile:

-obfuscate:

-dex: input: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin/classes input: /Developer/AndroidSDK/tools/support/annotations.jar input: /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/libs/processing-core.jar Pre-Dexing /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/libs/processing-core.jar -> processing-core-859a5f843f3fd73bd88252390c5279b7.jar Converting compiled files and external libraries into /var/folders/jd/02fvlpcx0n10pwz9rx_k_fqc0000gn/T/android2915634894064204307sketch/bin/classes.dex... [dx] [dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] java.io.FileNotFoundException: /Developer/AndroidSDK/tools/support/annotations.jar (No such file or directory) [dx] at java.util.zip.ZipFile.open(Native Method) [dx] at java.util.zip.ZipFile.(ZipFile.java:215) [dx] at java.util.zip.ZipFile.(ZipFile.java:145) [dx] at java.util.zip.ZipFile.(ZipFile.java:159) [dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244) [dx] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) [dx] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) [dx] at com.android.dx.command.dexer.Main.processOne(Main.java:596) [dx] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) [dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) [dx] at com.android.dx.command.dexer.Main.run(Main.java:230) [dx] at com.android.dx.command.dexer.Main.main(Main.java:199) [dx] at com.android.dx.command.Main.main(Main.java:103) [dx] 1 error; aborting

BUILD FAILED /Developer/AndroidSDK/tools/ant/build.xml:892: The following error occurred while executing this line: /Developer/AndroidSDK/tools/ant/build.xml:894: The following error occurred while executing this line: /Developer/AndroidSDK/tools/ant/build.xml:906: The following error occurred while executing this line: /Developer/AndroidSDK/tools/ant/build.xml:283: null returned: 1

Total time: 16 seconds

jones065 commented 10 years ago

I solved this on Windows by copying the contents of my JDK folder to the "\java\" subfolder where I had Processing installed. Heavy handed, but it worked.

  1. Copy everything in the JDK folder => D:\Program Files\Java\jdk1.6.0_45\
  2. Rename the "java" subfolder where Processing is installed to something like "java_backup"
  3. Make a new "java" subfolder in the Processing directory and paste the contents of the JDK there.

Just to note, if you try and update the Android SDK location in the preferences.txt file, it gets overwritten . Not sure why they have a preference setting if it is just going to get overwritten every time. Also, setting the "JAVA_HOME" variable did absolutely nothing in my case.

wanglongly commented 10 years ago

@jones065 i did this on MAC , and can't start processing then....

rruubboott commented 10 years ago

Hello all

The fix posted up above works for Mac. I re-wrote it a bit and posted it on my blog:

http://theproce55.tumblr.com/post/82883027743/fixing-android-development-in-processing-2-1-1

oolong commented 10 years ago

Same problem here (with Mac OSX), only a bit worse, I think, because there's no javac file anywhere on this computer. I'm guessing we need to download the 200MB-odd JDK from the Oracle site to try and sort this out? It's not a great internet connection, so I'd rather try something else. How come there's no download link for 2.0.3 on the Processing site any more?

agoransson commented 10 years ago

There is, it's just not linked. http://download.processing.org/processing-2.0.3-macosx.zip

oolong commented 10 years ago

Ah, thanks @agoransson! Already got the JDK off Oracle and symlinked that, but that didn't work - just claimed to be compiling indefinitely.

2.0.3, however, is working fine. Should I open a separate 'Please keep linking to version 2.0.3 until later versions work with Android' issue, since this seems to be much the easiest solution to this problem?