Saturday, July 14, 2012

[How-to] Install Maven with Eclipse

This article shows you how to use Maven with Eclipse.

1. Open Eclipse, Click Help -> Install New Software in the menu tool bar

2. Select Maven in the drop down list.
If it does not exist, click "Add" to input the Maven link
http://download.eclipse.org/technology/m2e/releases 


3. Select m2e - Maven Integration for Eclipse and click Next button.

4. Click Next for the installation

5. Accept the license.

6. Download and install the software

7. Restart the Eclipse

8. Installation Completed!



Thursday, July 12, 2012

[RESOLVED] MySQL Workbench installation

No response after clicking the MySQL Workbench program.


Resolve:

Make sure the following components are installed in your machine.


1. Microsoft .NET Framework 4 Client Profile (Web Installer)
http://www.microsoft.com/en-us/download/details.aspx?id=17113


2. Microsoft Visual C++ 2010 Redistributable Package (x86)
http://www.microsoft.com/en-us/download/details.aspx?id=5555
 

3. In some cases, Windows Imaging Component is required
http://www.microsoft.com/en-us/download/details.aspx?id=32

Reference:

Download the MySQL workbench
http://dev.mysql.com/downloads/workbench/


Keywords:
MSSQL Studio, toad

Wednesday, July 4, 2012

Eclipse Development Platform Setup



The following tutorial shows how to setup the development environment for Java Application
You have to install the following software in your machine.
- JAVA SDK
- Eclipse
Steps by steps1. Download and Install the latest version of the Java SDK. 


2. Download Eclipse, either IDE for Java Developer or Java EE Developer is okay.

3. Unzip the eclipse, Open it with selecting a workspace

4. Done


java.lang.UnsupportedClassVersionError: Bad version number in .class file


This is due to the incorrect Java Version for the complication & execution.

Resolution:
Download the correct Java Version for the complication.

HTTP Status 500 -


type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Bad version number in .class file
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.UnsupportedClassVersionError: Bad version number in .class file
 java.lang.ClassLoader.defineClass1(Native Method)
 java.lang.ClassLoader.defineClass(ClassLoader.java:620)
 java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
 org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812)
 org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866)
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319)
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
 org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1325)
 org.apache.jasper.compiler.Parser.parseElements(Parser.java:1573)
 org.apache.jasper.compiler.Parser.parse(Parser.java:126)
 org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
 org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
 org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

Wednesday, June 27, 2012

[Resolved] WARNING: getRGBImage returned NULL PDFToImage: Rendered Blank Image

Problem:
System returns the following message when converting a PDF file to Image using PDFBox,


Jun 27, 2012 3:45:07 PM org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap getRGBImage
SEVERE: Something went wrong ... the pixelmap doesn't contain any data.
Writing: output1.jpg
Jun 27, 2012 3:45:07 PM org.apache.pdfbox.util.operator.pagedrawer.Invoke process
WARNING: getRGBImage returned NULL
result: true



A blanked image will be generated in this case.

Resolution
1. You may try to add Java Advanced Image library I/O Tools to your project for the fix.
http://www.oracle.com/technetwork/java/current-142188.html


2. Include the JAR jai_imageio.jar to your project and execute the project again.


3. Though there is still an WARNING message of EOC marker not found. Codestream is corrupted. shown in the output console, the image is generated successfully.

The usage of PDFBox can be found in the following URL:
http://yp-javadev.blogspot.hk/2012/06/useful-api-converting-pdf-to-image.html

Useful API converting PDF to image

1. Download the tool PDFBox (e.g. pdfbox-app-1.7.0.jar) via the following URL:


2. Include the library in your java program. The following source code is attached for your reference.



package com.test;

import java.awt.Toolkit;
import java.awt.image.BufferedImage;

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.util.PDFImageWriter;

public class PDFBoxPreviewTest {

       /**
        * @param args
        */
       public static void main(String[] args) {
              try {
                     String path = "D:\\temp\\a.pdf";
                     PDFBoxPreviewTest t = new PDFBoxPreviewTest();
                     t.getDocument(path);
              } catch (Exception e) {

                     System.out.println(e.getMessage());
              }
       }

       private PDDocument getDocument(String path) throws Exception {
              PDDocument document = null;

              document = PDDocument.load(path);

              PDFImageWriter writer = new PDFImageWriter();
              boolean success = writer.writeImage(document, "jpg", "", 1, 1,
                           "myFileName", BufferedImage.TYPE_INT_RGB, Toolkit
                                         .getDefaultToolkit().getScreenResolution());
              System.out.println(success);

              return document;
       }
}

3. myFileName.jpg will be generated!


Source Code can be found here:
http://test-pdfbox.googlecode.com/svn/trunk/

Monday, June 18, 2012

[RESOLVED] A Java Runtime Environment (JRE) or Java Development Toolkit (JDK) must be available in order to run Eclipse

A Java Runtime Environment (JRE) or Java Development Toolkit (JDK) must be available in order to run Eclipse.


Solution:

Java must be installed in your Windows in order to run eclipse.
http://java.com/en/download/index.jsp

After installed Java, set the JAVA PATH in System Variable.