I'm trying to compile TuxGuitar (a guitar tablature editor) on OS X. I've checked out the code from the TuxGuitar repository:
svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code
Now, when I run make which in turn uses ant, it seems javac can't find Java packages within the project source tree. I've put the complete output of make at http://people.kth.se/~albertwi/tuxg-make-error; it's huge so I can't put all of it here in a code block.
I'm assuming this is a semi-trivial class path issue but I can't tell how to modify the build configuration. On line 307 and onward in the make output there are errors/warnings on the form of "some_file.java added as some_file.class doesn't exist", I don't know what this entails:
[javac] org/herac/tuxguitar/app/TGMain.java added as org/herac/tuxguitar/app/TGMain.class doesn't exist.
[javac] org/herac/tuxguitar/app/TuxGuitar.java added as org/herac/tuxguitar/app/TuxGuitar.class doesn't exist.
[javac] org/herac/tuxguitar/app/action/TGActionAccessInterceptor.java added as org/herac/tuxguitar/app/action/TGActionAccessInterceptor.class doesn't exist.
...
On line 715 and onward some class paths are included, but it seems like not all the necessary folders are appended here (the TuxGuitar source tree contains folders on the form TuxGuitar-some program component/src/org/herac/tuxguitar, for example TuxGuitar-ascii/src/org and TuxGuitar-fluidsynth/src/org which I believe should be included here but they aren't):
[javac] Compilation arguments:
[javac] '-d'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build'
[javac] '-classpath'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build:/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar:/opt/local/share/java/apache-ant/lib/ant-launcher.jar:/opt/local/share/java/apache-ant/lib/ant-antlr.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bcel.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bsf.jar:/opt/local/share/java/apache-ant/lib/ant-apache-log4j.jar:/opt/local/share/java/apache-ant/lib/ant-apache-oro.jar:/opt/local/share/java/apache-ant/lib/ant-apache-regexp.jar:/opt/local/share/java/apache-ant/lib/ant-apache-resolver.jar:/opt/local/share/java/apache-ant/lib/ant-apache-xalan2.jar:/opt/local/share/java/apache-ant/lib/ant-commons-logging.jar:/opt/local/share/java/apache-ant/lib/ant-commons-net.jar:/opt/local/share/java/apache-ant/lib/ant-jai.jar:/opt/local/share/java/apache-ant/lib/ant-javamail.jar:/opt/local/share/java/apache-ant/lib/ant-jdepend.jar:/opt/local/share/java/apache-ant/lib/ant-jmf.jar:/opt/local/share/java/apache-ant/lib/ant-jsch.jar:/opt/local/share/java/apache-ant/lib/ant-junit.jar:/opt/local/share/java/apache-ant/lib/ant-junit4.jar:/opt/local/share/java/apache-ant/lib/ant-netrexx.jar:/opt/local/share/java/apache-ant/lib/ant-swing.jar:/opt/local/share/java/apache-ant/lib/ant-testutil.jar:/opt/local/share/java/apache-ant/lib/ant.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/tools.jar'
[javac] '-sourcepath'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src'
...
Then on line 1143 and onward I get "package org.herac.tuxguitar.some package does not exist" errors:
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:27: error: package org.herac.tuxguitar.action does not exist
[javac] import org.herac.tuxguitar.action.TGActionManager;
[javac] ^
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:68: error: package org.herac.tuxguitar.document does not exist
[javac] import org.herac.tuxguitar.document.TGDocumentManager;
[javac] ^
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:69: error: package org.herac.tuxguitar.event does not exist
[javac] import org.herac.tuxguitar.event.TGEvent;
[javac] ^
...
I'm not well versed in make and ant. How and where do I make configuration changes so javac can find the packages?
Is the problem so involved that I should ask TuxGuitar developers about this instead?
Update: I tried using another way of compiling as suggested at https://sourceforge.net/p/tuxguitar/discussion/522984/thread/3843b30b/#1ce9, so I go to a folder build-scripts/tuxguitar-macosx-cocoa-64 and run mvn clean package -Dnative-modules=true but then I get errors related to SWT... this, essentially (full output at http://people.kth.se/~albertwi/tuxg-mvn-error):
[INFO] Scanning for projects...
[ERROR] The build could not read 18 projects -> [Help 1]
[ERROR]
[ERROR] The project org.herac.tuxguitar:tuxguitar:1.3-SNAPSHOT (/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for org.eclipse.swt:org.eclipse.swt:jar is missing. # org.herac.tuxguitar:tuxguitar:[unknown-version], /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/pom.xml, line 26, column 15
[ERROR]
[ERROR] The project org.herac.tuxguitar:tuxguitar-browser-ftp:1.3-SNAPSHOT (/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar-browser-ftp/pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for org.eclipse.swt:org.eclipse.swt:jar is missing. # org.herac.tuxguitar:tuxguitar-browser-ftp:[unknown-version], /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar-browser-ftp/pom.xml, line 35, column 15
[ERROR]
...
I have the latest version (4.4) of swt.jar in /Library/Java/Extensions so it should be on the class path.
I got into the same trouble, it looks like the Makefile is broken as it uses ant instead of maven.
Here are the steps I did (Thanks to my colleage Clément which was born with java while I was with punch cards):
$svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code
$sudo apt-get install maven
$cd tuxguitar-code
$uname -a
Linux acacia 3.16-3-amd64 #1 SMP Debian 3.16.5-1 (2014-10-10) x86_64 GNU/Linux
$cd build-scripts/tuxguitar-linux-x86_64
$rehash
$mvn clean package
$cd target
$cd tuxguitar-1.3-SNAPSHOT-linux-x86_64
$./tuxguitar.sh
This did work for me on 3 different computers, all debian based though.
Hope this helps
Related
[Edit] This is no longer an issue. Did not change anything except using the current JDK11.
Updated jar dependencies for jdk 11 compliance.
Updated ant to 1.10.x.
Changed ANT_OPTS to use upto 5GB of memory.
Changed the javac task inside build script to use upto 5GB of memory and fork=true.
I get the following error:
[javac] Compiling 909 source files to C:\xyz\build\classes
[javac]
[javac]
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
[javac] at jdk.zipfs/jdk.nio.zipfs.ZipPath.relativize(ZipPath.java:226)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer$1.preVisitDirectory(JavacFileManager.java:525)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer$1.preVisitDirectory(JavacFileManager.java:521)
[javac] at java.base/java.nio.file.Files.walkFileTree(Files.java:2731)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer.<init>(JavacFileManager.java:520)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getContainer(JavacFileManager.java:316)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:712)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:734)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:678)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:551)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:299)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder$$Lambda$42/0x00000008000d6040.complete(Unknown Source)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symtab.lambda$addRootPackageFor$8(Symtab.java:780)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symtab$$Lambda$44/0x00000008000d5840.complete(Unknown Source)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:355)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:529)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:286)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:301)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:576)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:560)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1066)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:937)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
[javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
[javac] at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
Note : This same setup continues to build fine under java 8
Update 1:
Running ant with -verbose and the javac in the build file with verbose provides the search path that is used. Comparing thejdk8 and jdk11 entries :
JDK8 had the following entries that wern't present in jdk 11 search path
c:\jdk1.8.0_152\jre\lib\resources.jar
c:\jdk1.8.0_152\jre\lib\rt.jar
c:\jdk1.8.0_152\jre\lib\sunrsasign.jar
c:\jdk1.8.0_152\jre\lib\jsse.jar
c:\jdk1.8.0_152\jre\lib\jce.jar
c:\jdk1.8.0_152\jre\lib\charsets.jar
c:\jdk1.8.0_152\jre\lib\jfr.jar
c:\jdk1.8.0_152\jre\classes
c:\jdk1.8.0_152\jre\lib\ext\access-bridge-64.jar
c:\jdk1.8.0_152\jre\lib\ext\cldrdata.jar
c:\jdk1.8.0_152\jre\lib\ext\dnsns.jar
c:\jdk1.8.0_152\jre\lib\ext\jaccess.jar
c:\jdk1.8.0_152\jre\lib\ext\jfxrt.jar
c:\jdk1.8.0_152\jre\lib\ext\localedata.jar
c:\jdk1.8.0_152\jre\lib\ext\nashorn.jar
c:\jdk1.8.0_152\jre\lib\ext\sunec.jar
c:\jdk1.8.0_152\jre\lib\ext\sunjce_provider.jar
c:\jdk1.8.0_152\jre\lib\ext\sunmscapi.jar
c:\jdk1.8.0_152\jre\lib\ext\sunpkcs11.jar
c:\jdk1.8.0_152\jre\lib\ext\zipfs.jar
c:\jdk1.8.0_152\lib\tools.jar
C:\SourceRepo\xx\yy\
The last line is the root of the project where the build.xml exists.
After the search path, there are a bunch of "loading ZipFileIndexFileObject...".
Followed by class file generation of my classes.
Followed by putting them in a jar.
The entries in jdk11 that were missing in the jdk8 search path.
C:\jdk-11\lib\modules
The above modules doesn't exist.
And then it fails with OOM stacktrace as listed earlier.
Update 2 Oct 17'2018:
Got an openjdk11 docker image (linux), installed ant on it, mounted my source directory and did an ant build. Worked fine no issues. So it seems like a windows jdk11 issue to me right now.
I am using this for configuring eclipse in windows 8.1. I compiled hadoop 2.7.2; when I entered
ant jar -Dversion=2.7.2 -Declipse.home=C:/eclips/eclipse -Dhadoop.home=D:/Hadoop/hadoop-2.7.2
Buildfile:C:\hadoop2x-eclipse-plugin\src\contrib\eclipse-plugin\build.xml
I got lots of errors. I don't know where I should find compiler output and what is NewDriverWizard?
pache\hadoop\eclipse\NewDriverWizard.java:22: error: package org.eclipse.core.ru
ntime does not exist
[javac] C:\hadoop2x-eclipse-plugin\src\contrib\eclipse-plugin\src\java\org\a
pache\hadoop\eclipse\NewDriverWizard.java:24: error: package org.eclipse.jdt.cor
e does not exist
[javac] C:\hadoop2x-eclipse-plugin\src\contrib\eclipse-plugin\src\java\org\a
pache\hadoop\eclipse\NewDriverWizard.java:25: error: package org.eclipse.jdt.int
ernal.ui.wizards does not exist
.
.
.
BUILD FAILED
C:\hadoop2x-eclipse-plugin\src\contrib\eclipse-plugin\build.xml:76: Compile fail
ed; see the compiler error output for details.
I had installed the apache ant and I would like to make the SMB library into a jar file together with the java/class that I had created.
I tried entering the "ant jar" into the cmd. however, I dont seem to be able to build it as I keep getting this error.
BUILD FAILED
D:\SMB_JAR_FILES\SMB Java Files\jcifs-master\build.xml:45: The following error o
ccurred while executing this line:
D:\SMB_JAR_FILES\SMB Java Files\jcifs-master\build.xml:34: The Java Servlet API
classes could not be found. These files can be
obtained from:
http://java.sun.com/products/servlet/download.html
Total time: 0 seconds
Could Someone please teach me how to fix this ? May I know if I am missing anything. Thank you.
After I had downloaded the Servlet.api
I encounter another error
dependencies:
hasServlet:
compile:
[javac] D:\SMB_JAR_FILES\SMB Java Files\jcifs-master\build.xml:57: warning:
'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to f
alse for repeatable builds
[javac] Compiling 178 source files to D:\SMB_JAR_FILES\SMB Java Files\jcifs-
master\build
BUILD FAILED
D:\SMB_JAR_FILES\SMB Java Files\jcifs-master\build.xml:57: Error running \usr\lo
cal\java5\bin\javac compiler
Total time: 0 seconds
I am attempting to run "cordova build android" through phonegap CLI with Terminal on my Mac.
First I downloaded the Android SDK.
Then I set up the project and added android.
Then I attempted "cordova build android" and received the following error:
Error: An error occurred while building the android project. Please
install Android target 17 (the Android newest SDK). Make sure you have
the latest Android tools installed as well. Run "android" from your
command-line to install/update any missing SDKs or tools.
So I ran "android" and installed everything related to target 17.
Then I attempted "cordova build android" again and receive the following compile errors:
-compile:
[javac] Compiling 3 source files to /Users/johnmacadam/Desktop/com.test.hello/platforms/android/bin/classes
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:20:
';' expected
[javac] package com.humorthatworks.501ways;
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:25:
expected
[javac] public class 501Ways extends CordovaActivity
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:25:
expected
[javac] public class ZZZ extends CordovaActivity
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:25:
expected
[javac] public class ZZZ extends CordovaActivity
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/gen/com/ZZZ/BuildConfig.java:2:
';' expected
[javac] package com.ZZZ;
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/gen/com/ZZZ/R.java:8:
';' expected
[javac] package com.ZZZ;
[javac] ^
[javac] 6 errors
BUILD FAILED
/Users/johnmacadam/Documents/adt-bundle/sdk/tools/ant/build.xml:720:
The following error occurred while executing this line:
/Users/johnmacadam/Documents/adt-bundle/sdk/tools/ant/build.xml:734:
Compile failed; see the compiler error output for details.
Any ideas/suggestions?
In your config.xml you can't have a widget id with number as a first character after a dot.
For example: com.42myapp.test or com.myapp.42test won't work as well as 42com.myapp.test.
It will trigger an error from the compiler.
The error will occur only for android platform, iOS handle it well.
Turns out my problem was starting the project with a number... Java couldn't handle a number as the first character and would throw an error when attempting to compile.
In my case, I'm using Ionic Framework, I forgot about Java convetions for package name and I made the mistake of using the identified _200 for my project when doing:
ionic start _200
Hapilly, starting a new project with a proper package identifier worked just fine:
ionic start blah
I'm trying to create a new Android project using Cordova/Phonegap.
I have downloaded cordova-2.9.0, and the ADT Bundle for Mac.
I extracted ADT to ~/Developer/Android, and added it to my PATH:
export PATH="$HOME/Development/Android/sdk/tools:$PATH"
export PATH="$HOME/Development/Android/sdk/platform-tools:$PATH"
I then try to run the cordova create script, but it fails:
→ bin sudo ./create ~/Projects/myproject/cordova-android com.mydomain.myproject myproject
Password:
BUILD FAILED
/Users/asgeo1/Development/Android/sdk/tools/ant/build.xml:714: The following error occurred while executing this line:
/Users/asgeo1/Development/Android/sdk/tools/ant/build.xml:728: Compile failed; see the compiler error output for details.
Total time: 1 second
An unexpected error occurred: ant jar > /dev/null exited with 1
Deleting project...
Not very helpful. So I edit the Cordova create script so it will output some more information.
# COMMENTED OUT piping to /dev/null:
#
# compile cordova.js and cordova.jar
pushd "$BUILD_PATH"/framework # > /dev/null
ant jar #> /dev/null
popd #> /dev/null
Then I re-ran the create script:
→ bin sudo ./create ~/Projects/myproject/cordova-android com.mydomain.myproject myproject
~/Downloads/cordova-2.9.0/cordova-android/framework ~/Downloads/cordova-2.9.0/cordova-android/bin
Buildfile: /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/build.xml
-pre-build:
-check-env:
[checkenv] Android SDK Tools Revision 22.0.5
[checkenv] Installed at /Users/asgeo1/Development/Android/sdk
-setup:
[echo] Project Name: Cordova
[gettype] Project Type: Android Library
-build-setup:
[getbuildtools] Using latest Build Tools: 18.0.1
[echo] Resolving Build Target for Cordova...
[gettarget] Project Target: Android 4.3
[gettarget] API level: 18
[echo] ----------
[echo] Creating output directories if needed...
[echo] ----------
[echo] Resolving Dependencies for Cordova...
[dependency] Library dependencies:
[dependency] No Libraries
[echo] ----------
[echo] Building Libraries with '${build.target}'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] No changes in the AndroidManifest files.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources...
[aapt] No changed resources. R.java and Manifest.java untouched.
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 104 source files to /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/bin/classes
[javac] /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/src/com/squareup/okhttp/Connection.java:171: method does not override a method from its superclass
[javac] #Override public void close() throws IOException {
[javac] ^
And there's another 40 errors like the one above, regarding #override.
From what I can tell on Google, this is because in jdk 1.6 and above, the #override annotations changed. (or something like that):
Why is javac failing on #Override annotation
OK, so I work out that the Android SDK configuration for ant is in a file called build.xml. Low and behold, it has some settings for Java 1.5:
<property name="java.target" value="1.5" />
<property name="java.source" value="1.5" />
If I change those values to 1.6 or 1.7, I get a java error when re-running the Cordova create script:
-compile:
[javac] Compiling 104 source files to /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/bin/classes
[javac] javac: invalid source release: 1.7
[javac] Usage: javac <options> <source files>
I'm really scratching my head here. I'm not an expert on Java, so I don't get what is going on here.
Does anyone know how to run the create script for Cordova Android on OSX ?
UPDATE
After following #cartland's advice below I was able to get rid of the #Override errors. Still getting one last error though:
-compile:
[javac] Compiling 104 source files to /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/bin/classes
[javac] /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java:523: error: cannot find symbol
[javac] settings.setPluginsEnabled(true);
[javac] ^
[javac] symbol: method setPluginsEnabled(boolean)
[javac] location: variable settings of type WebSettings
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error
I'll try and work out what that is - but if anyone knows, please post an answer :)
UPDATE 2
I know what the 2nd error is. It's mentioned here: https://developer.motorolasolutions.com/thread/3640
Cordova 2.9.0 is not compatible with Android SDK 18. I need to use Cordova 3.0.0 with Android SDK 18. (or conversely downgrade the Android SDK to 17)
I'm running Ubuntu 10.4 64bit; Oracle JDK 1.7.0_25-b15; Eclipse Kepler; Android SDK 4.3; PhoneGap 3.0.
Had exactly the same problem as you using the CLI. Loading the project into Eclipse worked fine (~/.cordova/lib/android/cordova/3.0.0/framework/.project). As Eclipse uses it's own internal Java compiler, I figured there was a problem with the Oracle install I was using, and there was - sort of.
It turned out that some application had installed a version of tools.jar (amongst others) from an earlier JRE into the Java ext folder. Seems strange to me that javac would load dependant jars from here prior to jars in it's own lib folder but that seems to be the precedence order. Anyway, I removed all files from the ext folder and everything worked properly.
JDK location: /usr/lib/jvm/java-7-oracle/
Ext location: /usr/java/packages/lib/ext/
I don't have my Mac on me to check locations but try /Library/Java/Extensions or ~/Library/Java/Extensions
I didn't need to make any other changes. However while experimenting, I did try setting the following properties in the project's ant.properties file. 1.5, 1.6, 1.7 all work.
java.target=1.5
java.source=1.5
Actually, the problem here seems to be the incompatibility between your java version and Cordova's compiled jars.
For a quick fix, it is better to install Java 1.5 and use it for your development. Don't forget to restore your changes in build.xml to 1.5.