Compile failed when running a lucene example - java

After fixing the error like tools.jar and junit.jar not found (thanks to stack overflow) I tried to compile the example given in "lucene in action" book. But when I compiled I am getting this error. Can you tell what error I am getting and how to fix it?
Total time: 0 seconds
E:\LuceneInAction>ant Indexer
Buildfile: E:\LuceneInAction\build.xml
check-environment:
compile:
[javac] E:\LuceneInAction\build.xml:66: warning: 'includeantruntime' was not
set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 104 source files to E:\LuceneInAction\build\classes
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:3: warning: [d
eprecation] Assert in junit.framework has been deprecated
[javac] import junit.framework.Assert;
[javac] ^
[javac] E:\LuceneInAction\src\lia\handlingtypes\html\NekoHTMLHandler.java:18
: error: package org.apache.html.dom does not exist
[javac] import org.apache.html.dom.HTMLDocumentImpl;
[javac] ^
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:90: warning: [
deprecation] Assert in junit.framework has been deprecated
[javac] Assert.assertEquals(strings.length, tokens.length);
[javac] ^
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:93: warning: [
deprecation] Assert in junit.framework has been deprecated
[javac] Assert.assertEquals("index " + i, strings[i], tokens[i].termTe
xt());
[javac] ^
[javac] E:\LuceneInAction\src\lia\handlingtypes\html\NekoHTMLHandler.java:32
: error: cannot find symbol
[javac] new HTMLDocumentImpl().createDocumentFragment();
[javac] ^
[javac] symbol: class HTMLDocumentImpl
[javac] location: class NekoHTMLHandler
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 3 warnings
BUILD FAILED
E:\LuceneInAction\build.xml:66: Compile failed; see the compiler error output fo
r details.
Total time: 2 seconds
Sorry I dont have enough reputaion to post image

Tt is complaining about your jar which contains HtmlDocumentImpl not being on the classpath. Maybe xerces? A specific version.
The JUnits are a warning that it the Assert which comes from org.framework. You can update your JUnit jar file or leave it as is since that isnt the cause of the error.
The errors are due to a jar not being on your classpath. which in my guess is xerces

Related

Ant bulid runs on command line (Windows), but fails in Eclipse

I have a J2EE program that I have been maintaining since 2006/7.
The Ant build compiles all Java/J2EE code, creates the database in MySql and imports data into it, and deploys the build (exploded) war into Tomcat.
There's been no changes to the code in years.
The only changes are in the stack - where I was forced to update the versions of Java (1.8), MySql (5.5), Eclipse, and lately, Windows (11).
This build runs flawlessly and I'm able to launch the website and run it successfully.
The only thing that's changed is that somehow I'm unable to run the Ant build from inside Eclipse now.
I created the Eclipse project by importing the existing source folder.
Then I created the 'Ant build' in the 'External Tools Configuration'.
(I've been doing this in Eclipse since 2004, so I know the overall configurations I need to make.)
But somehow, either something's changed in Eclipse that I can't put my finger on or because I'm making a really silly error without knowing what it is, the Ant build from inside Eclipse keeps failing.
I've been trying all kinds of things to fix the Classpath, but nothing seems to work.
This exact same build works with no changes from the command prompt.
So, it's not a question of missing libraries - just finding them.
What's happening?
Please help!
DETAILS:
Ant target 'compile':
<!-- Normal build of application -->
<target name="compile" depends="prepare,copy-resources">
<javac srcdir="src/java" destdir="${webinf.dir}/classes" debug="true">
<classpath refid="compile.classpath" />
</javac>
Error in execution of 'compile':
compile:
[javac] <PROJECT_LOC>\ant\build.xml:163: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 439 source files to C:\<src_root_folder>\WebContent\WEB-INF\classes
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:32: error: package javax.xml.bind does not exist
[javac] import javax.xml.bind.JAXBException;
[javac] ^
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:33: error: package javax.xml.bind does not exist
[javac] import javax.xml.bind.Marshaller;
[javac] ^
[javac] <PROJECT_LOC>>\src\java\com\cs\service\rest\GeoCodeClient.java:34: error: package javax.xml.bind does not exist
[javac] import javax.xml.bind.JAXBContext;
[javac] ^
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:52: error: cannot find symbol
[javac] protected Marshaller marshaller;
[javac] ^
[javac] symbol: class Marshaller
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:87: error: cannot find symbol
[javac] private Marshaller newMarshaller() {
[javac] ^
[javac] symbol: class Marshaller
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\util\PasswordService.java:26: error: cannot find symbol
[javac] import sun.misc.BASE64Encoder;
[javac] ^
[javac] symbol: class BASE64Encoder
[javac] location: package sun.misc
...
...
...
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:89: error: cannot find symbol
[javac] JAXBContext jc = JAXBContext
[javac] ^
[javac] symbol: class JAXBContext
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:89: error: cannot find symbol
[javac] JAXBContext jc = JAXBContext
[javac] ^
[javac] symbol: variable JAXBContext
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:92: error: cannot find symbol
[javac] marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
[javac] ^
[javac] symbol: variable Marshaller
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:95: error: cannot find symbol
[javac] } catch (JAXBException jaxbe) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:102: error: cannot access JAXBContext
[javac] RequestHeader header = factory.createRequestHeader();
[javac] ^
[javac] class file for javax.xml.bind.JAXBContext not found
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:103: error: cannot access Element
[javac] header.setClientName(clientName);
[javac] ^
[javac] class file for javax.xml.bind.Element not found
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:108: error: cannot find symbol
[javac] } catch (JAXBException jaxbe) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class GeoCodeClient
[javac] <PROJECT_LOC>\src\java\com\cs\service\rest\GeoCodeClient.java:128: error: cannot find symbol
[javac] } catch (JAXBException jaxbe) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class GeoCodeClient
...
...
...
[javac] <PROJECT_LOC>\src\java\com\cs\util\PasswordService.java:51: error: cannot find symbol
[javac] String hash = (new BASE64Encoder()).encode(raw);
[javac] ^
[javac] symbol: class BASE64Encoder
[javac] location: class PasswordService
[javac] <PROJECT_LOC>\src\java\com\cs\util\gis\DeCartaGeoCodeService.java:102: error: cannot find symbol
[javac] } catch (JAXBException e) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class DeCartaGeoCodeService
[javac] <PROJECT_LOC>\src\java\com\cs\util\gis\DeCartaGeoCodeService.java:166: error: cannot find symbol
[javac] } catch (JAXBException e) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class DeCartaGeoCodeService
[javac] <PROJECT_LOC>\src\java\com\cs\util\gis\DeCartaGeoCodeService.java:263: error: cannot find symbol
[javac] } catch (JAXBException e) {
[javac] ^
[javac] symbol: class JAXBException
[javac] location: class DeCartaGeoCodeService
javax.xml.bind was deleted in JDK11, or 9 or.. something after 8. JDK9 broke a ton of stuff. In eclipse you're compiling on JDK9+, on the command line you're compiling vs JDK8. Edit your eclipse project to use JDK8. Alternatively, see this answer about fixing javax.xml.bind.
You probably also have to replace sun.misc.BASE64; JDK8+ ships with base64 built in, for what its worth - just use that. sun.misc was never really public API, which is possibly why it was unceremoniously just removed.
Eclipse can't run Ant internally with the version of Java you want to use. The bridging code it uses was compiled for Java 11 so that it wouldn't simply break with Java 18 onward, and those new Java versions keep coming, so it's run using Java 11 or higher. Because of that requirement, you're running up against Java 11 having removed several packages that were in Java 1.8, like javax.xml.bind (it was deprecated in Java 9).
You probably should update that stack at some point, though. The MySQL version you're using is years out of support.

JDK 11 compiling class files fails with OOM exception

[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.

required: javax.xml.bind.annotation.XmlAccessType

I am trying to import an SVN url on my eclipse.When I tried to run a certain components of the project I keep having this error.
Buildfile: C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\build.xml
init:
pre.compile.test:
[echo] Stax Availability= true
[echo] Axis2 Availability= true
compile.src:
[javac] C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\build.xml:46: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 630 source files to C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\build\classes
[javac] C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\src\com\cbas\conversion\rule\ConversionType.java:10: incompatible types
[javac] found : javax.xml.bind.annotation.AccessType
[javac] required: javax.xml.bind.annotation.XmlAccessType
[javac] #XmlAccessorType(AccessType.FIELD)
[javac] ^
[javac] C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\src\com\cbas\conversion\rule\ParameterType.java:9: incompatible types
[javac] found : javax.xml.bind.annotation.AccessType
[javac] required: javax.xml.bind.annotation.XmlAccessType
[javac] #XmlAccessorType(AccessType.FIELD)
[javac] ^
[javac] C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\src\com\cbas\conversion\rule\CounterType.java:9: incompatible types
[javac] found : javax.xml.bind.annotation.AccessType
[javac] required: javax.xml.bind.annotation.XmlAccessType
[javac] #XmlAccessorType(AccessType.FIELD)
[javac] ^
[javac] C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\src\com\cbas\conversion\rule\ParameterSetType.java:11: incompatible types
[javac] found : javax.xml.bind.annotation.AccessType
[javac] required: javax.xml.bind.annotation.XmlAccessType
[javac] #XmlAccessorType(AccessType.FIELD)
[javac] ^
[javac] C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\src\com\cbas\conversion\rule\CounterSetType.java:11: incompatible types
[javac] found : javax.xml.bind.annotation.AccessType
[javac] required: javax.xml.bind.annotation.XmlAccessType
[javac] #XmlAccessorType(AccessType.FIELD)
[javac] ^
[javac] C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\src\com\cbas\conversion\rule\ConversionsType.java:11: incompatible types
[javac] found : javax.xml.bind.annotation.AccessType
[javac] required: javax.xml.bind.annotation.XmlAccessType
[javac] #XmlAccessorType(AccessType.FIELD)
[javac] ^
[javac] Note: C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\src\com\cbas\services\util\PartyUtil.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 6 errors
BUILD FAILED
C:\Users\phmasu\workspace\CBASServices\branches\CR-XX-SeasonPass\build.xml:46: Compile failed; see the compiler error output for details.
Total time: 8 seconds
Can someone give me an idea as to where am I doing it wrong? I already put all the necessary library on my lib folder based on the documentation given to me. BTW that project runs on JDK 1.5. I have both JDK 1.6 and 1.5 but I dont know how to configure my Eclipse EE to run it on 1.5. Is that what might cause the problem?
Thanks

Cordova fails to build for Android after customising configuration

I followed this instructions to set up Facebook SDK for my Cordova/Ionic project:
http://ngcordova.com/docs/plugins/facebook/
For iOS everything worked well, but for Android, the last step of
cordova build android
fails with weird errors:
-compile:
[javac] Compiling 97 source files to /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/ant-build/classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewClient.java:35: error: cannot find symbol
[javac] import android.webkit.ClientCertRequest;
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: package android.webkit
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewClient.java:145: error: cannot find symbol
[javac] public void onReceivedClientCertRequest (WebView view, ClientCertRequest request)
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: class CordovaWebViewClient
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaChromeClient.java:342: error: cannot find symbol
[javac] public boolean onShowFileChooser(WebView webView, final ValueCallback<Uri[]> filePathsCallback, final WebChromeClient.FileChooserParams fileChooserParams) {
[javac] ^
[javac] symbol: class FileChooserParams
[javac] location: class WebChromeClient
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:25: error: cannot find symbol
[javac] import android.webkit.ClientCertRequest;
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: package android.webkit
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:32: error: cannot find symbol
[javac] private final ClientCertRequest request;
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: class CordovaClientCertRequest
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:34: error: cannot find symbol
[javac] public CordovaClientCertRequest(ClientCertRequest request) {
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: class CordovaClientCertRequest
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaChromeClient.java:340: error: cannot find symbol
[javac] #TargetApi(Build.VERSION_CODES.LOLLIPOP)
[javac] ^
[javac] symbol: variable LOLLIPOP
[javac] location: class VERSION_CODES
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java:197: error: cannot find symbol
[javac] if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
[javac] ^
[javac] symbol: variable LOLLIPOP
[javac] location: class VERSION_CODES
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java:200: error: cannot find symbol
[javac] cookieManager.setAcceptThirdPartyCookies(this, true);
[javac] ^
[javac] symbol: method setAcceptThirdPartyCookies(CordovaWebView,boolean)
[javac] location: variable cookieManager of type CookieManager
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewClient.java:143: error: method does not override or implement a method from a supertype
[javac] #Override
[javac] ^
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaChromeClient.java:341: error: method does not override or implement a method from a supertype
[javac] #Override
[javac] ^
[javac] /Users/glfx/Projects/Sportcial/platforms/android/CordovaLib/src/org/apache/cordova/CordovaChromeClient.java:348: error: cannot find symbol
[javac] Uri[] result = WebChromeClient.FileChooserParams.parseResult(resultCode, intent);
[javac] ^
[javac] symbol: variable FileChooserParams
[javac] location: class WebChromeClient
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 12 errors
[javac] 3 warnings
BUILD FAILED
/Users/glfx/Library/Android/sdk/tools/ant/build.xml:601: The following error occurred while executing this line:
/Users/glfx/Library/Android/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/glfx/Library/Android/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 2 seconds
/Users/glfx/Projects/Sportcial/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/Users/glfx/Projects/Sportcial/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
ERROR building one of the platforms: Error: /Users/glfx/Projects/Sportcial/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/glfx/Projects/Sportcial/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
My manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.android">
<application/>
<uses-sdk android:minSdkVersion='14' android:targetSdkVersion='21' />
</manifest>
I've tried updating Java version, changing target SDK version, Googling.. No luck.
Some details:
java version "1.8.0_40"
Cordova:
Installed platforms: android 3.7.1, ios 3.8.0
Mac OSX latest.
Please assist.
Today I faced same problem, using AdvancedWebView and found cordova related problem. for Ant Users, just check
project.properties file. Change the
target=android-21
Install Android build tools version 21 and 22 from SDK Manager.
Once the build tools are installed, remove the platforms folder inside your app.
Go to Cordova and add the android platform again (using cordova platform add android command).
Then rebuild the app (using cordova build command) and it will build successfully

is this a javac bug or some error in my code

When I run my Ant script, I get the following error
compile-src:
[echo] Source include pattern = **/*.java
[echo] Source exclude pattern =
[echo] Compiling From Source: = /u1/cibuild/.hudson/jobs/LDICommon/workspace/src
[javac] Compiling 99 source files to /u1/cibuild/.hudson/jobs/LDICommon/workspace/dbg1.5/classes/src
[javac] An exception has occurred in the compiler (1.5.0_09). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
[javac] java.lang.AssertionError: {rawtypes}
[javac] at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.visitArray(TreeMaker.java:634)
[javac] at com.sun.tools.javac.code.Attribute$Array.accept(Attribute.java:124)
[javac] at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.translate(TreeMaker.java:637)
[javac] at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.visitCompoundInternal(TreeMaker.java:628)
[javac] at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.translate(TreeMaker.java:641)
[javac] at com.sun.tools.javac.tree.TreeMaker.Annotation(TreeMaker.java:649)
[javac] at com.sun.tools.javac.tree.TreeMaker.Annotations(TreeMaker.java:570)
[javac] at com.sun.tools.javac.tree.TreeMaker.VarDef(TreeMaker.java:554)
[javac] at com.sun.tools.javac.comp.Lower.visitIterableForeachLoop(Lower.java:2892)
[javac] at com.sun.tools.javac.comp.Lower.visitForeachLoop(Lower.java:2755)
[javac] at com.sun.tools.javac.tree.Tree$ForeachLoop.accept(Tree.java:597)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
[javac] at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
[javac] at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
[javac] at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
[javac] at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
[javac] at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
[javac] at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.comp.Lower.visitForLoop(Lower.java:2948)
[javac] at com.sun.tools.javac.tree.Tree$ForLoop.accept(Tree.java:581)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.comp.Lower.visitIterableForeachLoop(Lower.java:2894)
[javac] at com.sun.tools.javac.comp.Lower.visitForeachLoop(Lower.java:2755)
[javac] at com.sun.tools.javac.tree.Tree$ForeachLoop.accept(Tree.java:597)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
[javac] at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
[javac] at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
[javac] at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.comp.Lower.visitIf(Lower.java:2382)
[javac] at com.sun.tools.javac.tree.Tree$If.accept(Tree.java:715)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
[javac] at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
[javac] at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
[javac] at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.comp.Lower.visitIf(Lower.java:2383)
[javac] at com.sun.tools.javac.tree.Tree$If.accept(Tree.java:715)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
[javac] at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
[javac] at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
[javac] at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:129)
[javac] at com.sun.tools.javac.comp.Lower.visitMethodDefInternal(Lower.java:2267)
[javac] at com.sun.tools.javac.comp.Lower.visitMethodDef(Lower.java:2186)
[javac] at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:478)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:1989)
[javac] at com.sun.tools.javac.tree.Tree$ClassDef.accept(Tree.java:434)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
[javac] at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
[javac] at com.sun.tools.javac.comp.Lower.translateTopLevelClass(Lower.java:3064)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:487)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:592)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:544)
[javac] at com.sun.tools.javac.Main.compile(Main.java:67)
[javac] at com.sun.tools.javac.Main.main(Main.java:52)
BUILD FAILED
I'm not sure what is going on, I can compile this project outside ant (in eclipse) without an issue.
I'm almost sure that the message about a bug in the compiler is a red herring, I suspect the real problem has to do with the message:
[javac] java.lang.AssertionError: {rawtypes}
but there isn't much information to help tracking down the root cause of the error.
Any ideas?
Given your compiler is really old and not publicly supported, I would assume that upgrading your JDK would be a good starting place.
The last free version of Java 5.0 is update 22 (you have update 9).
http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html
The latest version of Java is Java 6 update 26.
http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html
It clearly says that it is a compiler bug:
An exception has occurred in the compiler (1.5.0_09). Please file a bug at the
Java Developer Connection (http://java.sun.com/webapps/bugreport) after
checking the Bug Parade for duplicates. Include your program and the following
diagnostic in your report. Thank you.
As Peter said, first check if the same problem occurs in a newer javac version, and then file a bug report. (You might try to minimize down your code to an SSCEE first.)
Eclipse does not use javac, but has its own compiler included, thus this does not tell us anything here.

Categories

Resources