Building Cocoon 2.1.0 with JDK 7 error: compile-build.xml: 68

I use java JDK 7 in my attempt to build cocoon 2.1.10 on Windows 2008 R2 for final deployment on Tomcat 7. I downloaded the cocoon source files, unpacked them, set the JAVA_HOME variable, and then tried to run the build.bat file. I get 11 different compilation errors.

D:\cocoon-2.1.10-src\cocoon-2.1.10>build.bat Buildfile: build.xml prepare: ==================================================================== Apache Cocoon 2.1.10 [1999-2006] ==================================================================== Building with Apache Ant version 1.6.5 compiled on June 2 2005 -------------------------------------------------------------------- Using build file D:\cocoon-2.1.10-src\cocoon-2.1.10\build.xml -------------------------------------------------------------------- Compiler options: - debug ......... [on] - optimize ...... [on] - deprecation ... [off] ==================================================================== compile-core: Compiling 594 source files to D:\cocoon-2.1.10-src\cocoon-2.1.10\build\cocoon\classes D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:39: error: package com. sun.image.codec.jpeg does not exist import com.sun.image.codec.jpeg.ImageFormatException; ^ D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:40: error: package com. sun.image.codec.jpeg does not exist import com.sun.image.codec.jpeg.JPEGCodec; ^ D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:41: error: package com. sun.image.codec.jpeg does not exist import com.sun.image.codec.jpeg.JPEGEncodeParam; ^ D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:42: error: package com. sun.image.codec.jpeg does not exist import com.sun.image.codec.jpeg.JPEGImageEncoder; ^ D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:326: error: cannot find symbol JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); ^ symbol: class JPEGImageEncoder location: class ImageReader D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:326: error: cannot find symbol JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); ^ symbol: variable JPEGCodec location: class ImageReader D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:327: error: cannot find symbol JPEGEncodeParam p = encoder.getDefaultJPEGEncodeParam(currentImage); ^ symbol: class JPEGEncodeParam location: class ImageReader D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:333: error: cannot find symbol JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bstream); ^ symbol: class JPEGImageEncoder location: class ImageReader D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:333: error: cannot find symbol JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bstream); ^ symbol: variable JPEGCodec location: class ImageReader D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:334: error: cannot find symbol JPEGEncodeParam p = encoder.getDefaultJPEGEncodeParam(currentImage); ^ symbol: class JPEGEncodeParam location: class ImageReader D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:342: error: cannot find symbol } catch (ImageFormatException e) { ^ symbol: class ImageFormatException location: class ImageReader 11 errors BUILD FAILED D:\cocoon-2.1.10-src\cocoon-2.1.10\tools\targets\compile-build.xml:68: The following error occurred while exec uting this line: D:\cocoon-2.1.10-src\cocoon-2.1.10\tools\targets\compile-build.xml:51: Compile failed; see the compiler error output for details. 

I also tried using "build war" on my command line, and this gave the same result.

Is this a problem with the JDK I'm using, or is there something else I need to see? This is my first attempt to create and deploy a cocoon; I might have missed something obvious.

Regards, Tony

+4
source share
3 answers

The obsolete, patented com.sun.image.jpeg.codec package has been removed from JDK 7 (see the official JDK7 compatibility official note ). Therefore, your compilation problem.

Since fixing the Cocoon source may not be an option in your situation, the shortest way for you may be to compile using JDK 6 (or earlier, Cocoon 2.1 requires β€œJava 1.3 or later” ).

(But if this is how you think you need specific versions of Cocoon and JDK, you might want to take a look at SO Q & A with How to replace com.sun.image.codec.jpeg.JPEGImageEncoder with calls to the standard Java Image I / O API )


Another option would be to view a separate distribution package for the com.sun.image.jpeg.codec package for inclusion in the build path (and possibly runtime). I am not sure about the availability (and ease of use) of this option. In any case, I would not recommend delving into it if the whole other path did not turn out to be dead ...

+4
source

In my case, the solution for this error was: search for the folder was approved, it should be on the way: cocoon-2.1.11-src \ cocoon-2.1.11 \ lib \ endorsed copy this folder to your currency JAVA_HOME / jre / lib And try to build again. I hope this solves your problem

+1
source

I know this is old, but in case anyone is interested, I was able to create Cocoon 2.1 recently without errors

I needed to get the latest source from my current dev branch (2_1_X), since I found that they fixed this error, but it was still not in their latest version (2.1.12) yet

I really was able to build it using JDK 8, and also run it with Tomcat 8. I will have to make some settings to work normally with it

0
source

Source: https://habr.com/ru/post/1439231/


All Articles