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.
Related
I have been successfully using the FTDI D2XX driver on arm-v7 from c++ and Python, but I now need to use java.
Also, I have successfully used the ftd2xxj JNI wrapper on Windows and OSX using this modified ftd2xxj project
Please bare in mind I am not very comfortable with JNI and Makefiles yet.
The issue is I can't seem to compile the ftd2xxj project from source.
The OSX modified version relies on xcodebuild and I'm not sure how to convert that to cmake/Makefiles. (I did have a quick look at pbxbuild and buildtool but couldn't figure out how to use).
I have checked out the original ftd2xxj source code from sourceforge and imported the projects in eclipse, but I'm running into some issues:
The ftd2xxj Java project is referencing a javax.util project which isn't present in the repository and I wasn't sure where to find it. I assumed this might be related to javax.util.property.2_0.jar I spotted in the precompiled binaries. As a hacky workaround I created a blank javax.util project and added the .jar file to the project's requiring it to keep eclipse from complaining (but this is likely to mess up the original config).
In short: I can't compile the original ftd2xxj project (so far because of a missing javax.util project for the javax.util.properties library) and I would like to compile the project on arm-v7 (either with eclipse or Makefiles)
Any hints/tips on how I can compile the project ?
For reference here is the output from ant:
build-all:
build-application:
init:
[echo] Start time: 25-November-2015 : 16:55:24
[echo] Used JDK: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
[echo] !!! Be sure to use a Java SDK !!!
[echo] Project classpath:
compile-application-release:
clean-application:
clean-application-docs:
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/build.xml:216: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 36 source files to /Users/georgeprofenza/Documents/eclipse/ftd2xxj/target/application/bin
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:8: package javax.util does not exist
[javac] import javax.util.Localizer;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/EEPROM.java:3: package javax.util does not exist
[javac] import javax.util.Localizer;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Port.java:3: package javax.util does not exist
[javac] import javax.util.Localizer;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/DeviceDescriptor.java:3: package javax.util does not exist
[javac] import javax.util.Localizer;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/FTStatus.java:5: package javax.util does not exist
[javac] import javax.util.Localizer;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:14: package javax.util does not exist
[javac] import javax.util.Localizer;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:15: package javax.util.property does not exist
[javac] import javax.util.property.Property;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:16: package javax.util.property does not exist
[javac] import javax.util.property.PropertyPersistenceManager;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/ui/deviceTree/DevicesTreePanel.java:25: package javax.util does not exist
[javac] import javax.util.Localizer;
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:59: cannot find symbol
[javac] symbol : class Property
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] #Property(defaultValue = " ")
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:65: cannot find symbol
[javac] symbol : class Property
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] #Property(key = "com.ftdichip.ftd2xx.Device.writeTimeout", defaultValue = "300")
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:71: cannot find symbol
[javac] symbol : class Property
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] #Property(key = "com.ftdichip.ftd2xx.Device.readTimeout", defaultValue = "300")
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:77: cannot find symbol
[javac] symbol : class Property
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] #Property(key = "com.ftdichip.ftd2xx.Device.latencyTimer", defaultValue = "-1")
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:83: cannot find symbol
[javac] symbol : class Property
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] #Property(key = "com.ftdichip.ftd2xx.Device.resetPipeRetryCount", defaultValue = "-1")
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:89: cannot find symbol
[javac] symbol : class Property
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] #Property(key = "com.ftdichip.ftd2xx.Device.usbReceiveBufferSize", defaultValue = "-1")
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:95: cannot find symbol
[javac] symbol : class Property
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] #Property(key = "com.ftdichip.ftd2xx.Device.usbTransmitBufferSize", defaultValue = "-1")
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:142: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalStateException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:155: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalStateException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:302: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:347: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:454: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:545: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:608: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:657: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:661: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:695: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:770: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:774: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:780: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] logger.fine(Localizer.getLocalizedMessage(Device.class,
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:879: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:883: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Device.java:887: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Device
[javac] logger.fine(Localizer.getLocalizedMessage(Device.class,
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/EEPROM.java:33: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.EEPROM
[javac] throw new IllegalStateException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Port.java:58: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Port
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Port.java:92: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Port
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Port.java:163: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Port
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Port.java:190: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Port
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/DeviceDescriptor.java:106: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.DeviceDescriptor
[javac] throw new InvalidDeviceDescriptorException(Localizer
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/FTStatus.java:146: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.FTStatus
[javac] return Localizer.getLocalizedMessage(FTStatus.class, status.toString());
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/FTStatus.java:164: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.FTStatus
[javac] String message = Localizer.getLocalizedMessage(FTStatus.class,
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:107: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] logger.log(Level.SEVERE, Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:129: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] logger.config(Localizer.getLocalizedMessage(Service.class,
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:147: cannot find symbol
[javac] symbol : variable PropertyPersistenceManager
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] PropertyPersistenceManager
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/Service.java:150: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.Service
[javac] throw new RuntimeException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/ui/deviceTree/DevicesTreePanel.java:103: cannot find symbol
[javac] symbol: variable Localizer
[javac] String title = Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/ui/deviceTree/DevicesTreePanel.java:107: cannot find symbol
[javac] symbol: variable Localizer
[javac] String message = Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/ui/deviceTree/DevicesTreePanel.java:147: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreePanel
[javac] text = Localizer.getLocalizedMessage(DevicesTreePanel.class,
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/ui/deviceTree/DevicesTreePanel.java:151: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreePanel
[javac] text = Localizer.getLocalizedMessage(DevicesTreePanel.class,
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/ui/deviceTree/DevicesTreePanel.java:211: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreePanel
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] /Users/georgeprofenza/Documents/eclipse/ftd2xxj/src/application/com/ftdichip/ftd2xx/ui/deviceTree/DevicesTreePanel.java:223: cannot find symbol
[javac] symbol : variable Localizer
[javac] location: class com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreePanel
[javac] throw new IllegalArgumentException(Localizer.getLocalizedMessage(
[javac] ^
[javac] 50 errors
BUILD FAILED
/Users/georgeprofenza/Documents/eclipse/ftd2xxj/build.xml:107: The following error occurred while executing this line:
/Users/georgeprofenza/Documents/eclipse/ftd2xxj/build.xml:112: The following error occurred while executing this line:
/Users/georgeprofenza/Documents/eclipse/ftd2xxj/build.xml:216: Compile failed; see the compiler error output for details.
Total time: 2 seconds
Update 1
I've made some progress with the original eclipse based project and managed to run the ant build from the ftd2xxj project, which seems to generate the JNI headers, but it doesn't seem to compile the JNI library. (I haven't spotted anything in the ant file that points to anything JNI related other than the JNI headers). It is still unclear what the recommended method of compiling the JNI library (now that the headers are ready).
I noticed there is a com.ftdichip.ftd2xx.linux.x86, which is referenced from the ftd2xxj, but I'm not sure how it's being used and if I would like to make com.ftdichip.ftd2xx.linux.armv7 folder, how would I do that ?
Update 2
I've noticed a problem eclipse flags for the com.ftdichip.ftd2xx project:
An API baseline has not been set for the current workspace
Based on this answer I've set preferences to Warn instead of Error.
I hope this won't cause major problems
I've made further progress with the eclipse projects and noticed something happening with the ftd2xx-native project. It tries to compile based on Makefiles, but it fails:
19:14:51 **** Incremental Build of configuration linux-i386 for project ftd2xxj-native ****
make all
Building file: ../src/device.c
Invoking: GCC C Compiler
gcc -I/home/pi/eclipse/ftd2xxj-native/external/include -I/include -I/include/linux -O0 -Wall -c -fmessage-length=0 -fPIC -m32 -MMD -MP -MF"src/device.d" -MT"src/device.d" -o"src/device.o" "../src/device.c"
gcc: error: unrecognized command line option ‘-m32’
src/subdir.mk:39: recipe for target 'src/device.o' failed
make: *** [src/device.o] Error 1
19:14:51 Build Finished (took 246ms)
I noticed the -m32 flag, sub when I try to edit the src/subdir.mk file I get a warning the file is generated. I am still not sure how these Make files are generated. Any hints in this direction would be helpful
Update 3
I now notice the ftd2xxj-native is the JNI C project and there are some extra settings via Eclipse CDT. I can see the -m32 flags, but I'm unable to change the settings. I'm going through the CDT docs. Any hints/tips on configuring and compiling JNI projects via CDT will are appreciated
Turns out there were quite a things to setup.
I compiled the project on a Raspberry PI 2 using eclipse 3.8.1 with CDT 8.5.0.
Using this version resulted in a single API baseline error, which in Preferences > Plug-in Development > API Baselines can be set to Warning instead Error if any are missing.
I had to change the JRE (J2SE01.5 used in the original project was missing) but java 7 openJDK and Oracle JDK 8 were present on the system.
Most of the settings I was looking in terms of compiler flags were present in the ftd2xx-native project properties under C/C++ Build > Settings
There are the settings I've used:
C Compiler Includes
/usr/lib/jvm/java-7-openjdk-armhf/include
/usr/lib/jvm/java-7-openjdk-armhf/include/linux
"${workspace_loc:/${ProjName}/external/include}"
C Compiler Flags (Miscaleneous > Other Flags)
-c -fmessage-length=0 -fPIC -march=armv7-a -mfloat-abi=hard -ftree-vectorize -Wno-psabi -pipe-c -fmessage-length=0 -fPIC -march=armv7-a -mfloat-abi=hard -ftree-vectorize -Wno-psabi -pipe
C linker libraries (-l)
jvm
ftd2xx
C linker library search paths(-L)
/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/lib/arm/client
"${workspace_loc:/${ProjName}/external}"
I was originally using the java 7 openjdk path, but the client library vanished at some point (not sure if cleaning the c++ project had anything to do with that)
Miscaleneous > Other Flags
--no-undefined
Shared library settings
Shared is on (-shared) Shared object name
lib${BuildArtifactFileName}.${MAJOR_VERSION}
MAJOR_VERSION and MINOR_VERSION were defined in C/C++ Build > Build Variables (as Strings)
Hope this helps anyone else trying to compile this JNI wrapper on a different platform
I terms of using the libraries, it's worth taking note of the driver's readme file, especially the ones on unloading the serial driver and running java as sudo when using this library:
If the message "FT_Open failed" appears:
Perhaps the kernel automatically loaded another driver for the
FTDI USB device.
sudo lsmod
If "ftdi_sio" is listed:
Unload it (and its helper module, usbserial), as follows.
sudo rmmod ftdi_sio
sudo rmmod usbserial
Otherwise, it's possible that libftd2xx does not recognise your
device's Vendor and Product Identifiers. Call FT_SetVIDPID before
calling FT_Open/FT_OpenEx/FT_ListDevices.
I think it's maybe because you are trying to compile your project with a JRE instead of the Java JDK ?
Try Java --version in the console and see if you got the JDK installed. If not, download it from Oracle, be sure to put it into your Path and into the JAVA_HOME variable.
I have a problem when building a ANT jar file with cordova 4.1.1 source code.
this is a command line when i build ANT.
C:\package\framework>android update project -p . -t android-19
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Updated file C:\package\framework\proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
C:\package\framework>android update project -p . -t android-19 --subprojects
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Updated file C:\package\framework\proguard-project.txt
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using project folder name 'bin'.
If you wish to change it, edit the first line of build.xml.
Added file C:\package\framework\bin\build.xml
Added file C:\package\framework\bin\proguard-project.txt
C:\package\framework>ant jar
Buildfile: C:\package\framework\build.xml
-pre-build:
-check-env:
[checkenv] Android SDK Tools Revision 24.4.1
[checkenv] Installed at C:\Android\adt-bundle-windows-x86_64-20140702\sdk
-setup:
[echo] Project Name: Cordova
[gettype] Project Type: Android Library
-build-setup:
[getbuildtools] Using latest Build Tools: 20.0.0
[echo] Resolving Build Target for Cordova...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: C:\package\framework\bin\rsObj
[mkdir] Created dir: C:\package\framework\bin\rsLibs
[echo] ----------
[echo] Resolving Dependencies for Cordova...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with '${build.target}'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Found new input file
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 36 source files to C:\package\framework\bin\classes
[javac] C:\package\framework\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] C:\package\framework\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] C:\package\framework\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] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:40: error: cannot find symbol
[javac] import android.webkit.PermissionRequest;
[javac] ^
[javac] symbol: class PermissionRequest
[javac] location: package android.webkit
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:253: error: cannot find symbol
[javac] public boolean onShowFileChooser(WebView webView, final ValueCal
lback<Uri[]> filePathsCallback, final WebChromeClient.FileChooserParams fileChoo
serParams) {
[javac]
^
[javac] symbol: class FileChooserParams
[javac] location: class WebChromeClient
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:273: error: cannot find symbol
[javac] public void onPermissionRequest(final PermissionRequest request)
{
[javac] ^
[javac] symbol: class PermissionRequest
[javac] location: class SystemWebChromeClient
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebViewClie
nt.java:29: error: cannot find symbol
[javac] import android.webkit.ClientCertRequest;
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: package android.webkit
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebViewClie
nt.java:116: error: cannot find symbol
[javac] public void onReceivedClientCertRequest (WebView view, ClientCer
tRequest request)
[javac] ^
[javac] symbol: class ClientCertRequest
[javac] location: class SystemWebViewClient
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:251: error: cannot find symbol
[javac] #TargetApi(Build.VERSION_CODES.LOLLIPOP)
[javac] ^
[javac] symbol: variable LOLLIPOP
[javac] location: class VERSION_CODES
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:271: error: cannot find symbol
[javac] #TargetApi(Build.VERSION_CODES.LOLLIPOP)
[javac] ^
[javac] symbol: variable LOLLIPOP
[javac] location: class VERSION_CODES
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemCookieManag
er.java:37: 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] C:\package\framework\src\org\apache\cordova\engine\SystemCookieManag
er.java:38: error: cannot find symbol
[javac] cookieManager.setAcceptThirdPartyCookies(webView, true);
[javac] ^
[javac] symbol: method setAcceptThirdPartyCookies(WebView,boolean)
[javac] location: variable cookieManager of type CookieManager
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemCookieManag
er.java:59: 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] C:\package\framework\src\org\apache\cordova\engine\SystemCookieManag
er.java:60: error: cannot find symbol
[javac] cookieManager.flush();
[javac] ^
[javac] symbol: method flush()
[javac] location: variable cookieManager of type CookieManager
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:259: error: cannot find symbol
[javac] Uri[] result = WebChromeClient.FileChooserParams
.parseResult(resultCode, intent);
[javac] ^
[javac] symbol: variable FileChooserParams
[javac] location: class WebChromeClient
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:252: error: method does not override or implement a method from a supe
rtype
[javac] #Override
[javac] ^
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:272: error: method does not override or implement a method from a supe
rtype
[javac] #Override
[javac] ^
[javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebViewClie
nt.java:114: error: method does not override or implement a method from a supert
ype
[javac] #Override
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 18 errors
BUILD FAILED
C:\Android\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:716: The f
ollowing error occurred while executing this line:
C:\Android\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
Total time: 1 second
I use ANT 1.9.6, Cordova 4.1.1.
Anyone can help me!
Thanks so much.
I also have this issue. The above errors can be resolved changing targetsdkversion to 22. but that also (sometimes) wont be allowed you to build apks using ant. Try to build the project using gradle.
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
As I pointed out in my previous question, I am trying to set up an automatic build system with Jenkins CI for a NetBeans multitiered web application project.
My Ant targets are clean and debug. Clean works, but debug fails when trying to compile the project.
In the output of my Jenkins build I see the following command:
[PGB Webapp] $ cmd.exe /C '""C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Ant_AntInstallation\Apache_Ant\bin\ant.bat" "-Dlibs.MySQLDriver.classpath=C:/Program Files (x86)/MySQL/MySQL Connector J/mysql-connector-java-5.1.31-bin.jar" "-Dlibs.CopyLibs.classpath=C:/Program Files/NetBeans 8.0/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar" "-Dj2ee.server.home=C:/Program Files/wildfly-8.1.0.Final" clean debug && exit %%ERRORLEVEL%%"'
And this is the last part of my output: (the part that seems most important to me)
library-inclusion-in-manifest:
-do-compile:
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\empty
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\generated-sources\ap-source-output
[javac] Compiling 2 source files to C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\web\WEB-INF\classes
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:6: error: package javax.ws.rs.core does not exist
[javac] import javax.ws.rs.core.Application;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:8: error: cannot find symbol
[javac] public class ApplicationConfig extends Application {
[javac] ^
[javac] symbol: class Application
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:12: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.GET;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:13: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.Path;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:14: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.PathParam;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:15: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.QueryParam;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:16: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.Produces;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:17: error: package javax.ws.rs.core does not exist
[javac] import javax.ws.rs.core.MediaType;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:19: error: cannot find symbol
[javac] #Path("/employees")
[javac] ^
[javac] symbol: class Path
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:29: error: cannot find symbol
[javac] public List<Employee> find(#QueryParam("name") String name) {
[javac] ^
[javac] symbol: class QueryParam
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:27: error: cannot find symbol
[javac] #GET
[javac] ^
[javac] symbol: class GET
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:28: error: cannot find symbol
[javac] #Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
[javac] ^
[javac] symbol: class Produces
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:38: error: cannot find symbol
[javac] public Employee findById(#PathParam("id") String id) {
[javac] ^
[javac] symbol: class PathParam
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:36: error: cannot find symbol
[javac] #GET #Path("{id}")
[javac] ^
[javac] symbol: class GET
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:36: error: cannot find symbol
[javac] #GET #Path("{id}")
[javac] ^
[javac] symbol: class Path
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:37: error: cannot find symbol
[javac] #Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
[javac] ^
[javac] symbol: class Produces
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:44: error: cannot find symbol
[javac] public List<Employee> findByManager(#PathParam("id") String managerId) {
[javac] ^
[javac] symbol: class PathParam
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:42: error: cannot find symbol
[javac] #GET #Path("{id}/reports")
[javac] ^
[javac] symbol: class GET
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:42: error: cannot find symbol
[javac] #GET #Path("{id}/reports")
[javac] ^
[javac] symbol: class Path
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:43: error: cannot find symbol
[javac] #Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
[javac] ^
[javac] symbol: class Produces
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:17: error: method does not override or implement a method from a supertype
[javac] #Override
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:22: error: method does not override or implement a method from a supertype
[javac] #Override
[javac] ^
[javac] 22 errors
BUILD FAILED
C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\nbproject\build-impl.xml:208: The following error occurred while executing this line:
C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\nbproject\build-impl.xml:881: The following error occurred while executing this line:
C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\nbproject\build-impl.xml:297: Compile failed; see the compiler error output for details.
Total time: 1 second
Build step 'Start Ant' marked build as failure
Finished: FAILURE
Well, the important thing here is that the Java compiler is not able to locate the RESTful Web Services library. I found the jar I need at C:/Program Files/wildfly-8.1.0.Final/modules/system/layers/base/javax/ws/rs/api/main/jaxrs-api-3.0.8.Final.jar.
I have no experience with the Ant buildtool, so I have searched and found a lot about it, but I cannot seem to figure out how to get this library added so that the project gets properly build on Jenkins.
Currently my build.xml file looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project name="pgb" default="default" basedir="." xmlns:ear="http://www.netbeans.org/ns/j2ee-earproject/2">
<description>Builds, tests, and runs the project pgb.</description>
<import file="nbproject/build-impl.xml"/>
<taskdef resource="net/jtools/classloadertask/antlib.xml">
<classpath>
<fileset dir="${basedir}/lib" includes="ant-classloader*.jar"/>
</classpath>
</taskdef>
<!--Add jar to the classpath-->
<classloader loader="system">
<classpath>
<fileset dir="${basedir}/lib" includes="jboss-modules.jar"/>
<fileset dir="${basedir}/lib" includes="jaxrs-api-3.0.8.Final.jar"/>
</classpath>
</classloader>
</project>
The file build-impl.xml (which is imported) is generated by NetBeans (as you may probably know already) and is too big to display here, besides I could not change anything there because the system might automatically change that file itself.
Anyway, as you can see I've tried to use an Ant Classloader I found here: https://stackoverflow.com/a/5116470/2541501
But no luck there.. I even added the required jar-file to the lib directory of the project.
So, my question is: how do I change my Ant buildscript so that the Java compiler does not complain about missing packages (i.e. missing jar files)?
I am also worried that if I add any targets to my build.xml file that it might conflict with anything that is declared in the generated build-impl.xml file. Anyone also know anything about this?
Okay my colleague found out that we simply needed to copy the private properties of the NetBeans project into the Properties field of the Ant Invoke of the Jenkins job of our project.
So, our NetBeans project has a directory called private in the nbproject-directory. In this private directory there is a file called private.properties. We took the properties from this file and copied it into the Properties field of the Ant Invoke. Now our Properties field looks as follows:
libs.CopyLibs.classpath=C:/Program Files/NetBeans 8.0/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
libs.MySQLDriver.classpath=C:/Program Files (x86)/MySQL/MySQL Connector J/mysql-connector-java-5.1.31-bin.jar
j2ee.platform.is.jsr109=true
j2ee.server.domain=C:/Wildfly/standalone
j2ee.server.home=C:/Wildfly
j2ee.server.instance=wildfly-deployer:localhost:8080#standalone&C:\\Wildfly
Now we can perform all Ant commands without a problem. We are also able to deploy the web application that is build through Jenkins.
If anyone is wondering, the RESTful Web Services can be found in WildFly. So we don't need to include the jar of the RESTful Web Services directly, all we need is to set the properties for the WildFly server right.
In retrospect, I would say that it is not that hard at all to set-up a continuous integration system with automatic builds for a NetBeans project. Now, next step is to also include automated testing for the project.
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.