Category Archives: Java

(Español)

Lenguaje de programación Java, agruparemos aquí las publicaciones sobre Java, como Java I/O, Java JDBC, Java Xml, Java Swing, …

  • Java I/O: agrupa las librerías para manejar ficheros, entrada y salida, lectura de directorios,…
  • Java Excel: explicaciones de como utilizar la librería Apache POI para leer y crear hojas excel con ejemplos
  • Java Swing: nos adentramos con ejemplos en Java Swing a explicar su utilización, estos están dedicados a la gente que empieza con Java y busca ejemplos para su aprendizaje inicial.

(Español) Añadiendo Apache Tomcat a Spring Tool Suite

Sorry, this entry is only available in European Spanish. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

Hasta ahora hemos usado siempre Pivotal tc Server para los proyectos en los que hemos utilizado Spring ya sea con Spring Roo o con Spring Framework, en este tutorial vamos a ver como podemos añadir Apache Tomcat a Spring Tool Suite (STS), en este enlace encontrarás algunas de las características básicas de este IDE.

Spring Tool Suite™

Your tools should be as refined as the code you write. STS is our Eclipse-based IDE crafted to serve the needs of building applications with Spring. We’re always working on new features and performance in our mission to make STS the most productive Eclipse distribution available.

Si todavía no lo tienes instalado Spring Tool Suite (STS) o lo quieres instalar de nuevo, en este enlace: Spring Tool Suite™ Downloads tienes las descargar y la explicación para la instalación en tu sistema operativo.

Apache Tomcat™

¿Qué es? Seguro que ya lo sabes, es un implementación de software open source de Java Servlet, JavaServer Pages, Java Expression Language and las tecnologías Java WebSocket.
Continue reading (Español) Añadiendo Apache Tomcat a Spring Tool Suite

Java write excel with Apache Poi Java API

Java escribir excel con Apache Poi Java API

In any application or development is often necessary to process Excel files or other spreadsheets, in this case, we will focus on Microsoft’s OLE 2 documents, and manipulate them in this case using Apache POI – the Java API for Microsoft Documents,that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.

We’ll explain how to create a new excel sheet, how to add cells, modify its content and modify its content and definitely manipulate data according to need using the POI-HSSF and POI-XSSF – Java API To Access Microsoft library, where HSSF is the POI project full implementation in Java for excel.

We will introduce the elements of this library that we will use to read and create an Excel spreadsheet.

  • HSSFWorkbook: High level representation of a workbook. This is the first object will construct whether they are reading or writing a workbook.
  • HSSFSheet: high level representation of a worksheet, we can choose the sheet using the HSSFWorkBook.
  • HSSFRow: representation of a row of a spreadsheet, only rows that have cells should be added to a Sheet.
  • HSSFCell: representation of a cell in a row of a spreadsheet, we use to manage the contents of the cell.

Make attention for use this library you need to add it to the project that you are working on, download the library API Apache Poi Java to add it, here I explain how to add it to a Netbeans project, also It can be useful with other IDEs because is do it in a similar way.

 
Continue reading Java write excel with Apache Poi Java API

Java read excel with Apache Poi Java API

Java leer excel con Apache Poi Java API

In any application or development is often necessary to process Excel files or other spreadsheets, in this case, we will focus on Microsoft’s OLE 2 documents, and manipulate them in this case using Apache POI – the Java API for Microsoft Documents,that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.

Performed the introduction, we will introduce the elements of this library that we will use to read and create an Excel spreadsheet.

  • HSSFWorkbook: High level representation of a workbook. This is the first object will construct whether they are reading or writing a workbook.
  • HSSFSheet: high level representation of a worksheet, we can choose the sheet using the HSSFWorkBook.
  • HSSFRow: representation of a row of a spreadsheet, only rows that have cells should be added to a Sheet.
  • HSSFCell: representation of a cell in a row of a spreadsheet, we use to manage the contents of the cell.

Adding de library Apache Poi Java API

After all we need to download the Apache Poi Java API, then we add it to our project, I’m going to explain how to do it in the IDE I’m using for this example: Netbeans, in other IDEs this will be similar.
Continue reading Java read excel with Apache Poi Java API

Netbeans add library Apache Poi Java API

We are going to add the library Apache POI – the Java API for Microsoft Documents, that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.
 

Netbeans add library Apache Poi Java API

Continue reading Netbeans add library Apache Poi Java API

Java read files of a directory – Java I/O


IN TRANSLATION PROCESS it will be available as soon as posible.


Vamos a seguir descubriendo métodos básicos de Java I/O, en este caso crearemos un método para explicar como leer todos los ficheros del directorio que se indique en Java, creamos un paquete org.xulescode.javaio para nuestra clase que llamaremos JavaIOUtils, clase que estoy utilizando en las explicaciones de nuevas funcionalidades de Java I/O, aquí iremos añadiendo para darles utilizad en futuros ejemplos.

Java leer ficheros

Usamos la clase java.io.File que nos proporciona una representación abstracta de un fichero o directorio, con métodos para el manejo de ficheros y directorios.Código Xules

 
Creamos el método public boolean readFolderFiles(String folder) donde implementamos la funcionalidad de Java leer ficheros, usando:

  • Usamos el paquete java.io: donde se encuentran la mayor parte de las clases para el manejo de archivos
  • Usamos java.io.File: representación abstracta de un fichero o el nombre de una ruta, aquí encontraremos los métodos para saber si existe el directorio que nos pasan en la ruta, y también, un método para leer los ficheros del directorio.

Continue reading Java read files of a directory – Java I/O