Saturday, 29 May 2010

Oracle Sun JDK vs OpenJDK

These days Ubuntu comes with Open JDK installed as standard. Many Java programmers replace this immediately with the Oracle Sun JDK.

So what's the difference? Well, the OpenJDK is a 100% open-source implementation of the Java language specification. The Oracle Sun JDK is largely open-source but still contains some precompiled binaries that Sun didn't have copyright to release under an open-source license.

You can read more here:

Oracle - Free and Open Source Java

I've always tended to replace the OpenJDK with Sun Java, but since installing Ubuntu 10.04 Lucid Lynx, I've been seeing how I get on with the OpenJDK. To date, developing straightforward Java, JSP and servlets with Spring, Struts2, Hibernate and Maven deployed on Tomcat, has worked perfectly well. I've also been using the IcedTea plugin in Firefox with no issues.

But yesterday, I hit my first snag. If you read my previous post you'll know that I've been looking into the new annotations in the Servlet 3.0 specification: @WebServlet, @WebFilter and @WebListener. To get examples to run I had to install Glassfish v3. All was well until I tried to run the Admin Console and I got this error:

java.lang.UnsupportedOperationException: Cannot create XMLStreamReader or XMLEventReader from a
javax.xml.transform.stream.StreamSource
        at com.sun.xml.internal.stream.XMLInputFactoryImpl.jaxpSourcetoXMLInputSource(XMLInputFactoryImpl.java:283)
        at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:143)
        at org.jvnet.hk2.config.ConfigParser.parse(ConfigParser.java:109)
        at org.jvnet.hk2.config.ConfigParser.parse(ConfigParser.java:104)
        at org.jvnet.hk2.config.ConfigParser.parse(ConfigParser.java:100)
        at org.glassfish.admingui.plugin.ConsolePluginService.init(ConsolePluginService.java:121)
        at org.glassfish.admingui.plugin.ConsolePluginService.getIntegrationPoints(ConsolePluginService.java:423)
        at org.glassfish.admingui.common.handlers.PluginHandlers.getIntegrationPoints(PluginHandlers.java:160)
        at org.glassfish.admingui.handlers.ThemeHandlers.getThemeFromIntegrationPoints(ThemeHandlers.java:98)
        ... 47 more

That didn't worry me too much at the time, but I was also getting some odd behaviour with Java Server Faces (JSF) applications that I hadn't seen on Tomcat. Most of the time I'm able to switch freely between one and the other with web applications.

So, based on a forum post about the problems with the Glassfish admin console, I installed all the Sun Java 6 components. My problems with the admin console disappeared and my JSF application started behaving normally again. So, on that basis, there seem to be glitches with JSF using the current version of the OpenJDK. The Glassfish admin console is based on JSF.

If you need to replace your OpenJDK installation on Ubuntu 10.04, these are the steps:

  1. Enable the partner repositories: System -> Administration -> Software Sources and check the box for http://archive.canonical.com/ubuntu lucid partner in the Other Sources tab. You might also want the sources checked too.
  2. Install the Sun Java6 packages: sun-java6-jdk, sun-java6-jre, sun-java6-source, sun-java6-fonts, sun-java6-bin and possibly sun-java6-plugin.

You'll then need to switch your default Java to the Oracle Sun version:

$ sudo update-java-alternatives -v -s java-6-sun

Do also check that you haven't hard-coded OpenJDK into any JAVA_HOME variables or application settings.

48 comments:

Anonymous said...

Hi - thanks a lot.. That helped me with my glassfish/openjdk problem :-)

Anonymous said...

Hi
Thanks very much for this.
As a Linux newb and an experienced (tho self-taught) java programmer, can I ask you to just clarify sthg:
- your command "update-java-alternatives" means I have switched to the Sun java JRE, right?
- but is it not the javac binary belonging to the Sun JDK which I need to specify when compiling code? Presumably there are two such files, one belonging to OpenJDK, the other to Sun JDK...?
- so how does the system know which one to use (and where are they kept, by the way)?

Hope you can find time to answer: my email is cscupost@hotmail.com.

Richard Senior said...

If you run "which javac", you will see that the javac in your path is a symbolic link to /etc/alternatives/javac. This is the Java compiler that you will run when you compile code.

When you run update-java-alternatives -s java-6-sun, it creates symbolic links for each component in /etc/alternatives. If you look at /etc/alternatives/javac, you will find it points to /usr/lib/jvm/java-6-sun/bin/javac, which in turn is a symbolic link to the latest Sun JDK at /usr/lib/jvm/java-6-sun-1.6.0.22.

Run update-java-alternatives for the OpenJDK implementation and symbolic links will be created to the binaries under /usr/lib/jvm/java-6-openjdk.

The update-java-alternatives command uses metadata files for each Java implementation. You can find them in /usr/lib/jvm/.*.jinfo on Ubuntu. These files specify locations of various components provided by the implementation, e.g. javac, and are used to create appropriate symbolic links for javac, java, jar, javadoc and other utilities.

For more information:

$ man update-java-alternatives

It's not "my" command by the way. I believe it's Ubuntu, originating in Debian.

If you are in doubt as to which versions are actually active after all these layers of symbolic links:

$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

That's the Oracle (Sun) virtual machine, as opposed to the Open JDK:

$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.1) (6b20-1.9.1-1ubuntu3)
OpenJDK 64-Bit Server VM (build 17.0-b16, mixed mode)

gowsalya said...

I wish to show thanks to you just for bailing me out of this particular trouble.As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.
Digital Marketing Training in Chennai

Digital Marketing Training in Bangalore
Digital Marketing Training in Pune

Mouni yoga said...

Well somehow I got to read lots of articles on your blog. It’s amazing how interesting it is for me to visit you very often.
Click here:
python training in Bangalore
Click here:
python training in Bangalore

ragul ragul said...

Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing....
Blueprism online training

Blue Prism Training in Pune

Blueprism training in tambaram

geetha sridhar said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.

Data Science Training in Chennai
Data science training in bangalore
Data science online training
Data science training in pune

hansika hans said...

After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience. Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in
java training in jayanagar | java training in electronic city

java training in chennai | java training in USA

Anonymous said...

I really like your blog. You make it interesting to read and entertaining at the same time. I cant wait to read more from you.
angularjs Training in bangalore

angularjs Training in btm

angularjs Training in electronic-city

angularjs online Training

angularjs Training in marathahalli

sai said...

Thanks for your informative article, Your post helped me to understand the future and career prospects & Keep on updating your blog with such awesome article.
python course in btm | python Course in marathahalli| python training institute in jayanagar

ram ramky said...

Great website and content of your website is really awesome.
Selenium Training in Chennai
Selenium Course in Chennai
iOS Course in Chennai
Digital Marketing Training in Chennai
J2EE Training in Chennai
DOT NET Course in Chennai
DOT NET Training Institute in Chennai

sathyaramesh said...

I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
SEO Training near me
SEO Training in Chennai
SEO Training
Digital Marketing Chennai
Digital Marketing Courses in Chennai
Digital marketing courses

Riya Raj said...

The blog which you are posted is innovative…. thanks for the sharing…
Digital Marketing Course in Chennai
Digital Marketing Training in Chennai
Digital Marketing Training in Coimbatore
Digital Marketing Courses in Bangalore

pooja said...

Awesome! Education is the extreme motivation that open the new doors of data and material. So we always need to study around the things and the new part of educations with that we are not mindful.
Java training in Chennai

Java training in Bangalore

Ramya Krishnan said...

This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points. To appreciate this I like to share some useful information regarding Microsoft Azure which is latest and newest,

Regards,
Ramya

Azure Training in Chennai
Azure Training Center in Chennai
Best Azure Training in Chennai
Azure Devops Training in Chenna
Azure Training Institute in Chennai
Azure Training in Chennai OMR
Azure Training in Chennai Velachery
Azure Online Training
Azure Training in Chennai Credo Systemz

priya said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Microsoft Azure online training
Selenium online training
Java online training
Java Script online training
Share Point online training

sasitamil said...

Thanks for such a great article here. I was searching for something like this for quite a long time and at last I’ve found it on your blog. It was definitely interesting for me to read  about their market situation nowadays.
devops online training

aws online training

data science with python online training

data science online training

rpa online training

Aman CSE said...

One of the best content i have found on internet for Data Science training in Chennai .Every point for Data Science training in Chennai is explained in so detail,So its very easy to catch the content for Data Science training in Chennai .keep sharing more contents for Trending Technologies and also updating this content for Data Science and keep helping others.
Cheers !
Thanks and regards ,
Data Science course in Velachery
Data Scientists course in chennai
Best Data Science course in chennai
Top data science institute in chennai

anusha said...




Full Stack Development Training in Chennai Searching for Full Stack Development training in chennai ? Bita Academy is the No 1 Training Institute in Chennai. Call for more details.

VRITPROFESSIONALS said...

Nice post. Thanks for sharing! I want people to know just how good this information is in your article. It’s interesting content and Great work.
Thanks & Regards,
VRIT Professionals,
No.1 Leading Web Designing Training Institute In Chennai.

And also those who are looking for
Web Designing Training Institute in Chennai
SEO Training Institute in Chennai
Photoshop Training Institute in Chennai
PHP & Mysql Training Institute in Chennai
Android Training Institute in Chennai

digital tucr said...

You might comment on the order system of the blog. You should chat it's splendid. Your blog audit would swell up your visitors. I was very pleased to find this site.I wanted to thank you for this great read!!
digital marketing course
www.excelr.com/digital-marketing-training

Priyanka said...

Attend the Best Python training Courses in Bangalore From ExcelR. Practical PythonTraining Sessions with Assured Placement From Excelr Solutions.

python training in bangalore

Priyanka said...

Attend the Best Python training Courses in Bangalore From ExcelR. Practical PythonTraining Sessions with Assured Placement From Excelr Solutions.

python training in bangalore

Aaditya said...

Excellent Blog! I would like to thank for the efforts you have made in writing this great article. Thanks for sharing.


ExcelR Data Science

zaintech99 said...

I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article.
ExcelR Data science courses in Bangalore

istiaq ahmed said...

The material and aggregation is excellent and telltale as comfortably.
Data Science Course in Pune

malaysiaexcelr01 said...




Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!





data science course malaysia

data science analytics rakshi said...

I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!data science course in dubai

janitha said...

Thanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post.
data analytics course malaysia

Priyanka said...

Attend The Digital Marketing courses in bangalore From ExcelR. Practical Digital Marketing courses in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Digital Marketing courses in bangalore.
Digital Marketing Courses in Bangalore

lucy88 said...

Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good.
I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!
Data Science Courses

technewworld said...

This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this,I love it thanks fo sharing.

Data anlytic said...

Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us
You will get an introduction to the Python programming language and understand the importance of it. How to download and work with Python along with all the basics of Anaconda will be taught. You will also get a clear idea of downloading the various Python libraries and how to use them.
Topics
About ExcelR Solutions and Innodatatics
Do's and Don’ts as a participant
Introduction to Python
Installation of Anaconda Python
Difference between Python2 and Python3
Python Environment
Operators
Identifiers
Exception Handling (Error Handling)
Excelr Solutions

Unknown said...

After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.
data science course malaysia

technewworld said...

Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!.
technewworld.in.

Anonymous said...

Impressive!Thanks for the post
One Machine Learning
One data science

technewworld said...

Amazing post, thanks for sharing this article. I am truly motivated by you for blogging.
Thank You.
One data science
One Machine Learning

Unknown said...

data science course singapore is the best data science course

Data anlytic said...

I love your article so much. Good job
ExcelR is a global leader delivering a wide gamut of management and technical training over 40 countries. We are a trusted training delivery partner of 350+ corporate clients and universities across the globe with 28,000+ professionals trained across various courses. With over 20 Franchise partners all over the world, ExcelR helps individuals and organisations by providing courses based on practical knowledge and theoretical concepts.

Excelr Solutions

pakistan news said...

Sehar News is a wide area that envelops pakistan news , kashmir news , International News, Sports News, Arts and
Entertainment News, Science and Technology, Business News, latest news in urdu , Education News and today news Columns.
The perusers can snatch most recent urdu news dependent on different political and get-together
occurring in the nation. Sehar News covers the most recent and up and coming news features, Read today urdu news and top stories from different backgrounds and carries it to the viewers



wanna know latest pakistan news ? click pakistan news and know more.

Read latest news in urdu and know more .

read all the latest urdu news in this site.

you dont know ? about today news click here and know more.

know the current news of kashmir news check here.

read all about today urdu news and gain knowledge.

Destiny Solutions LLP said...

Quickbooks Accounting Software

Arslan Bhatti said...

ExcelR is a proud partner of University Malaysia Sarawak (UNIMAS), Malaysia's 1st public University and ranked 8th top university in Malaysia and ranked among top 200th in Asian University Rankings 2017 by QS World University Rankings. Participants will be awarded Data Science Acadmy International Certification from UNIMAS after successfully clearing the online examination. Participants who complete the assignments and projects will get the eligibility to take the online exam. Thorough preparation is required by the participants to crack the exam. ExcelR's faculty will do the necessary handholding. Mock papers and practice tests will be provided to the eligible participants which help them to successfully clear the examination.

ExcelR Solutions said...

Here Artificial Intelligence Course advice that performd by human and thought as requiring the ability to learn, reasons and solve problems, can now be done by machine.

Mudasir anwar said...

Really very happy to say,your post is very Awesome to read.I never stop myself to say something about it.You’re doing a Great job.keep it up
www.bexteranutrition.com
www.digital marketingfront.com
designing info.in
www.https://www.hindimei.net

Mudasir anwar said...

Really very happy to say,your post is very Awesome to read.I never stop myself to say something about it.You’re doing a Great job.keep it up
www.bexteranutrition.com
www.digital marketingfront.com
designing info.in
www.https://www.hindimei.net

Epic Deal Shop said...

Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man,Keep it up.Epic Deal Shop

pakistan news said...

Established in 2016 SSDWebHosting.net is providing top quality domain and hosting services worldwide to
our valued customers and trying to play a little role in their success.We offer about 500 distinctive gTlds and ccTlds
to look over which includes old master class gTlds like .com, .net and .org, in addition this we also offer newly launched Tlds
like .xyz, .online, .master, .office, .on, .top and .club. We can assist you with choosing the best fitting name. Let's bring your
thought or business on the web. visit this site https://SSDWebHosting.net/ to know more.


Do you wanna buy SSD Web Hosting visit here.
Find best Cheap Web Hosting here.

pakistan news said...

punaise des lits sont l'un des problèmes les plus difficiles à éliminer rapidement.
La meilleure solution, de loin, pour lutter contre punaise des lits est d'engager une société de lutte antiparasitaire.
ayant de l'expérience dans la lutte contre punaise des lits . Malheureusement, cela peut être coûteux et coûteux.
au-delà des moyens de beaucoup de gens. Si vous pensez que vous n'avez pas les moyens d'engager un professionnel
et que vous voulez essayer de contrôler traitement des punaises de lit vous-même, il y a des choses que vous pouvez faire. Avec diligence
et de patience et un peu de travail, vous avez une chance de vous débarrasser de punaises de lit paris dans votre maison.


Vous voulez supprimer punaise des lits de votre maison ?
se débarrasser de punaises de lit paris cocher ici
nous faisons traitement des punaises de lit de façon très professionnelle.

Followers