40 ms·
Java Pain
- tokenizerrr 12y agoIf you're using eclipse or android studio there's just a single button that compiles and sends your app to the plugged in device, and uses your IDEs debugger, and a logcat window for the system log. There's also an emulator which you could use instead, which comes with the sdk.
- CanSpice 12y agoSo to run a smoke test using a language that's already installed on the computer Tim Bray is using, instead of just typing something easy into a terminal, he needs to download an entirely new application, set that up with his project (which isn't exactly a walk in the park), plug in his device, and then run it? He wants to run a smoke test on a library he's writing. He doesn't want to run a full-blown application just to test his library, or to have to plug in a device to test his library. He wants to open up a terminal, type "java test KeybaseLib" (or something like that) and have it just work.
- lucian1900 12y agoThere are many Java pains, both little and big. Most of them are more related to the JVM than the language. It's why I still don't use Clojure significantly (or even ClojureScript), even though I really like the language. Things just break or simply never work and it appears random. Other environments I use get a lot less wrong (although node is pretty bad too).
- lisperforlife 12y agoThat is true. Coming from Ruby world, you find that Java and the Clojure world have a lot of rough edges. But Clojure makes things as easy as possible. For example, reading from a file or a URL is still (slurp "https://" https://"). It works fine on a stock OSX, Java 8 sdk and the latest clojure. Don't let such minor inconveniences discourage you from exploring Clojure/ClojureScript. The language is fascinating. I feel that learning and practicing clojure has made me a better developer.
- beggi 12y agoI have always had the feeling that JVM is very stable, but I don't have much Java experience. Is that a wrong assumption?
- m0th87 12y agoWhat's wrong with node? npm is a very polished package manager, and I'm frankly surprised how infrequently libraries with native bindings fail to build.
- driverdan 12y agoFor as great as npm is it also has plenty of issues. `npm clear cache` is so common that I don't know why it even bothers with a cache.
- jaxytee 12y agoWhat pains come from the JVM? From my viewpoint the JVM is the best thing to come from the Java ecosystem.
- jwr 12y agoActually, Clojure improves the "Java experience" by quite a bit. As an example, leiningen as a build tool is quite usable, and it doesn't take much work to get a working (yes, also from the command line) application. As for the JVM "just breaking", I can't agree with that. The JVM is an impressive piece of engineering and I'm very glad I can make use of it in Clojure, rather than deal with half-baked attempts at building yet another VM (reference counting, anyone?).
- nathell 12y agoInterestingly, Leiningen is very much usable as a Maven replacement even for pure Java projects. I've tried it, it works fine. Just specify :java-source-paths in project.clj, and you get all the goodies like lein uberjar for free.
- gavinpc 12y ago$CLASSPATH pain is one of the first things a new Java developer encounters — maybe the last, in many cases. The only reason it's not quite as bad in .NET is that it can usually reference at least the framework in a well-known location. But generally, whatever you call the problem that $CLASSPATH is designed to solve (assembly binding, reference resolution), it's an unsolved problem.
- yarper 12y agoAlso points for readers; if you use intellij or another good ide it'll package it up for you with a execute script (gradle's application/java plugin also do this) manual classpath supplying is not advised
- CmonDev 12y ago"Dear Java: I can run Ruby and Python and Go and JavaScript and C code from the command line on my Mac." - to be fair most of those languages are scripting languages.
- CanSpice 12y agoThey're programming languages that people use to solve programming problems, just as Java is.
- simonw 12y agoIn my opinion, the difference between "scripting" languages and other languages hasn't been relevant for about a decade.
- pjmlp 12y agoScripting languages are those that the code gets thrown away when the application gets rewritten in C, C++, Java, C#, ... in order to perform properly.
- Eridrus 12y agoI think the issue is now more one of language philosophy than language implementation now. In my mind languages tend to have an optimal code size where they work well, and what works at <1000 lines often does poorly at even 10k lines.
- Someone 12y agoIn my mind, the difference is clear: scripting language == has REPL == lets you treat it as a calculator, and (in practice) has a one-line, one-statement "hello, world". So, I don't think go is a scripting language. It requires you to write a function and then call it before it will output anything. So, forth, JavaScript, lisp, lua, perl, python, ruby do qualify as scripting languages in my book.
- deleted 12y ago[deleted]
- mdpye 12y agoHow is the classpath problem different from manually specifying the -L and -I compiling that little c program exactly?
- schmichael 12y ago-L and -I are specified at compile time, so if you distribute/deploy a binary the runtime doesn't have to care (except in the case of dynamic linking - eek!) $CLASSPATH is purely runtime, so it's all the fun of dynamic linking, all the time. Monolithic shaded JARs can solve this problem but introduce some of their own.
- mdpye 12y agoSo someone has already gone to the effort of specifying them. In that case the analogous java situation is downloading a packaged jar and running java -jar mything.jar
- not_rhodey 12y agoyou're kidding me, right? rhodey@rhodey$ mvn package rhodey@rhodey$ java -jar <package-name>.jar <command line options>
- schmichael 12y agoI don't think you read the article. You don't address his certificate issues. Your solution also requires writing a pom.xml which is non-trivial.
- Malus 12y agoMaven can generate one for you: mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false Which is not trivial I suppose, but it is pretty easy to do.
- exabrial 12y ago::head desk:: A pom.xml at least has a schema and tons of copy/paste examples. Every language sucks in it's own way.
- ossreality 12y agoThe cert issues are a packaging and Apple issue. Explicitly. I don't think it's fair to make the claim "java suxors" because Apple packages bad certs.
- fsdfweafwe 12y agoto be fair this wouldn't work unless you have assembly/shade plugin configured.
- schmichael 12y agoThe confusing series of shell scripts most Java services (Cassandra, Kafka, Elasticearch) come wrapped in are a constant annoyance. Not only do they rarely if ever follow common shell command idioms, but trying to configure production services turns into tracing environment variables through a series of shell scripts sprinkled across my system. It's nothing wrong with Java the language, but the platform just seems to make common UNIX best practices hard. Edit: Just remembered Kafka is Scala, not Java, but I think it just supports my asssertion that the Java/JVM ecosystem just makes common best practices hard.
- jaxytee 12y agoJava just has a slow to adapt ecosystem, and that slowness seeps into everything Java touches. The fact that it's 2014 and there is no Java Repl highlights this. Java is FINALLY adding Lambda functions (a lackluster implementation at that), but guess what? There already exist billions of lines of code written in "noun based" Java. Our shop has a client that refuses to upgrade from Java 5. There's no chance in hell this project sees a Lambda.
- kyllo 12y agoNot just lambda functions, but functions period. Java through 1.7 does not even have functions, the closest thing you can get is to write a class and give it a static method (which of course is not a closure). AFAIK in Java 1.8 you still cannot define or call functions outside of a class. So it's still "noun based."
- peterashford 12y agoI find that as incredible as a FPL not containing an implementation of OOP
- x0x0 12y agoI 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.
- yawz 12y agoUse a programmer testing framework (e.g. JUnit) even if this is an integration test, even if you're going to "ignore" it later. If you feel the need to create a main() method just to test your code, IMHO, it is a type of code smell and I think this should belong with your programmer tests.
- oinksoft 12y agoWithout the code and error message, this is just a rant from some (famous) guy who can't/won't figure out his tools. First of all, it took me forever to figure out the java command-line incantations to tell it that it needed my project’s class files and the json.org library (which I’d already downloaded so I could compile the sucker). Yeah, I used to know that stuff ten years ago, but there really shouldn’t be any complexity here. "incantations"? It's not wizardry.
- maxlybbert 12y agoI'm no fan of Java, but in this case I have to say I don't have much sympathy for Bray. Yes, running Java from the command line is a huge pain, especially if you haven't done it in ten years. Yes, it should be possible. But it can't be intuitive to everybody because people have conflicting ideas of what the intuitive thing would be. Yes, you will have to run "java -help" to figure it out, or package everything in a .jar file.
- benjaminwootton 12y agoEvery programming environment needs to know where to find it's libraries but it's not exactly rocket science - CLASSPATH, GEM_PATH, LOAD_PATH, GO_PATH etc. Just takes a few minutes to figure it out each time.
- tjr 12y agoReferring to things like unusual command line options as "incantations" has been reasonably common across the history of computer usage at least from the 1970s or so, if not earlier. See: http://www.catb.org/jargon/html/I/incantation.html http://www.catb.org/jargon/html/I/incantation.html
- oinksoft 12y agoEspecially used of tricks that are so poorly documented that they must be learned from a wizard.
- 12y ago
- guipsp 12y ago´./gradlew run´ Good luck trying to compile a C project without autotools/make either.
- angersock 12y agoIt's not that hard. I believe in you. gcc test.c -o test
- gnufied 12y agoYou know there are tools other than `autotools` right? I use qmake and CMake all the time. it is mostly - "qmake && make" for me. Yes, you will have to learn CMake - but I don't think that is any different than learning ant/maven/gradle.
- sehugg 12y agotl;dr: Missing certificate in keystore. It'd be helpful to know the details; it's hardly an issue limited to Java (although it's harder to bypass certificate checking than in, say, curl)
- nailer 12y agoYep, it happens in node. There you fix it with: require('ssl-root-cas').inject();
- fsdfweafwe 12y agoThis is what I hear: "I am java newb and it doesn't work!" . Its true that other languages are simpler but he is missing the point why in java you have explicitly set classpath. Java allows not only for having multiple versions of libraries on the system with no installation whatsoever, but allows running components requiring those different versions of same lib in the same process (OSGi).
- tsmarsh 12y agoYup, he's right. Most of these problems have been solved with tools, not by the JDK. If I have arbitrary Java that I want to execute quickly I write a unit test, not a test program for precisely this reason. I guess it doesn't slow me down, because I know the unit test 'trick', in the same way as I know how to get Light Table to execute arbitrary s-expressions to get around Clojures load times has meant that I'm far less obsessed with Clojures slow startup. Its a problem, sure, but I don't think Java is broken, its just never had the CLI in mind.
- kyllo 12y agoIf I have arbitrary Java that I want to execute quickly I write a unit test, not a test program for precisely this reason. Exactly. JUnit is your "command line" (and your REPL) for Java.
- sid- 12y agoIn java to be able to crawl a https url you have to do the following - http://www.coderanch.com/t/134619/Security/JDK-trust-Certificate http://www.coderanch.com/t/134619/Security/JDK-trust-Certifi... Its easier in other languages but its not that hard in java. Just export certificate via IE and save to disk and from the jre/lib/security folder and issue one command keytool -import -alias mycert -keystore cacerts -file d:\mycert.cer. (default password is changeit) Done.
- scotty79 12y agoWhy must you do that? And why you don't have to do that for environments of modern llanguags?
- jcape 12y agotl;dr: Other environments are insecure out of the box, and require applications specifically opt-in to security. Java requires you opt-out of the security. HTTPS is built on top of PKI, which involves a list of trusted root authorities who verify that the certificate for blahblah.com is actually for blahblah.com. A self-signed certificate won't have that, and any application that doesn't validate that the certificate is signed by a trusted authority and not expired, etc. has no security. If an application doesn't validate it's certificate, anybody sitting between you and the HTTPS server can step in between you and your traffic, give you a phony certificate, and then proxy all your "secure" traffic to the HTTPS server. And, of course, "sitting between you and the HTTPS server" means not only the NSA with their low-latency network specifically built to conduct these types of attacks, it also means the guy in the corner at Starbucks too (because WiFi is a radio). Java only actually started checking if certificates were valid very recently (IIRC it was J7, r51). Prior to that, Java was just as lax as every other toolkit---probably specifically to address complaints like Bray's: "testing HTTPS is tough".
- scotty79 12y agoI never understood how trustworthy is cert that you could buy for 100$. What that certificate proves? That whoever signed the stuff had a 100$ at some point? Besides ... why can't java just pull the certs out of the system (like you did manually) or ship with them like every browser does (I presume).
- djulius 12y agoBy far, the most uninteresting post of the day on HN. Some random guy ranting on trivial stuff.
- pflanze 12y agoHe's not really random, at least I remembered his name. He may have invested enough into the XML, and since Java is pretty strongly into XML, perhaps also the Java world to feel justified venting about it. https://en.wikipedia.org/wiki/Tim_Bray https://en.wikipedia.org/wiki/Tim_Bray
- _greim_ 12y agoEveryone knows in theory that an actual command line is being run, and somewhere a main() method has kicked it all off, but the Java world is really dominated by enterprise tooling concerns, many levels of abstraction away from such things. Since people in the community don't spend much time thinking about it, it doesn't get the attention and polish it needs.
- jayd16 12y agoAre we seriously talking about this article? There's nothing here.
- agibsonccc 12y agoAs a java dev myself, I'd just like to say that I agree. If I want all of those extra features, I will just move to scala though. The command line is a bit quirky, but I think like anything else in java, we typically solve it with libraries like args4j. It's not the best situation, and there's lots of ways to do things. That being said, whether you consider this stockholm syndrome or not, I'm used to the quirkiness and it doesn't really affect my day to day. Could I be as productive had java had better features/support? yes. Is it that much of a non starter? I think it's just like any situation, use what makes sense for the job.
- tootie 12y agoExecutable jar anyone? It's not that hard. Generating a standalone executable (a jar plus a bundled JRE) is not as simple as it should be, but it's certainly doable.
- PaulHoule 12y agoThis is why I wrote this open source package https://github.com/paulhoule/centipede https://github.com/paulhoule/centipede you can create a new project with from a maven archetype that has log4j and Spring set up for you. A centipede application contains a bunch of little command line applications that are defined simply by writing classes that implement CommandLineApplication; Spring automatically finds all of these and makes them available. Centipede also defines a per-user configuration mechanism that means you have no excuse to hardwire database passwords into your version control.
- spullara 12y agoIMHO, the best way to distribute java programs is create a single jar and the append that jar to this shell script: #!/bin/sh exec java $JAVA_OPTS -jar "$0" "$@"
- aikah 12y agoand then it doesnt run on windows...so much for run everywhere... the best way to distribute a package is to create a proper package for each plateform and encapsulate any java "gimmick".
- jebblue 12y agoRight, you don't need the script as long as it's an executable jar, it will run fine with: java -jar Product.jar If there are any native libraries then they need to be built into the jar, you could do one jar or one for each platform.
- spullara 12y agoWindows? Really? I think there is an SNL skit in there somewhere for people still deploying server software on Windows.
- gaul 12y agoreally-executable-jars codifies this as a Maven plugin: https://github.com/brianm/really-executable-jars-maven-plugin https://github.com/brianm/really-executable-jars-maven-plugi...
- spullara 12y agoIMHO, the best way to distribute java programs is create a single jar and the append that jar to this shell script: #!/bin/sh exec java $JAVA_OPTS -jar "$0" "$@"
- exabrial 12y agoC, CPP, Objective-C, and Swift are all broken too then... Java runs as compiled bytecode, not interpreted script. Try "mvn exec:java". If you're not using Maven, you're likely making this ridiculously harder than it needs to be. (And yes, Maven sucks too, but it's also pretty good). I do think a KeyBase Java client is a good idea though! Can't wait to see the results.
- chipotle_coyote 12y agoI'm seeing a lot of comments here along the lines of "this is just a problem Java newbies would have and this Tim Bray guy, whoever he is, doesn't want to take the time to learn the tools." Well. True, to a degree, I suppose, but whoever this Tim Bray guy is adds some pretty important context. He co-authored the XML spec and was director of web technologies at Sun. You know, the people who made Java and promoted it as a web technology. Going out on a limb here, but it doesn't seem to me that the man is a Java newbie. The point of Bray's rant, I'd suggest, is that these tools largely haven't gotten any easier since 2004. It frequently seems to be controversial in these parts to assert that it's worthwhile to make developer tools easy to use ("what you're complaining about is obviously easily addressed by whipping together something with bash, awk and sed and therefore isn't a pain point at all, you whiner"), which has always vaguely irritated me. A toolchain which requires you to wrangle it into place for every project is a toolchain which could benefit from usability improvements.
- smrtinsert 12y agoI'm surprised he thinks the core platform should offer that, the JDK is large enough as it is thank you. Any number of countless application generators and libs make it easy. Even a quick glance at maven central would've answered his question. In other words, Java wont search the internet for you.
- fidotron 12y agoI'd argue Maven is a giant kludge in the very spirit being argued about. If the underlying platform was better Maven would go away, but the existence of it prevents useful discussions about how to improve the underlying platform with "why aren't you using maven?" "because it sucks the life out of my soul" etc. The other classic example is the increasingly popular multi-cursor editing editors, which should be a giant red flag over the lack of expression in the programming language. What happens is they make it almost tolerable, and the incentives to improve are thus diminished greatly, to the point the problem will be ignored by most.
- acdha 12y agoAgreed - and both Sun and Oracle have no cultural tradition of taking toolchain usability seriously. Installing updates is a complete trainwreck for almost every product they've ever released and that's one of the most basic tasks for a software vendor. Fundamentally, I think the problem is arrogance – companies like Oracle or Sun historically assumed that their products are so important that it's someone's full-time job to deal with the rough edges, they've invested in training or reading massive doc dumps, etc. – familiar to anyone who's heard tales of mainframe operators with run books of canned solutions for each problem. Those HN commentators have the same blindspot. In addition to usually being flat-out wrong, as the more common user is someone who just needs to do what should be a simple task which is blocking their actual real job, this ignores how profligately that mindset wastes other peoples' time and how it sets a dangerous long-term precedent where alternatives look attractive because everyone simply assumes e.g. Java, Solaris, Oracle's database etc. is hard to use and expensive.
- jakozaur 12y agoQuite a lot of languages let's you do https, but just give you illusion of security. Not really validating it, which is trivial to spoof with certificate signed by "your own authority". "The Most Dangerous Code in the World: Validating SSL Certificates in Non-Browser Software" https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf
- idbehold 12y agoWow, does this imply that the Heartbleed bug might end up being even more damaging that previously thought? This paper shows that even if you've already revoked your old certs, many pieces of widely used software don't even bother validating them.
- ossreality 12y agoYes. Like Chrome. And Android devices. And more. Yes, this is why Heartbleed is/was bad.
- Eridrus 12y agoThis has nothing to do with heartbleed. This means you can just generate certs on your own machine that a lot of software will simply accept.
- deleted 12y ago[deleted]
- skywhopper 12y agoI know Java well, though I'm not primarily a developer. As a DevOps guy, there are a few places where I'd love to be able to write a quick program in Java to take advantage of one API or another, or to ensure compatibility with the app I'm trying to manage or what have you, but between the boilerplate, the classpath, the compilation step, and the awkward command line, it's almost never worth it, and I write it in Ruby or Bash instead. The complaint about overstrict PKI libraries is spot on as well. Dealing with Java's PKI infrastructure for https URLs, etc, in a systems level setting where, you know what, sometimes the CN on the cert ain't gonna match the internal name, is a huge pain. Other languages are actually pretty bad about this too, and so too often I resort to calling out to curl -k because it'll just shut up and do what needs to be done. It's clear that this is all because Java is built around the assumption that you're creating a big program and you're going to use an IDE and you're willing to deal with multiple steps before you have something that'll run on the server. That's fine and dandy. If the Java community wants Java to be more useful for smaller tasks, then Tim's complaints here are dead on target. But if not, I long ago gave up trying to use Java in this way, and I think Tim should do the same.
- jcape 12y agoNo. HTTPS should be secure out of the box. If you want to break HTTPS then you should have to do work.
- Eridrus 12y agoI'm not sure why Java is taking a bullet on this. The default in other languages is often to not do any certificate validation. That seems like the worse approach since no-one can tell their code is insecure. Maybe fine for a scripting tool, but I wouldn't want that on my production boxes. I'm not sure why every language needs to be useful as a scripting tool. If there are things that help the common case and also scripting (eg classpaths being a pain), there's obviously an argument for "why the fuck hasn't this been fixed yet", but in other cases there are either fundamental tradeoffs or resource constraints.
- yellowapple 12y ago> I'm not sure why every language needs to be useful as a scripting tool. "Easy things should be easy, and hard things should be possible." -- Larry Wall One of the reasons why I switched from Java to Perl. I didn't feel that easy things were easy in Java, and I don't run into enough hard problems on a daily basis to justify the verbosity and masochism involved.
- mark_l_watson 12y agoThere is a lot of truth in what Tim says. The Java + Clojure + JRuby ecosystem has been very good to me. That said, I have been spending more time writing Haskell code that anything else this year and being away frmm the JVM, and being able to build compact executables is a breath of fresh air, especially since I am looking at Haskell now more as a strongly typed and perhaps better Lisp.
- suprgeek 12y agoGiven Suns history with EJB 2.0, I would humbly submit that "ease of use", work out-of-the box etc should not be the default expectations with Java. Having said that (snarky response) having worked with Java from 1.1, I think the language is moving in the right direction. The latest release (8) adds a ton of syntactic sugar and there is a real impetus towards easier more dev friendly features. Plus Java needs a non-backwards compatible version soon. I suggest Java X be that where it gets rid of a lot of the cruft that has built up. (Go Duke!)
- exabrial 12y agoAmen for breaking backwards compatibility. Needs to happen soon so the CRUFT can be cut out of JEE.
- adamc 12y agoI see the appeal but... Python's long, slow march to widespread adoption of 3.x, and Perl 6's much less successful experience, both suggest there would be a lot of danger in that.
- yellowapple 12y agoYep; I'd rather just have Perl5 on Parrot than have to relearn Perl. Not to mention that the O'Reilly book for Perl6+Parrot doesn't have a parrot, or even a camel. Deal-breaker right there ;)
- scotty79 12y agoJava is Enterprisey. Enterprises survive and operate only because they by freak accident at some point began earning way too much money. They employ lots of people who have no incentive to save work. We are paid for our work. Effects of the work are secondary to almost everybody in corporate world. Why trouble yourself with figuring out code if you can get paid all the same for tinkering with claspaths and poms for few days. Java is a decent language but its developers have way too much tolerance for pointless hoopjumping.
- skizm 12y agoI'm confused about the HTTPS complaint. Is he trying to do something special? I'm pretty sure a simple HttpURLConnection object can read HTTPS links same as HTTP links. I feel like I'm missing something.
- critium 12y agoSeems like 2 issues: 1. Launching Java Programs can suck 2. Java defaults to secure on https requests. First, on #2, yeah, really cant do anything here. If they didnt do this way, it would be reported as another vulnerability in the JVM that they would have to patch. On #1, this is actually an old problem that I had worked on this years ago and i even published the solution in javanet (remember that?). If there is any interest in this, i can revive the project since its been dead for nearly 10 years. (http://web.archive.org/web/20070724060104/https://launcher.dev.java.net/ http://web.archive.org/web/20070724060104/https://launcher.d...) Basically I had a custom classloader read the lib dir that worked similarly to tomcat's classloader. Dump any jars/wars/etc in there that you want. All you had to do was tell me where the main class was (because a lot of jars have testing Main built into it and i wouldnt know which one you wanted to run).
- patio11 12y agoOne thing which I noticed during the Stripe CTF, where Node, Scala, and Go were all first time languages for me, was that the baseline experience of getting a dev environment assuming you have a Linux box is, in 2014, really freaking awesome. I was doing Java in 2004, and think it would probably take me half an hour going from zero to "minimum viable Java dev environment." I was hello worlding after maybe three console commands in Go/Node/etc. This is partly a technology problem, partially a philosophy problem (Java does not have a scripting language heritage which counsels e.g. having a REPL or really obvious options for program invocation), and partly a marketing problem. I rather doubt that anyone at Oracle has the job "Make people's first experience with Java suck less." Web devs thankfully have standardized on "batteries included; max five minutes to install" for new platforms in the last few years (Rails strikes me as the conspicuous first example, and ironically is harder to install now than it used to be).
- glimcat 12y agoIt still often takes me 30+ minutes to set up the environment for a new language, but that's mostly spent doing some reading on how to set it up "right" vs. just executing an apt-get. Most of which comes down to the fact that official documentation for first-time users is somewhere on the spectrum of nonexistent to crappy. Many languages have pretty good tools for managing virtual environments and dependencies and such these days, but odds are that a new user won't find out about them for quite some time unless they know to go looking.
- cowardlydragon 12y agoHe's getting hamstrung by Java's intolerance of self-signed certs. Which overriding is a bit of black magic.
- norswap 12y agoVery true, I was thinking about this recently. Note there's no technical impediment to making the right tools, so if you're tempted, have a blast :) (Otherwise maybe I will)
- abalone 12y agoPlay targets this exact pain point in Java. The "I want to script stuff easily in a text editor not an IDE and by invoking from the command line and/or by loading a web page without a compilation and deployment step" case. Here's the manual page for calling an HTTPS service [1]. You just call WS.url("https://example.com" https://example.com").get(). And if it's a self-signed certificate then it's more or less one line in a config file to add it. That's about as easy as it gets short of deliberately making HTTPS insecure. My experience: I very quickly evolved beyond this case and prefer the robustness of standard Java with the convenience of a bundle like Dropwizard [2]. Dropwizard packages up and glues together various best-of-breed libraries for building services. That was the real pain point for me, not so much having to use an IDE. [1] http://www.playframework.com/documentation/2.3.x/WSQuickStart http://www.playframework.com/documentation/2.3.x/WSQuickStar... [2] http://dropwizard.io http://dropwizard.io
- logn 12y agoJava supports Runnable JARs. This bundles all dependencies into the JAR so you can just run: java -jar foobar.jar And if it's a webapp, you can use something like Jersey so that the JAR itself if a webserver (launched from main function). And with Jersey+Grizzly you can make webapps that have zero XML config, btw. Java's SSL handling is definitely annoying, though. But I think it's better than how other languages do it which is to simply bypass cert validation. Also, I don't think it's fair to lump anything Android-related into complaints about Java. Google yoinked the Java syntax and the name and then added their own stack underneath. My main pain point with Java is dependency management and builds. I don't like any of the systems out there. After years of Ant, Ivy, and Maven, I've just resigned myself to using Eclipse and downloading JARs manually, storing them with the code. It's ugly but not as ugly as Maven.
- djeikyb 12y agoFor those who can accept ant+ivy, I feel this is a stab in the right direction for console apps: https://github.com/djeikyb/simple-console-app https://github.com/djeikyb/simple-console-app The script target creates a runnable shell script that has the jar and all dependencies embedded. The last step might be using packr[0] to also embed the java runtime. [0]: https://github.com/libgdx/packr https://github.com/libgdx/packr
- zimpenfish 12y agoExcept you can't bundle "all dependencies" in when one of them is a JAR itself, can you? Unless you faff about with something like OneJAR (which is a work of genius but honestly, why is this even necessary?)
- vorg 12y ago> Dear Java: I can run Ruby and Python and Go and JavaScript and C code from the command line on my Mac. If I can’t run you, that means you’re broken. These were the types of problems dynamic JVM language Groovy was created back in 2003 to solve. If only Groovy had stuck to its knitting when the new management, er, took over from its creator a few years later, it would still be a solution. Unfortunately, Groovy diversified into providing CompileStatic tags to compete with Java, DSL syntax to compete with Maven, a MOP to compete with Rails, and AST annotation hooks to compete with Lisp. It's now become obsolete for its original purpose of JVM scripting, missing the Java 8 boat despite several years advance warning, as well as being at best 2nd fiddle but usually 9th fiddle at the stuff it tried diversifying into.
- teacurran 12y agoSo many people commenting here don't seem to have read the article. His comment is that Java can't connect to an SSL encrypted URL out of the box. He is saying that because it can't do this it can't be used for a basic command line app. He isn't complaining that it is hard to write a command line app in Java. He is trying to load this URL: https://keybase.io/_/api/1.0/user/autocomplete.json?q=something https://keybase.io/_/api/1.0/user/autocomplete.json?q=someth... This URL is not self signed and loads fine as a valid cert in a browser. In the Java application it throws an exception about a bad handshake. I believe this is because Java 7 and 8 ship with less trusted certificate authorities than browsers do. I forked his project and made it easy to run via the command line without Android if anyone wants to try it out: https://github.com/teacurran/KeybaseLib https://github.com/teacurran/KeybaseLib Just clone the repo and execute "./run.sh something"
- ivanr 12y agoTim's rant is misplaced. The reason he can't connect to https://keybase.io https://keybase.io using Java 7 is because Keybase have (mis)configured their server so it doesn't offer any cipher suites Java 7 could use. https://www.ssllabs.com/ssltest/analyze.html?d=keybase.io&s=54.84.133.185 https://www.ssllabs.com/ssltest/analyze.html?d=keybase.io&s=... You can see this in the SSL Labs simulator, in the bottom part of the report. Clicking "Java 7" will show the cipher suites available by default.