BKhttp://www.bartkummel.net
Professional website of Bart KummelThu, 03 Jan 2019 20:13:50 +0000enhourly1https://wordpress.org/?v=4.9.931079671Spring boothttp://www.bartkummel.net/2015/02/spring-boot/
http://www.bartkummel.net/2015/02/spring-boot/#respondMon, 02 Feb 2015 07:51:56 +0000http://www.bartkummel.net/?p=251Read more Spring boot]]>Recently, I joined a project that was already going for some time. They had chosen to use Spring Boot to deliver the project as an executable WAR. I hadn’t used Spring Boot before, but I instantly liked the idea of having the Application Server as a dependency, instead of deploying to it. It’s a bit like the way things work in the Node.js ecosystem.

Very short introduction of Spring Boot

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that can you can “just run”. We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.

Before we dive into it, I want to place a side note about Spring Boot being an opinionated framework. I think being opinionated can be a real strength, but it is also a warning to users of the framework: you shouldn’t use it if your opinion is too far off of the opinion of the Spring Boot team. The power of Spring Boot lays for a large part in their sensible defaults; but what’s the use of those if you disagree with most of them. In that case, you’ll end up losing time while overriding all those defaults.

Executable JAR’s and WAR’s

One of the main features of Spring Boot is the ability to create executable JAR’s and WAR’s. I remember creating a hand rolled executable JAR years ago, for some command line tool I built for a client. It was not difficult, but it required some boiler plate and was a bit cumbersome. Spring Boot can save you this boilerplate, but it can also create executable WAR‘s, that include an embedded application server. And that’s really powerful!

In the project I’m working on, we’re creating a synchronization server that does its job mainly in the background, but has a minimal web interface to do some manual tasks. It was decided to keep it simple and use plain old JSP’s for the web pages, of course combined with Spring MVC. We had a bit of a challenge, because the JSP’s were not rendering in our executable WAR. But with the help of Google and Stackoverflow.com, I found a fairly simple solution. It turns out Spring Boot uses a minimalistic version of Embedded Tomcat, that doesn’t include Tomcat’s JSP rendering engine, Jasper. The fix is to add Jasper as an extra dependency in the project’s POM, like this:

With both fragments added to our project’s POM, the JSP’s were rendering fine in the embedded Tomcat.

How it is done

It is important to know how Spring Boot creates the executable WAR’s and JAR’s. It does this by plugging into the build process. If you use Maven, like we do in our project, Spring Boot uses a Maven plugin that plugs in at the end of the build process, in the package phase. After Maven finishes creating the JAR of WAR, the Spring Boot plugin takes that JAR/WAR and changes it to make it executable. That way, it is ensured that the normal build process is not changed. To enable this plugin, it has to be added to the plugins-section of the POM, as stated in the Spring Boot docs:

It is important to have the executions-section, otherwise the plugin won’t be activated in the right life-cycle phase. With this in place, a simple mvn clean install will get you an executable WAR or JAR! Another important thing is to have Maven build a proper WAR first. As stated, Spring Boot does its magic after Maven has created the WAR. So if you don’t tell Maven to build a WAR, but e.g. a JAR, you will get an executable JAR, but the web app won’t work, since essential WAR-specific parts are missing. So make sure the Maven WAR-plugin is also listed in the plugins-section:

Wrapping up

So far for my very short introduction to Spring Boot and some lessons learned, based on my first acquaintance with Spring Boot. I hope you enjoyed it. Please leave a comment if anything is unclear or if you want to discuss.

]]>http://www.bartkummel.net/2015/02/spring-boot/feed/0251Devoxx 2013: Functional programming becoming mainstreamhttp://www.bartkummel.net/2013/11/devoxx-2013-functional-programming-becoming-mainstream/
http://www.bartkummel.net/2013/11/devoxx-2013-functional-programming-becoming-mainstream/#respondSat, 16 Nov 2013 14:09:07 +0000http://www.bartkummel.net/?p=236Read more Devoxx 2013: Functional programming becoming mainstream]]>I was at the Devoxx-conference last week and the main conclusion for me is that functional programming is finally becoming mainstream. One of the main reasons for this is obviously Oracle finally (and long overdue) delivering project Lambda (JSR 335) in Java 8 next spring. Venkat Subramaniam of Agile Developer did an excellent, inspiring talk full of jokes on the use of Lambdas in Java.

Groovy is groovy

But other languages are contributing as well to the rising popularity of functional programming. The most popular alternative JVM-language, Groovy, still seems to become more popular. I saw some excellent talks about the grooviness of Groovy (by Guillaume Laforge), about Goovy-based test-frameworks Spock and Geb (by Luke Daley and Peter Niederwieser) and a ‘quicky’ about Functional Groovy by Andres Almiray. The increasing use of Groovy-based build automation tool Gradle is also striking. I didn’t count, but it got mentioned in several talks on very different subjects. (Apart from some specific talks about Gradle, which I couldn’t attend, unfortunately.)

And then there’s of course Scala, the “OO meets functional” JVM-language. There were some excellent Scala-related talks at Devoxx, e.g. the “Coding in style” talk by Joshua Suereth. My take on it is that Scala is here to stay, but not for the mainstream. The language is just too difficult, I think.

Non-JVM-languages

There was also substantial attention for non-JVM languages this edition of Devoxx. There were many talks about JavaScript-based tools and frameworks, and ‘new kid on the block’ Dart got a lot of attention because of Google announcing its 1.0 release in their keynote on Thursday. Dart certainly shows a lot of potential, but the lack of native support in browser will be Dart’s weakest link for the years to come. I’m very curious what the competition of Dart and JavaScript will bring.

]]>http://www.bartkummel.net/2013/11/devoxx-2013-functional-programming-becoming-mainstream/feed/0236Weird shell script problem + solutionhttp://www.bartkummel.net/2012/04/weird-shell-script-problem-solution/
http://www.bartkummel.net/2012/04/weird-shell-script-problem-solution/#respondThu, 19 Apr 2012 17:06:08 +0000http://www.bartkummel.net/?p=210Read more Weird shell script problem + solution]]>Yesterday, I installed a fresh Java EE application server to run a test on an application I was working on. The installation of the application server was as simple as unzipping a distribution archive. As with most application servers, the server could be started by running a shell script from the command line. This was all familiar to me, as I already had another instance of the same server installed on my MacBook. However, when I tried to run the script, I got surprised by an error message:

-bash: ./run.sh: /bin/sh: bad interpreter: Operation not permitted

First thing I did was checking the permissions for the file:

ls -al

-rwxr-xr-x@ 1 bkummel staff 8107 22 mei 2009 run.sh

At first sight, there was nothing wrong. The file did have execute permissions. But when I compared the file with the one of the other server-instance, I noticed there was an extra @-sign right after the permissions. With the help from Google and two helpful colleagues, I found someinformation on the internet. It turns out the @-sign indicates that the file has extended attributes. Luckily, one of the articles also points to the xattr command, that can be used to read and manipulate the extended attributes. So, I continued by querying what extended attributes my file had:

Now I got a clue! This is probably the mechanism that normally causes those “Xyz is an application downloaded from the internet. Are you sure you want to open it?”-dialogs to appear. And apparently on the command line the effect is the error message printed before. So instead of just clicking the “open” button in the dialog, I had to find a way to remove this extended attribute. Luckily, that’s not too complicated:

xattr -d com.apple.quarantine run.sh

Now the attribute is deleted and the script runs without problems. So in case you ever encounter a mysteriously not running script, don’t forget to check for extended attributes!

]]>http://www.bartkummel.net/2012/04/weird-shell-script-problem-solution/feed/0210Developing Java Software on a Mac: version control clientshttp://www.bartkummel.net/2012/03/developing-java-software-on-a-mac-version-control-clients/
http://www.bartkummel.net/2012/03/developing-java-software-on-a-mac-version-control-clients/#respondMon, 05 Mar 2012 11:00:46 +0000http://www.bartkummel.net/?p=199Read more Developing Java Software on a Mac: version control clients]]>In previous installments of this series, I’ve covered text editing, file management, command line and copy & paste. This time, I will tell you my experiences with version control clients. Fortunately, there’s quite a selection of good clients available for the Mac. Of course, every VCS has a decent command line client for the Mac, but there are some polished graphical tools as well. The only thing that I haven’t found (yet), is a client that integrates with the Mac OS Finder, comparable to what the TortoiseSVN client does with Windows Explorer.

Which VCS to use?

Well, that question is clearly beyond the scope of this article. For this article, I assume you are working on a project and the VCS is already chosen. I’ll focus on clients for the three most widely used VCSs nowadays: Subversion (SVN), Git and Mercurial (Hg).

Command line or GUI?

Before diving into the different possibilities, it’s good to realize that using the command line is a serious option. Most VCSs do not offer GUI clients themselves, but they all do have a command line client. I think most developers aren’t afraid of the command line. A lot of things can be done very efficiently from a command line. This also goes for version management. However, my experience is that for larger projects, nothing beats a good graphical view on the revision history. And when it comes to comparing differences between revisions, I find a graphical diff tool much easier to use. So most of the times, I end up using both the command line and a graphical tool. (Sometimes I also use the embedded versioning support of my IDE, but I’ll leave that out of the equation for this article.)

Command line clients

There is not much to say about the command line clients, apart from where to get them:

Subversion: although it suffers from the rising popularity of distributed VCSs, a lot of existing projects are still using good old Subversion. The Apache Subversion project doesn’t provide any binary packages itself, but luckily Mac OS comes with the Subversion command line tools pre-installed. Should you want to install a specific version yourself, the SVNbinaries project on Collabnet seems to be a good resource.

Git: Github has an excellent guide to installing Git on a Mac. After completing the instructions, you will have a working Git command line client on your mac. This client also works good, provided you know which commands to use. As with the SVN command line, the Git command line lacks a visual overview. However, I found myself using the Github website as a partial replacement for that.

Mercurial: The Mercurial project provides binary packages for the Mac. I’ve never used it, since I haven’t yet worked on a project that uses Mercurial.

Graphical clients

As mentioned, I still did not find any tool that integrates version control capabilities into Mac OS Finder, as good old Tortoise does for Windows Explorer. However, some excellent stand alone clients make up for that miss.

Cornerstone

Cornerstone by Zennaware is an excellent Subversion client. One of my colleagues is a huge fan of it. He convinced me to try it, so I downloaded a 14-day trial version. I’m impressed. It’s a full-featured app that just works. And it looks gorgeous. However, there are free alternatives. So I couldn’t convince myself that I needed to pay for a client that only supports Subversion, while there are free clients that support Subversion, Git and Mercurial…

Sourcetree

Sourcetree is created by Atlassian, the company behind Jira, Confluence and many other collaboration tools. Sourcetree is a Git, Mercurial and Subversion client in one package. It has a nice Mac-like user interface, although the interface is not as polished as Cornerstone’s interface. Branches are displayed graphically, wich is very helpful. As Git and Mercurial client, Sourcetree does an excellent job. For Subversion, the experience is somewhat different, as Subversion is not supported directly, but only by using Git or Mercurial as “man in the middle”. That means to check out a Subversion repository, Sourcetree creates a local Git or Mercurial repository. (The choice is up to you.) This has the advantage of being able to work distributed even though Subversion itself is not a distributed VCS. A disadvantage is that, if you already have checked out a project, e.g. via the command line Subversion client, you won’t be able to open it in Sourcetree. However, I think we will see more and more Git and Mercurial and less Subversion in the years to come. So I think Atlassian made the right choice with their approach to Subversion support in Sourcetree. All in all, Sourcetree is a very competent VCS client. I think it’s awesome that there’s a free client that supports the three most important VCSs!

GitX

GitX is an open source Git client for Mac OS X. It has a nice and clean GUI and seems to work okay. The history view shows the branches is a similar graphical way as Sourcetree does. According to the GitX website, that graphical display is inspired on gitk, the history viewer provided by the git project itself. I didn’t use GitX for a long time, but it seems to do a good job.

Others

There are actually a lot more options if you are looking for a graphical VCS client on the Mac. I tried GitHub for Mac briefly, but I found the user interface to be less intuitive than the other tools I tried. There’s also Sprout, a commercial git client. I haven’t tried it. The screenshots look nice, but as said before, I don’t see a reason to buy a paid client when free alternatives seem to work fine too. There are also some good-looking, open source Mercurial clients I haven’t tried (yet): MacHg and Murky. When it comes to Subversion-only clients, there is also Versions, which competes with Cornerstone.

Conclusion

There are quite a few GUI VCS clients available for the Mac. It is interesting to see that for Subversion there are two competing commercial products, where for both Mercurial and Git there are several open source clients available. I found only one client that supports all three major VCSs. I like the fact that I don’t have to get used to three different user interfaces, so I’m sticking with Sourcetree for now. Do you have similar or different experiences? Did you find a Finder-integrated solution? Or do you think we don’t need that at all? Feel free to share your thoughts in the comments section below!

]]>http://www.bartkummel.net/2012/03/developing-java-software-on-a-mac-version-control-clients/feed/0199Which beans to use?http://www.bartkummel.net/2012/02/which-beans-to-use/
http://www.bartkummel.net/2012/02/which-beans-to-use/#respondTue, 21 Feb 2012 07:06:17 +0000http://www.bartkummel.net/?p=197Andy Gibson has a very good overview article on is blog that answers exactly this question. The article covers the three types of beans we can choose of in Java EE 6 nowadays and which ones to use when. Excellent article, a must read!
]]>http://www.bartkummel.net/2012/02/which-beans-to-use/feed/0197Interesting stuff in JSF 2.2http://www.bartkummel.net/2012/01/interesting-stuff-in-jsf-2-2/
http://www.bartkummel.net/2012/01/interesting-stuff-in-jsf-2-2/#respondWed, 25 Jan 2012 10:48:37 +0000http://www.bartkummel.net/?p=193Arjan Tijms wrote a nice article on what’s going on in the development of JavaServer Faces 2.2 (JSR 344). Pretty interesting stuff! I just hope we don’t have to wait for Java EE 7 to put those useful features into action…
]]>http://www.bartkummel.net/2012/01/interesting-stuff-in-jsf-2-2/feed/0193Site moved and updatedhttp://www.bartkummel.net/2012/01/site-moved-and-updated/
http://www.bartkummel.net/2012/01/site-moved-and-updated/#commentsWed, 11 Jan 2012 17:00:24 +0000http://www.bartkummel.net/?p=188Read more Site moved and updated]]>In an effort to consolidate our family’s websites to a single hosting provider and because I was not satisfied with my previous blog hosting, I have moved my blog to a new hosting facility. In the process, I’ve also done a redesign of the entire site. Read on to learn more about the technical details…

Previously, this blog was hosted on a SAAS-solution. I was not really satisfied, because the (proprietary) software was too limited, less easy to use than promised and there were no signs that it would improve soon. So I decided to go for a more common and more open solution, a self-hosted WordPress blog. The reason I went with the SAAS guys some years ago was I didn’t want to fiddle with manually uploading PHP-files, managing MySQL-databases and that sort of things. I found out that this is not needed anymore, even for self-hosted installations. My hosting provider (iXL hosting) offers a nice control panel (DirectAdmin) with a wizard (Installatron) to install and update software. So installing WordPress was just a matter of some mouse clicks and entering some names!

I also found out that WordPress (3.3) has become a very mature platform, for which a plethora of useful plugins is available. This is what I did to create my redesigned website:

Luckily, my old SAAS-blog-host had a WordPress-export module. So I could easily import my blog content using the WordPress Importer plugin.

I found the Pilcrow WordPress theme very nice, but I like sans-serif typefaces more than serifs, so I made some small changes to the CSS style sheet.

I didn’t like the default images of the theme, so I removed them and added some pictures of my own. I slightly adapted the theme functionality to automatically use all images found in a certain folder and add an optional description for each image.

Of course the old blog software created different URLs than WordPress does. Luckily, I found a wonderful plugin called Redirection, which made it possible to redirect the old URLs to the new locations, based on powerful regular expressions. The plugin also monitors 404 errors, which helped me find even more old URLs to redirect than the ones I’d figured out myself.

Being a blog about programming, I needed a solution for syntax highlighting code examples. I went for the Syntax Highlighter ComPress plugin. Simple and easy to use, with very nice results.

Sometimes I write multiple articles on the same topic. The Series plugin by Justin Tadlock offers a nice solution to group those articles together.

I tracked my old site via Google Analytics and I wanted to continue using that. I found quite a lot of WordPress plugins for Google Analytics and I chose Analyticator, which seems to work great. A side effect of continuing to use GA, is that the site statistics just continue, as if the site wasn’t moved. Nice!

One of the nice things is that I didn’t have to down- or upload any file in the process. All plugins can be installed easily from within the management console of WordPress. Kudos to the WordPress developers for creating such a mature and easy to use platform! All the work I put on the new site did take a while, and sometimes it does make me worry I may be working myself too hard, but I do try to strike a balance. I’m not always able to exercise but I watch my diet. One tip I can give you if you work with computers all the time like I do, is watch what you eat. If you don’t make sure you eat healthy your body goes right along with it, and so will do your output. I know there’s a lot of workaholics like me out there but a good reminder every once in a while can help us avoid letting slip our mind. I want to make sure I have my bases covered, so I also take a natural health supplement I order off of KratomMasters.com, and make sure to take it regularly. Maybe you’re working yourself harder than I am and don’t have time to cook or maybe go out for a quick walk or jog, if so try it yourself, it is leaps and bounds better than not doing anything, that’s for sure.

Let me know in the comments what you think of the new site and what your own experiences are with blogging solutions!

]]>http://www.bartkummel.net/2012/01/site-moved-and-updated/feed/2188JFall 2011http://www.bartkummel.net/2011/11/jfall-2011/
http://www.bartkummel.net/2011/11/jfall-2011/#respondThu, 03 Nov 2011 09:59:04 +0000http://localhost:8888/wordpress/?p=5JFall 2011. As expected, it was a very good conference again. I tried to tweet about some sessions I attended, but I had some weird problem with both of the Twitter-apps I have on my iPhone… So, instead I’ll give my take on those sessions here, in retrospect.
]]>Last Wednesday, I visited JFall 2011. As expected, it was a very good conference again. I tried to tweet about some sessions I attended, but I had some weird problem with both of the Twitter-apps I have on my iPhone… So, instead I’ll give my take on those sessions here, in retrospect.

Neo4J! What else?

This was one of the “early bird” sessions, taking place before the offical opening and keynote. Despite the early start, there were quite a lot of attendees. I think it was worth getting up early! Ron van Weverwijk did a good job introducing graph databases and Neo4J. Most of the time, I find sessions about NoSQL databases and the like very interesting, but often it is difficult to see any practical use in the near future. After all, most of us aren’t working on the next big thing in social networking. At least, I am not. Most of the time I am working for clients that already have a relational database and they just want a new front end for it.

The nice thing in this session was, that Ron told us about a project he did in exactly such a corporate environment where there was already a relational database. They didn’t change or remove that database. Only for the specific case where the graph database was offering an advantage, they exported the data they needed to the graph database. A clever and pragmatic approach. I hope I’ll find an apportunity to do something similar once…

Keynote by Tomas Nilsson

The Oracle-keynote was a little disappointing. Although Tomas is a fascinating storyteller, it was difficult to get a big picture from the collection of anecdotes he told us. If there was a big picture, I’d say it was that Oracle isn’t such a pleasant company to work for. And despite the fact that the company is run by lawyers and marketeers, we should trust them to be good for Java, since half of their revenue depends on Java. Well, I guess I will never trust any large corporation, but I think we as Java community have to admit that Oracle did a good job in getting the development of the Java platform back to speed again. So, let’s just hope Tomas was right on this…

JBoss Forge

Paul Bakker did a very interesting session about JBoss Forge, formerly known as Seam Forge. I had never heard of it before, but after this talk I’m certainly going to try it. JBoss Forge offers a CLI for creating and maintaining Maven POM files. With the JBoss Forge shell, one can rapidly setup a new project. This type of project setup is of course known from frameworks like Spring Roo, Ruby on Rails and the like. But the good thing about Forge is, that it can be used for any Java project, as long as you are able to build it with Maven. Paul put an emphasis on the fact that Forge not just creates pom-files, but also maintains them. (And it can also create and maintain other configuration files and even Java classes…) He also showed that it is relatively simple to create your own Forge plugin. All in all, this was a very good session, packed with demos. I really enjoyed it. I hope I will be still as impressed when I try Forge myself…

Introduction to JavaFX 2.0

A nice session by Michael Heinrichs. The downsides of this session were the lack of code demos and the fact that I didn’t learn anything new. But there was also one really cool aspect of this talk: Michael coded all his slides in JavaFX. And the slides were, of course, very fancy. Unfortunately his code was not clean enough to share, he told me afterwards. Nevertheless, it’s still a very cool idea!

Microsoft keynote on a Java conference…

The afternoon keynote was provided by Microsoft. I think it’s brave of them to show up at a Java conference. Of course, they were there to tell about their Azure platform and how it can be used to deploy Java apps in the cloud. I was not impressed. It turns out Azure is not much more than a bunch of managed virtual machines running Windows Server. In order to run a Java EE application on Azure, one has to tinker with Windows .cmd scripts to bootstrap an application server. And of course, the application server itself also has to be deployed. Although Microsoft calls it a PAAS, I think it’s actually not much more than a IAAS…

Migrating Spring to Java EE 6

Again a very good session by Paul Bakker. He showed a pragmatic way to migrate an existing Spring application to a standards-compliant Java EE 6 application. He was honest: his approach isn’t a silver bullet and it still takes a lot of time to migrate. But, as Paul put it: “Given an outdated application that needs to be migrated anyway, why not migrate it to the standard?” I think he’s totally right! And he showed us a doable migration path. Afterwards, I heard other attendees complaining that “he told us upfront that the talk wouldn’t be a shoot out, but is was.” I assume those people were mainly Spring-fans, having trouble saying goodbye to Spring. But let’s face it: we really don’t need Spring anymore, the good ideas from Spring are all incorporated in the Java EE 6 standard, most of them even in an improved form. Of course, we should be grateful to the guys from the Spring framework, and I think Paul gave them enough credits. But we have to move on!

Looking at Groovy 1.8

The last talk I attended was by Hubert Klein Ikkink. He had almost no slides, but instead showed us lots of cool new features of Groovy 1.8 with simple and illustrative demos. The talk also served as a nice (re-)intruduction to Groovy for people (like me) lacking any experience with the powerful alternative JVM-language. I don’t know if I’m going to use Groovy in the near future. But I hope for sure that Groovy can be for the Java language what Spring was for the Java EE platform.

]]>http://www.bartkummel.net/2011/11/jfall-2011/feed/052Developing Java software on a Mac: file managementhttp://www.bartkummel.net/2011/09/developing-java-software-on-a-mac-file-management/
http://www.bartkummel.net/2011/09/developing-java-software-on-a-mac-file-management/#respondMon, 05 Sep 2011 17:00:37 +0000http://localhost:8888/wordpress/?p=6For a developer, file management is an essential task. More than the average computer user, the location and name of a file matters to a developer. Often, (sets of) files have to be copied, either on the local machine or to or from a network share. Sometimes the command line is very fast and efficient for file management tasks. However, as directory structures get more complex, I prefer a visual file management tool, as it gives me a better overview of the structure.

Short after switching to the Mac, I was pretty satisfied with the default file manager on Mac OS: Finder. Finder is a pretty good file manager, at least it is better than the Windows Explorer. But, like Explorer, Finder needs some tweaking to make it more suitable for programmers:

Since changing file extensions is more common in programming, I disabled the “Show warning before changing the extension” option.

Then I set the list view as default view, via “View” > “Show View Options”, “Always open in list view”, “Use as Defaults”.

After applying these tweaks, I was pretty satisfied for a while. However, after using Finder for a longer period, I had collected some annoyances:

I too often found myself positioning two Finder-windows next to each other to be able to drag files from one location to another.

It sometimes confused me that directories were not listed at the top, as I was used to on other systems.

There’s no easy way to open a finder window without using the mouse, unless you remember to keep always one window open, so you can Command-Tab to it.

Then I stumbled upon TotalFinder, an add-on for the OS X Finder. It adds several very handy functions, which helped me to overcome my annoyances:

TotalFinder has a “dual mode”, which shows two adjacent views. Pretty much like the good old Norton Commander and its clones (Midnight Commander, …). No more aligning Finder windows before dragging and dropping files!

TotalFinder adds tabs to reduce the clutter. Although this is the most prominent feature, it is not as important to me as the dual mode and the other tweaks.

TotalFinder can show directories on top, just as I was used to.

The (optional) Visor mode can make TotalFinder to slide into view at the press of a shortcut key. Now I have the finder at my fingertips!

TotalFinder adds a pretty handy “copy path” menu to the context menu; especially time-saving if combined with the Terminal.

Long story short: File management on the Mac is a joy since I found TotalFinder! It keeps the good parts of Finder and adds some excellent features to make it more suitable for a software development environment. At US$ 18, I think it is reasonably priced. I have only one wish for a future version: it would be very nice to have an “Open in Terminal” option in the context menu, that would also integrate with TotalTerminal…

]]>http://www.bartkummel.net/2011/09/developing-java-software-on-a-mac-file-management/feed/06Developing Java software on a Mac: text editinghttp://www.bartkummel.net/2011/08/developing-java-software-on-a-mac-text-editing/
http://www.bartkummel.net/2011/08/developing-java-software-on-a-mac-text-editing/#respondTue, 23 Aug 2011 11:00:37 +0000http://localhost:8888/wordpress/?p=7For the largest part of the Java development work, you use of course an IDE. As I mentioned in the previous article in this series, the major IDEs, such as Eclipse and NetBeans, run on a Mac without problems. But apart from an IDE, a lightweight but capable stand alone text editor comes in handy quite often. Of course OS X comes with TextEdit, that is comparable to WordPad on Windows. It’s a simple word processor with the capability to edit plain text files. It can do the job, but it lacks some programming-oriented features.

So I started looking for an additional text editor. Since I use such an editor only as additional tool besides my IDE, I’m not willing to pay (much) for it. On Windows, there is a plethora of free or cheap text editors available and although the number is lower, there are quite a few good options for the Mac as well. I picked a few for evaluation…

]]>For the largest part of the Java development work, I use of course an IDE. As I mentioned in the previous article in this series, the major IDEs, such as Eclipse and NetBeans, run on a Mac without problems. But apart from an IDE, a lightweight but capable stand alone text editor comes in handy quite often. Of course OS X comes with TextEdit, that is comparable to WordPad on Windows. It’s a simple word processor with the capability to edit plain text files. It can do the job, but it lacks some programming-oriented features.

So I started looking for an additional text editor. Since I use such an editor only as additional tool besides my IDE, I’m not willing to pay (much) for it. On Windows, there is a plethora of free or cheap text editors available and although the number is lower, there are quite a few good options for the Mac as well. I picked a few for evaluation…

jEdit

Of course there is jEdit. Being open source and written in Java, it instantly gets some sympathy points from me. However, it suffers from a common problem of cross-platform applications: the user interface feels non-native on every platform. It seems this distracts even more on the Mac platform, where slick design is the standard. On the other hand, jEdit is very versatile and the project exists for many years, still releasing updates regularly. The editor isn’t very lightweight though, and it can take some time getting used to. All in all jEdit is a capable editor and I keep it installed on my system for some special functionalities offered by some of the many plug-ins that are available. (You should browse the plugin directory to get an idea of the huge amount of plug-ins.) Despite all this, jEdit didn’t become my favorite text editor for everyday text editing…

The classics

A text editor overview is not complete without mentioning the “classics”: VI and Emacs. Being a Unix operating system, Mac OS X comes with the command line versions of Vim and Emacs pre-installed. They’re accessible by typing the right command (vi or emacs) at the OS X Terminal. I’m not a huge fan of either, but I do use Vim occasionaly when I want to view a file or do some minor editing from the command line. But if you are a fan of one, it is good to know that GUI versions of both editors are available: MacVim and Aquamacs. And if you ever try one of the command-line versions and you don’t know how to exit: VI can be quit by typing a colon (:), followed by ‘q’. If that doesn’t work, you might have to press ⎋ Esc before typing the colon and/or you might have to add an exclamation mark (‘!’) after the q. Emacs can be exited by typing Control-X followed by Control-C. (That is ⌃ Control, not ⌘ Command!) So to round up this section: I only use the command line version of Vim occasionally and I don’t feel the need for installing a GUI version of one of those classic editors.

Smultron

Smultron is a Mac-only editor. What I understand is that it was quite popular a few years ago. Back then it was developed as an open source project and was available for free. The open source development stalled in 2009, but the last released free version can still be downloaded from Smultron’s Sourceforge page. It seems to work, even on OS X Lion, although I didn’t test is very thouroughly. Recently, Peter Borg announced the reincarnation of the Smultron editor as a commercial product in the Mac OS App Store. Two versions are available: version 4 is for OS X 10.7 (Lion) only, while version 3.8.4 also works on previous versions of Mac OS X. Both versions cost US$ 4.99, which Apple converts to € 3.99 in the European App Store. I did not test the commercial version, as I found a good free alternative (see below). However, some features of the new version 4 sound attractive: Smultron seems to be one of the first Mac text editors to support the new Resume, Auto Save and Versions features of OS X Lion. Maybe I’ll give it a try someday…

TextWrangler

A very good and free text editor on the Mac is TextWrangler from Bare Bones Software. The company calls it the “little brother” of their BBEdit product. While “little brother” sounds as if we’re talking about a rather limited product, TextWrangler actually is a very capable and versatile general purpose text editor. (It seems the BBEdit product, priced at US$ 39.99 at the moment, is targetted at web-developers to be used as their main editor.)

Apart from the usual features, like line numbering, syntax highlighting, advanced search and replace, TextWrangler even has an excellent compare tool, that handles file-to-file as well as directory-to-directory comparissons. (The compare tool is somewhat hidden though, it is reachable via the menu: Search > Find Differnces….) As with Smultron, TextWrangler is written exclusively for Mac OS, so it integrates really well with the system and it sports a slick look and feel, just like other Mac OS applications. For now, TextWrangler is my favorite text editing companion for every day use.

Conclusions

Well, this is clearly just a personal evaluation of some text edit options for the Mac. There are way more options available, but I didn’t have the time to evaluate them all. There’s a list of Mac text-editors on Wikipedia, although the list isn’t updated since October 2006. Various other websites publish such lists as well. I want to stress that I just mentioned my personal favorites here and I wouldn’t dare to say that one solution is better than another in general. I hope you enjoyed this article. Please feel free to share your experiences with any of the mentioned editors or any other editor.