Why does my backgrounded script/app die after I close my terminal window?

Short answer: because you’re a freaking idiot.

Long answer: My shell script is on a Linux server. I access via ssh using Putty. I run it from the command line, from Window #1,  like this:

$ bin/myapp.sh &

when I close my ssh window. In Window #2, I watch the logs, and I can see that myapp.sh has exited. Specifically, it caught a SIGHUP.

How to fix this? Don’t close the window. Instead, exit from the ssh session by typing “exit”.

Short answer: I’m a freaking idiot.

Re: conversion to dalvik format failed with error 1

Yeah, a few quiet hours on the weekend and time to code.

I’m a little behind, but I’ve been thinking about mobile alot lately. So it was time to upgrade my Android SDK to 1.5.

First thing I do is upgrade the Android Developer Tools for Eclipse. Inside the Eclipse “Software Updates” wizard, I can see that I was using ADT 0.8.0, and the update site said that 0.9.2 is available. Everyone knows that it 0.1.2 better than the last version! So I do the Eclipse upgrade.

While that is going, I download the 1.5r1 SDK, and stick it in my java folder. Eclipse restarts, and I rebuild and >>BAM!<< error!:

conversion to dalvik format failed with error 1

Whoops. Apparently this has to do with some internal Eclipse stuff caching the old ADT 0.8.0 stuff, and the poor Android Tools getting confused. Silly Robot.

Restarting Eclipse with the -clean option fixed it for me. Apparently the correct way to upgrade the ADT is to uninstall the old 0.8.0, and install the new 0.9.2.

Hope this helps everyone out there. Happy coding!

P.S. Hey, WordPress is bugging me to upgrade to v2.8. Wish all upgrades were as seamless as the WordPress one.

good to be a Java programmer

It’s an exciting time to be a Java programmer.

That’s a big change of opinion for me. I started my career with interpreted languages (Usertalk, Python, Perl) and Java seemed really verbose and unproductive.  And it’s still verbose.

But a great set of tools make me really productive.The tool infrastructure  has come such a long way. Eclipse is a great IDE, and if you don’t like it IntelliJ and Netbeans are as good or better. And the ecosystem around the IDEs is incredible. I’m an Eclipse user, and I’ve talked in the past about Mylyn and how much better that makes me. The intellisense features make the huge Java APIs manageable, and the refactoring tools give me enough freedom to make significant code changes without worrying about copy/paste mistakes.

The tool chain for build, dependency management, testing, and continuous integration has improved. Ant is a great workhorse tool. Hudson pretty much the best CI tool ever, and I’ve even come around (slowly) on Maven. Maven, when it works, works really well. It is hard to imagine working on the project I am working on now without a tool like maven to help manage every aspect of the build.

Part of productivity is code reuse. There is a ton of great code (Apache commons, anyone) that has been battle-tested and debugged and often even documented available. Sourceforge and Google code and Codehaus and java.net all provide tons of libraries and tools.

Some of the best parts about Java is that coders have reacted violently against the unwieldly, badly designed APIs that where thrust upon us in the early days. Most coders knew enough to stay away from EJB, unless they were being paid the big bucks to inflict Big E enterprise on the masochistic companies that insisted on it. But a few coders also figured out alternatives: Spring and Hibernate being just two examples.  The fact that the community has been able to leave behind some of the mistakes and move forward–and that the driving force of that is open source driven, speaks well to the health of Java now and in the future.

It’s weird how the plumbing has become sexy. By far the most exciting development of the past two years is the growth of other languages on the JVM. And that is because the JVM and Hotspot JIT compiler is so good. And it means that I can build on my investment in learning Java, the Java tools, and my IDE. Learning a new language, and I get to keep my productivity gains in the toolchain and environment.

So now it’s time for my list of  reasons to be excited about Java right now. It’s been a busy time for Java geeks, with JavaOne last week, and Google I/O the week before, and Eclipsecon roughly a month ago.

  • Android — I can write mobile apps in a language I already know. whooo! It’s not as sexy as the iPhone, nor is it as crowded a place for a developer. And the mobile market is huge. I don’t mind being in a smaller portion of such a vast market.
  • New languages blooming on the JVM. JRuby is fantastic, and fast. I am learning Groovy now, which I expect to take my productivity up several notches. JPython and Scala are in view too.
  • New focus on graphics and desktop. JavaFX has a lot of challenges, and I’m not quite willing to invest yet, but I am watching closely. There are some really reasonable ways to do UI in Java or Groovy now.  And don’t forget Processing, and it’s focus on practicality, ease of use, and real world data crunching and visualization apps.
  • Google on Java. Wow, the presentations from Google I/O were a real eye opener. AppEngine will let me deploy a java web app with the push of a button. You can’t get easier or more efficient than that. Guice looks like DI I can believe in. And some of the lower profile stuff, like http://code.google.com/p/google-collections/, could wind up having a huge effect on my day to day coding.

Okay, if you’re still with me, thanks for reading. Bottom line, it’s a good time to know Java. The tools have matured, there is a lot of opportunity, and who knows? maybe even the Oracle acquisition of Sun will work out good as well.