4 ms·
I was about to say "omg yes" -- as someone who writes piles of java code, this is a constant pain. However, look at the other tools: I run python out of a virt
by x0x0 12y ago
I was about to say "omg yes" -- as someone who writes piles of java code, this is a constant pain. However, look at the other tools: I run python out of a virtualenv. I use rvm to run multiple rubys, and that shit breaks all the time for me. (Or rather, I use it infrequently enough that I never learn it well enough; I use it for the first time again every 2-3 months).
That said, java is a special bit of shit. Those shell scripts are really complex. Most java shops have had problems with classpaths exceeding the 32k limit in shells! And java is yet another language where the morons who run it refuse to sand off some of the really sharp edges most likely because their heads are in their asses. To give two really simple examples:
1 - why the fuck can't I import a directory full of jars? eg
--classpath ./lib/jars/*
or better yet, recursively descend
--classpath ./lib/jars/**
For personal projects I often use ant just to manage the classpath.
2 - a nullsafe repeated dereference operator, like groovy. If I'm pulling out a.b.c.d out of a nested object, in real code, I have to say if
String address = null;
if (a != null)
if (a.b != null)
if(a.b.c != null)
if(a.b.c.d != null)
address = a.b.c.d.address;
return address;
// vs groovy
String address = a?.b?.c?.d?.address;
this is the sort of minor irritant that you have to deal with all day long with deep class hierarchies, and there's some really low hanging fruit to instantly make my life better. sigh.
And for java, the combination of ant, maven, ivy, etc, are a special set of hell.
- agibsonccc 12y agoRe: classpath. You mean like this[1]? [1] http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html http://docs.oracle.com/javase/6/docs/technotes/tools/windows...
- x0x0 12y agoeh, you're quite right; it's the recursive I really need. oops. fta: Subdirectories are not searched recursively. our solution has typically been to unjar all the libs and turn everything into a single giant jar, though this often leads to 100+M jars.
- agibsonccc 12y agoYeah I use uberjars sometimes too. Java deployment in general is awkward/subpar. Some of the newer tech like dropwizard has helped with this, but it's still far from ideal.
- pron 12y agoTake a look at capsule[1] (I'm the author). [1]: https://github.com/puniverse/capsule https://github.com/puniverse/capsule
- agibsonccc 12y agoThis is what I was going to bring up. Also: hello again ;).
- justbaker 12y ago"I use rvm to run multiple rubys, and that shit breaks all the time for me." You are doing it wrong then.
- coldtea 12y agoThere are several problems with RVM (and a lot of extra "magic" it does compared to say rbenv). Those have been discussed in the community for years. So, besides the use of a BS idiom "you're doing it wrong", the parent comment doesn't add much value to the discussion.
- brendano 12y ago1 - why can't I import a directory full of jars? eg --classpath ./lib/jars/* or better yet, recursively descend --classpath ./lib/jars/** I usually do this as (in zsh): -cp "$(print -l ./lib/jars/**/*.jar | tr '\n' :)"
- haddr 12y agoAd 2: Things evolve. If you stopped somwhere in the mid 90, you won't notice. But in Java 8 you can do null checking easily using Optional. Your example would be: String address = a.map(A::b).map(B::c).map(C::d).orElse("UNKNOWN");
- x0x0 12y agoI find that quite wordy, but thank you
- vorg 12y ago> why the fuck can't I import a directory full of jars? Use the -Djava.ext.dirs command line flag to do it. > like Groovy [...] String address = a?.b?.c?.d?.address The Groovy backers have been talking for years every now and then about making ?. ripple though the . after it, so using a?.b.c.d.address would have the same effect as a?.b?.c?.d?.address , but nothing ever gets done. Better look for a language solution being actively maintained for its original purpose, instead of its backers going off on tangents looking to entangle itself in every pie.