Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Java Jar Hell

I've just spent the last two days trying to figure out Java Jar file dependencies and still haven't licked it yet! I sure wish that I worked in .NET all of the time. I'm frankly quite fed up with all of Java's little jar file and classpath quirks.

I realize that this is a bit off topic but don't let anyone ever bad-mouth .NET for the way it handles locating referenced assemblies... .NET beats Java hands down in this regard!

Long live .NET!

Java... let's get it together for pete's sake!

Friday, April 22, 2005

These are the kinds of posts I used to throw up (and probably will be throwing up soon) to complete silence - which would lead me to wonder what "magic pixie dust" other java developers had that I didn't.

What will really help is using a tool, however, some sort of IDE that allows you to reference the specific libraries you need.  At the time I did a lot with java I settled on Borland's JBuilder - it didn't leverage the classpath from Windows, it would build it's own and use as an argument for it's javac.  You could reference libraries similarly to the approach of VS.NET.  They also had a "free" version one could use (used to be the Personal edition, now called Foundation).

I'm in your boat though; I'm going to be doing some java stuff again and I'm not looking forward to the battle of getting things oriented.  Nowadays, it seems, everyone is galvanized behind Eclipse so I'll probably give that a whirl.

David Seruyange
Sunday, April 24, 2005

Thanks David,

I'm also glad to see that I'm not the only one having trouble. I am forced to use JBuilder for work but haven't had too many complaints (except for multimonitor support).

My big issue right now is that I am writing an Aplet that needs javacomm and javapos jar files installed correctly on the client. Not to mention xml config files and properties files. It's a complete nightmare. Each one has its own dependencies and none of them are documented well. I'll figure it all out eventually but it is really quite painful.

My big beef with Java is that there are SO many ways (and none of them preferred) to specifiy the classpath. You mentioned how JBuilder rolls its own. You can use environment variables (not preferred) or pass it as an argument. Everybody does it differently and many people just resort to shoving jar files into the <jre>\lib\ext directory. The bottom line is that you can never just click on an app and expect it to run. You usually need some sort of extra batch file to kick off you app so that you can include some complex scipt to temporarily specify a class path. This type of stuff is just nuts and makes it too easy for users to hose the whole installation up. I have a configuration app loaded from another vendor that uses a batch file to run the app. The bacth file stays open in a command prompt window while the config app runs. If you close the command prompt window it kills the app! Normal users would be completely confused by this behavior and would never tolerate having to run each application with two windows.

Anyway... just some venting. Thanks for listening.

Sunday, April 24, 2005

Isn't this whole Java fiasco just an Emperor's New Clothes thing anyway ?

Eventually Sun will run out of cash and then (hopefully), Java will quietly retire and be forgotten about.

Joel Spolsky
Monday, April 25, 2005

It'll take a while if Bill keeps handing them big checks.

John Stemper
Monday, April 25, 2005

But you have to hear the final outcome....

My actual issue turns out to have been a little known bug in the JavaComm library. This bug has been around since 1999 and has never been fixed in the Windows or Linux versions. Of course, Sun went ahead and fixed it in the Solaris version! ;)

Those buttwipes cost me two stinking days of work tracking down their stupid problem. And people whine about Microsoft not fixing bugs!?!?!

Monday, April 25, 2005

What a major pain.

It's too bad Eclipse wasn't written in C#. :)

Jeff Mastry
Tuesday, April 26, 2005


Microsoft has mastered the greatest IDE ever - too bad Sun chased them out of the java market - fools.

Tuesday, April 26, 2005

Java-Jar Binks says: "Meesa thinks Sun a much worse predator than Microsoft, other Gungans just need some more time to see thees"

Kamen Lilov
Wednesday, April 27, 2005

I think part of the Jar hell probelm is because of improper usage. Most programs should be runnable by using a simple,

java -jar myapp.jar

All the dependecies should be in the manifest file and user need not know about them.

Anybody who is still using CLASSPATH environment variable must have been living in cave for last 5 years.

What I really miss in Java, is the ability to pick the right version JRE for an application.Because of this every app has an approriate version of  JRE installed under it. JRE is treated more as a library than a runtime environment. Last time I counted my machine had 15 installations of JRE, ranging from 1.1 to 1.5.

By the away, I regularly use both MS Visual Studio 2003  and a Java IDE (IntelliJ); believe me, Java IDE is years ahead in terms of features, though VS definetly looks better.

Wednesday, April 27, 2005

"I think part of the Jar hell probelm is because of improper usage. Most programs should be runnable by using a simple,

java -jar myapp.jar"

Yes, great in theory. However, my "app" is an Applet which uses third party components which use third party components which use third party components which.... you get the point.

Besides being bitten by "Java Jar Hell", I'm also taking it up the backside from "Open Source Adoption Syndrome". That's when every open source product decides to rely upon some other undocumented open source product without really caring about the resulting dependencies. I'm quite tired of running around to all of these web sites trying to download the latest version of some piece of OSS because it isn't included in the original package.

It is madness!

Wednesday, April 27, 2005

The disadvantage of open source is that someties you must work on it a bit to get it working. Sometimes the documentation is really good and everything works perfectly but its also the case where something sholud work but needs a bit of attention to get it working (references etc). Personally I think open source is great (look at others peoples code, ideas, style) but theres always the risk you pick the wrong project (in terms of a component) that you use in an application. Its like betting on horses to see if it'll be supported in a year or so (I'm talking more about smaller projects). Still so far as I can see theres still a certain amount of dll hell in .net with assemblies searching for other assemblies it can't find and so on. As for ides eclipse is far superior in terms of pure coding to visual studio 2003. Hopefully vs2005 cam steal lots of the things from eclipse like I think eclipse took codefolding from vs2003 (??)

Friday, April 29, 2005

Joel Spolsky says:

"Isn't this whole Java fiasco just an Emperor's New Clothes thing anyway ?"

Seems you forgot how MS treats VB guys.  Just ask Linux community about how MS really is.

Joel Spolsky comments:

"Eventually Sun will run out of cash and then (hopefully), Java will quietly retire and be forgotten about."

If that happens, there will be many to take place, for instance IBM. I don't know .Net, but I bet the Java community is as double as the .Net community. And there is a lot of good free software and support, just look Lucene project.

Microsoft is like the Japanese, take all the original ideas of others and put it together in a nice package.

Your anti java rethorica is nonsense.

Lorenzo Jiménez

Loernzo Jimenez
Thursday, June 2, 2005

"Joel Spolsky" is obviously not the real Joel. He really should prevent people from posting under his own name.

Friday, June 3, 2005

I developed a website which may be of help in resolving which jar files you need on your classpath in the event
of "java.lang.NoClassDefFoundError" messages etc.

Jarhoo ( ) will also allow you to find
locations for specified jar files within any of the applications
in the database.

Simply type the name of a class into the search box and Jarhoo will return any jar files in the database containing the class.

Hope you find it useful.

Many thanks

Michael Lavelle
Jarhoo Development Team

Michael Lavelle
Tuesday, June 14, 2005

*  Recent Topics

*  Fog Creek Home