Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Sunday, July 29, 2012

Installing Oracle JDK 6 in Ubuntu 12.04

My Ubuntu customization continues this time with Java. Everyone should know that Ubuntu does not come with Oracle-Sun JDK anymore instead it comes with open-jdk which I like but the projects I am working on does need Oracle-Sun jdk and version 5 or 6 so I did not have an option to install it.

You can download the version you want for the architecture you need from Oracles web site. by the time of this post the version I used was jdk-6u33 but it should apply to any version.

JDK Download
The next step is to unpack the bin file. You do it by executing these 2 lines:
chmod +x jdk-6u33-linux-i586.bin
./jdk-6u33-linux-i586.bin

You will see a jdk-6u33-linux-i586 folder as result of the last

Third step is to move the folder to a safe and standard place. To do that we use the next command
sudo mv jdk-6u33-linux-i586 /usr/lib/jvm/
Next we create a symbolic link, you know so you do not have to type jdk-6u33-linux-i586 all the time. We do that by typing
cd /usr/lib/jvm/
sudo ln -s  jdk-6u33-linux-i586 java
Finally, you need to set the environment variables. In my case update them since I already had openjdk installed but it will work either you have or not another version installed before. You need to do it for both java and javac
sudo update-alternatives --config javac
sudo update-alternatives --config java
Default jdk
You will need to choose the the option to the Oracle-Sun jdk you want and press enter.

To test this out you just type
java -version
javac -version

checking versions
and you should see the version you installed.

There is an easy way to this which is adding an extra repository. There are tons of PPAs that come with Oracle-SUN JDK these days, but as you know I like to have control of these things. The easy way is like this
sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java6-installer

More information and nice guides can be found here, here and here.

Let me know if you have any questions.

Happy coding!

Sunday, September 4, 2011

Prototyping vs Engineering

Whenever I have time I like to watch talks from people I admire and consider inspiring, you know Larry Page, Sergey Brin, Steve Jobs, Eric Schmidt, Linus Torvalds and well lots of them. This time I was watching a QA session with James Gosling a.k.a "The father of Java".  I started my university years with Java and since then, well has been my favorite programming language :)

Anyways, one of the questions he answered [1:08:25]was: "Common mistakes software developers make" he said  "Confusing Prototyping with Engineering tends to be a big one..", "A prototype is a learning experience you hit the delete button and then you re-write it..."

That answer hit me right away and I wished some people i know could watched it and specially this specific question. Sometimes you do not have control over your projects and that is frustrating because you know when something is wrong, something could be done better and that in the future if you do not do it right, it will cause lots of problems. And when you try to say it, nobody listens to you, believe me, it feels really really bad when you have to fix all the things you had predicted but no body wanted to listen to you.



You learn about these kind of mistakes the hard way and when you do it you do learn because of these huge mistakes is that projects fail or get delayed or even worse. The best thing though is next time hopefully you won't make the same mistake.


The very first time that happened to me was years ago and I thought we have learned about it, well at least i did, but it seems some people have not and that is just sad. I see one of those situations coming soon and I do not know what should I do. I guess it is not in my hands, isn't it?

The video is worth watching so If you have some spare time, watch it you won't regret it.

Friday, April 1, 2011

Getting Started with Spring Roo

Couple of weeks ago I started viewing some videos about GWT and App Engine to start developing the Web part of my project and while watching it I saw how Ben Alex showed Spring Roo for the very first time integrating it with GWT so I decided to give it a chance.

I downloaded the latest version and also their IDE Spring Suite Tools just to take a look. Usually I do not trust code generators because I do not know what they are doing and I like to have control over my code all the times that way is a lot better to maintain it. Either way I tested and I read some of its documentation.

My first impression was that it is good!!! it really takes care of all the code that could be easier to generate like Data persistence objects, Tests, Entities, and even web controllers. It took couple of minutes to create an entire application with data persistence, web interface and set of tests.

But not everything was good when I tried to generate the GWT interface it took a lot of time and only supports version 2.1 at the end I was able to create the application and then open it in their IDE and deploy to App Engine since the command line to do it with maven did not work, maybe a bug, maybe it was me but i did not have time to do more research so I took the easy path. The application is now in App Engine and works fine so my next step was to check the code and see how Spring Roo generates it.

This was the hard part besides the tool classes and files there were a lot!!! of files that I couldn't understand. It  seems that integration with GWT is still buggy although the normal generation using JSP was pretty good.

The project is open source and very active and I am sure they will improve I am seeing a good future I will keep using for the obvious things but not yet for UI.

Here a nice video where Ben shows the capabilities of Roo enjoy it! and here is the Google IO presentation


happy coding :)

Friday, November 16, 2007

The Magnificent 7

Hola a todos,

Intellij IDEAJusto hoy me entero que los amigos de JetBrains sacaron la nueva versión de IntelliJ IDEA. Francamente es para mi uno de los mejores IDE's para Java (Gracias Jerome por presentármelo :) ) no por nada gano varios premios. Ya se, ya se, se que dirán que es pago y porque no mejor usar Eclipse o algún otro IDE libre, sera de pago pero es muy bueno y los desarrolladores son muy buenas gentes, hace tiempo les escribí diciéndoles que me encantaba su producto pero que lamentablemente no podía pagarlo y ellos me respondieron dandome una licencia de estudiante por un año con toda la funcionalidad! (gracias otra ves Jerome)100pre hay formas de evitar la pirateria :) . Hasta ahora sigo usando esa licencia, creo que se olvidaron quitarla pero sigue funcionando, algún día les daré las gracias :)

Bueno viendo algunas de las nuevas cosas tiene y me llamo mucho la atención las siguientes:
  • More advanced support for JavaScript (with basic Flex)
  • Spring & Hibernate Integration
  • Eclipse & Maven Interoperability
  • Performance improvements
Apenas termine de descargar probare cada una de ellas :). Quiero ver si realmente mejoraron el performance, pero si comparan la versión 6 era = de pesada que un Eclipse.

Para ver la lista completa pueden seguir este link.

Uds que IDE's para java usan?

 salu2.

Tuesday, February 27, 2007

Some Desktop Features in Java SE 6

Hola a todos,
Esta vez quería hablarles del nuevo y recien lanzado JDK 6 más que todo de algunas nuevas mejoras que tiene en cuanto a interfaz se refiere. Realmente mejoraron bastente esta parte en este nuevo release. pero sin mas empecemos.
Splash Screens 
Para los que no son familiares con este término, los Splash Screens son pantallas/imagenes que aparecen al momento de lanzar una aplicación y su objetivo es estar ahí mientras el programa se va cargando, lo que hacen es hacer un feedback de lo que esta pasando, algunos programas o aplicaciones tardan en cargar entonces se usan estos Splash Screens para mostrarle al usuario que la aplicación esta cargando. A mi parecer se han vuelto como un standard en las nuevas interfaces de usuario. En fin ahora Java SE 6 provee esta funcionalidad pero de forma mucho mas mejorada, ahora se puede lanzar Splash Screen mucho mas antes incluso antes de que la VM empiece, puede cargar una imagen (gif) en una ventana simple sin nada de decoración. Hay dos formas de probarlo rápidamente la primera es escribiendo lo siguiente en la línea de comandos:
 java -splash:filename.gif SplashTest  
ojo que la imagen debe estar en el mismo path donde lo ejecutan o tb le pueden dar el pathde de la imagen. Esta forma es la mas sencilla de probar esta nueva funcionalidad.
la otra forma es usandola en nuestro archivo jar que lanza nuestra aplicación para esto debemos modificar elmanifest  , lo que se hace es poner el siguiente código en el archivo manifest.mf
  Manifest-Version: 1.0
     Main-Class: SplashTest
     SplashScreen-Image: filename.gif
 Ojo que en esta opción hay que poner la imagen dentro del JAR y darle el path.
Esta para mi es una gran mejora porque antes para poder hacer esto se podia usar Swing o AWT pero tardaba un montón porque primero tenía que cargar la VM, algunas dependencias, en resumen tardaba en aparecer. 
Lo bueno de esto es que tb se puede hacer varias funciones con Splash Screen (cambiar imagen, cerrarla, posición imagen, etc ) desde código usando la clase java.awt.SplashScreen
System Tray 
Esta nueva función es la que mas me gusta personalmente. Java SE 6 nos da al fin la posibilidad de acceder al system tray de windows y/o linux gracias a las clases SystemTray and TrayIcon  ambas en java.awt.
 
 
en las imágenes podemos ver ejemplos en windows y en Gnome. A mi parecer esto es bastante útil. El método estático SystemTray.isSupported() nos devuelve true si es que el system tray es soportado por el SO donde ejecutamos el código y false de no serlo. Yo creo que vale la pena probarlo más, ya que tb soporta el poner menús contextuales, íconos, esta bueno.
Grey Rect Arreglado
Este problema de interfaz lo podíamos ver cuando nuestra aplicación estaba dejabo de otra, cambiamos de ventana para regresar a la nuestra y veíamos como se refrescaba toda nuestra aplicación dejando una ventana ploma por algunos segundos hasta que termine el refrescado. Esto me ocurrió en interfaces Swing y yo creo que a todos. Al fin el equipo de Swing pudo corregir este problema en esta imagen podemos ver una comparativa entre las diferentes versiones:
 Increible como redujeron los tiempos no?
Otros detalles 
En fin para resumir un poco porqueno quiero aburrirlos, hicieron tb otras mejoras respecto al despliegue de texto en LCD's que usan subpixel para mejorar la resolución del texto ahora ya viene soportado en esta nueva versión sin importar que look and feel utilices en tus programas, aún lo probe pero apenas tenga tiempo lo hago :)
Otra cosa que ví y me intereso mucho es que viene con soporte para look and feel nativo, por ejemplo en JDK 5 traía soporte para poder utilizar los themes que venían en XP pero en vista microsooft cambio estos recursos y ya no son disponibles, clásico de ellos. En fin para resolver esto usaron un API llamando UxTheme que fue hecho por Windows Blinds, en teoria cualquiera puede utilizar este API para extenderlo y lo que se desee, bueno lo probaron en Windows Vista y funcionó perfectamente. Esto si que habría que probarlo el problema es que no hay windows vista para probar en casa :( 
Bueno esto ya se hizo muy largo en otro post hablare un poco sobre las mejores en tablas , ventanas, el nuevo Desktop API y algunas otras cosillas, para los que quieran ver mas sobre estas mejoras les recomiendo leer esteartículo  donde todo esta mucho mas explicado y con varios ejemplos y lecturas recomendadas.
salu2. 

Monday, February 12, 2007

OOP is dead

Hola a todos,

 Este artículo compuesto por parte 1, parte 2, y parte 3 me pareció bastante interestante, algo extenso pero intresante. El autor se basa en varios ejemplos y algunos eventos que han pasado para consolidar su opinión de que los lenguajes orientados a objetos estan perdiendo su escencia y muriendo, esto debido a que varios de estos como java y C# estan añadiendo cada vez mas funcionalidades o mejor dicho facilidades a los programadores que son características de lenguajes funcionales para ser mas exactos. Esto podemos ver en los reviews de las siguientes versiones de java 7 y C# 3 donde los delegates quedan obsoletos y la aparición de los extension methods. Incluso en un post de Alexey nos habla algo de esto y tb Pablo aquí.

En cierta forma es verdad, cada vez las evoluciones de los lenguajes OO nos llevan a usar paradigmas distintos a este.

En otras opiniones dicen que OO no esta muerto que si no que esta madurando.

Ustedes que piensan al respecto, será que los lenguajes OO estan perdiendo su escencia? Son realmente tantas la limitaciones del paradigma OO que llevan a estos lenguajes a buscar las soluciones en otros paradigmas?, Si me preguntan a mí aún no tengo una respuesta clara a estas preguntas Ustedes?.

saludos.