Archive for the ‘Java’ Category
BCIT – Advanced Java Development associate certificate program review
“I think Microsoft named .Net so it wouldn’t show up in a Unix directory listing.”
(Oktal)
Here comes a short review of ‘Advanced Java Development associate certificate program, that I was studying part-time in 2007/8 academic year. Website of program can be found here. Program is aimed at programmer with previous programming experience, who wants to enhance his/her skills with Java language and Java platform.
In overall, this program has very high real-world value and it helped me to broaden my scope on Java platform. Also it teaches a lot about software development in general. It took me one academic year to finish all subjects and I must say that majority of subjects was pretty awesome stuff and I learned a lot. Here are – in my opinion – the most valuable subjects, sorted in a list:
- Java Databases – this is so far the most interesting subject in whole program. In most situations, database layer is the most important one and in this subject, despite the fact that it was only few hours, we learned how to use JDBC features properly and we have been given also the basics of ORM with help of Hibernate framework. I took it with Arash Ghavami and I can only recommend.
- Intermediate/Advanced Java – these two consequent subjects have great value hidden inside. They are meant to be preparation for Java Programmer Certificate from Sun, well, they will not exactly prepare you for this exam to be honest. But still, there is a LOT of stuff about core Java principles and many useful things are introduced here. Also it’s always an experience to have class with Paul Mills, he really knows how to explain stuff.
- Java User Interfaces – Swing, swing and more swing. What is here to say? Sam Cirka introduced not only swing basics to us, he was talking a lot about underlying principles of swing. Really good subject to take if you are interested in Java UI.
These are the highlights that come to my mind at first. Of course there is a lot more stuff going on in this program, but these 4 subjects I enjoyed most.
Intellij IDEA after install tips
I worked with IDEA on OpenSUSE 10.3 linux distribution, but most of the mentioned settings should be cross OS. I also found blog post by Hamlet D’Arcy over THERE. Hamlet describes his top 10 list for IDEA. Check it out too.
- Set proper VM setting for IDEA, according to your machine. You can find one useful and straightforward property file at %idea_install_dir%/bin/idea.vmoptions. I don’t remeber defaults, but I have 2 GB of ram so I set it like this:
-Xms64m
-Xmx768m
-XX:MaxPermSize=768m
-ea - Print-out keymap and stick it somewhere where you can see it. You can find it at IDEA welcome page. From the beginning, IDEA keymap seemed a little unconfortable to me, but after a while, I get used to it and now my writing – generating :> – speed is much faster than in eclipse. Early investment into keymap is totally worth it.
- IDEA has best plugin system I ever seen. Look into Amount of plugins isn’t as huge than eclipse repository, but it’s big enough. It’s worth to notice that most useful plugins are installed by default. Browse to File -> Settings -> Plugins. Most of the time there is no need to go to internet, complete plugin repository is here and can be installed on click. From optionals, those are quite good in my opinion:
- ‘Identifier Highlighter’ – if you are used to have variable usages highlighted (as in eclipse), this is it. Most of the people disagree and find it annoying, but I like it. It has many settings.
- SQL Query plugin – very nice universal SQL client built in to IDE. Contains DB browser and many features you could expect from others stand-alone SQL clients.
- use keyboard shortcuts! Main strength of IDEA is in high-quality editor, which is not perfect, but surely better than other two’s (eclipse, netbeans)
Sample Ant script for small projects
I don’t know yet how to put there ant code in a way that it will not conflict with wordpress tags, so build file is attached here:
build.xml
This script is assuming that you follow some basic conventions. You need to do only 2 things to adapt it to your project.
- change project name to your project name in 1st line of script
- set path to your main class in “mainClass” property.
Then you are ready to go. Assuming you have all your source files and resources in ’src’ folder and dependent libraries in ‘lib’ folder, script can generate .jar file (including libraries), javadoc and some stuff around those.
I was searching for something similar and universal to use in my small projects and I didn’t find anything like that, so I created it myself.
Deploy your Java application as one .jar file
At first, I wanted a tool that will pack everything into one simple .jar file and I can deploy my apps on web thrugh JWS more easily then. However, as far as I was playing with JWS vs. tools to pack app into one .jar, I found that this approach brings more problems than solutions. Whatever, tools I found for packing apps as one .jar are:
- JPackIt – best I found, but has serious issues with JWS, and JWS is generally only case in which I’m interested in deploying app as single JAR file.
- Fat Jar – is great, but drawback/advantage is that it is Eclipse plug-in. I just love Eclipse, but I need to do my work also on other IDEs, so I would had welcome separate utility for that. It seems Fat Jar is using One-JAR under its hood.
- Maven Assembly Plug-in – looks promising, however I had no time to get into Maven yet (shame on me). I have to try this one, this seems to be the right way to go.
- One-JAR – I found this one just recently and have not tried it yet. I will post my discoveries soon..
As usual, I encourage anyone who is better involved than me to share few links or hints.
Java Web Start under Linux
I couldn’t believe it, but the whole java web start and stuff around it is just messed up on Linux platform. First, I tried to develop simple Hello world application and it worked OK. Great, I said to myself, but when I wanted to force JWS into some serious cooperation with serious ‘Hello World 2′ application, I encountered many problems there.
First – JWS under Linux has really poor tools. I mean, yes, they work, but don’t expect such a comfort as you have on MS Windows platform. No detailed information about errors if they are any. JWS simply won’t run and when I want to have some feedback, I have to run my Windows XP box and run JWS app from there to find out what’s going on.
Second – Jar signing. When you want to do something serious, you will certainly want to sign your .jar files with your deployed application. So I bundled all my application’s .jar files and .jar libraries into one .jar archive (BTW. see JPackIt which does this and it does really good job, but unfortunately has issues with JWS…this is another story) and I wanted to sign this .jar. OK, let’s Google how to do that…
keytool -genkey -keystore mykeystore {create keystore}
jarsigner -keystore mykeystore mindtermfull.jar mykey {sign jar}
That’s nice and easy, however I encountered very wild errors on my Linux box and I’m still not able to fix them.
keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: MAC verification failed
If anybody has experience in signing .jars on Linux, please share you knowledge in comments. On MS Windows XP box, it went smoothly and now I have my .jar signed and can keep moving…
OS used: Debian Lenny and MS Windows XP EN Professional
JDK 6 with latest updates on both platforms
Part 2 – some good news
Niklas Mehner made some good points in comments to this post, that led me into right direction. I discovered that Java has more solid ground in Linux than I thought. First, JWS has many settings I didn’t know about and you can access it by simple command “javaws -viewer”. Second, I thought I’m using 1.6 sun jdk, but there was still GJC stuck in my system and that was why I encountered such errors. Now everything works like a charm and commands that I wrote before are working too.
Next time I will try to look at problems I encounter more deeply before blaming innocent pieces of SW in blog posts …
Vancouver’s first eclipse demo camp
I attended first eclipse demo camp in downtown Vancouver. Great experience, friendly and open people including presenters and organizators. Everything went smoothly and in well organized manner. There are some highlights that actualy woke me up (in order of my personal interest):
- Tasktop – Bright example of how much power Mylyn brought to eclipse. Very ambitious project that could be one day my personal manager. Integration of web browser and file manager and lots of stuff around made good impression on me. I personaly still can’t imagine to give up firefox and Krusader file manager, but who knows :>. Make sure you don’t miss that one.
- Embedded CAL – Embedded functional language inside java source code? That’s not bad idea at all. Check out their web site and you will be surprised how far did they push it!
- Fishtail – Sure, guys from UBC are not sleeping at all. Eclipse plugin that is expert in finding “how-to” type of information about source code stuff. Nice
- Nomad PIM – Eclipse RCP based personal information manager. From website of author: “It allows you to keep track of your personal data and currently provides modules for notes, schedule, contacts, money, diary and timetracking.” Seems very promising too. I like it.
Here you can find official page of this demo camp with details: wiki.eclipse.org/Vancouver_DemoCamp
There was also a social event after presentation which was very nice and there was a lot of room for discussion about anything between people from various industries and professions. Any comments about my spelling are welcome :>
