Breaking News
Home / Java (page 5)

Java

No Registered ImageReader claims to be able to read the resulting stream, null is returned.

Exception While trying to read and write image as PNG  with the code sas BufferedImage image = ImageIO.read(new ByteArrayInputStream(decodedBytes));            if (image == null) {                log.error(“Buffered Image is null”);            }            File f = new File(uploadFile);             ImageIO.write(image, “png”, f);<!

Read More »

Warning – sun.misc.BASE64Decoder is Sun proprietary API and may be removed in a future release

Issue I am using Base64 Decoder from JDK 1.6.x, the program runs fine but when I compile my the application it gives the following warnings: Compiling 35 source files to /home/infuze/service/projects/infuze/build/classes    [javac] /home/local/service/projects/infuze/src/java/com/test/service/subscription/workflow/SubscriptionUploadWorkflow.java:11: warning: sun.misc.BASE64Decoder is Sun proprietary API and may be removed in a future release    [javac] import sun.misc.BASE64Decoder;    …

Read More »

How do disable low level logging for Apache Common Packages?

Answer Log4j can be configured via a properties file or an xml file. The below is an example of configuring Log4j using a properties file. Generally for simplicity the file name is called as log4j.properties but can be anything. Typical Configuration log4j.rootLogger=trace,R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=../logs/server.log log4j.appender.R.MaxFileSize=1024KB log4j.appender.R.MaxBackupIndex=5 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%d[%t]%-5p%c{1}%x-%m%n Disable Apache …

Read More »

How does a typical standalone Java program shell script look like?

#!/bin/sh echo “########################################################”echo “Sample Run Script”echo “Copyright reserved Developerfeed.com@2010-2012!”echo “########################################################” # relative classesroot_dir=../lib_dir=../lib # include all libs in jar filefor i in ../lib/*.jar; do  classpath=$classpath:$idone classpath=$classpath:../build/classesclasspath=$classpath:$root_dir/config env_options=-Dlog4j.properties=log4j.propertiesjava_cmd_line=”java -cp $classpath $env_options” #launch the programecho “########################################################”echo “Launching the program”echo “########################################################”$java_cmd_line com.xyz.server.Startup [pb_builder]

Read More »
Advertisment ad adsense adlogger