When Coding Goes Wrong: Frustrated coder considers writing Java GUI


  • Discourse touched me in a no-no place

    Quick and mostly-unrelated question. If I wanted to throw together a quick little GUI program, what should I use? I don't really want to get into using a library per se, but I've never been fond of awt/Swing. I'm thinking of JavaFX.


  • Discourse touched me in a no-no place

    Argh. Never fucking mind JavaFX. You have to download some package. "You can use our prebuilt installation." Why? I've alreayd got one!

    Or you can download the package. But first, get the Eclipse SDK. Why? I've already got Eclipse! Then, use Help | Install New Software. Oh, that's not on my menu, because I made a custom build via Yoxos, and they apparently hid it. Also, no idea why I'm supposed to use the SDK, when they give you the repo URL to add. So I do that, and it says it needs something else, the xtend SDK. Don't bother googling it, though, because all you'll find is the E(fx)clipse people asking why you aren't using their custom build. You certainly won't find a link to instructions on how to get this xtend sdk.

    It's probably in that 197MB eclipse SDK I downloaded, which it didn't actually say what to do with.

    No, seriously, go here and try to add their shit if you've already got an Eclipse installation. https://www.eclipse.org/efxclipse/install.html#for-the-ambitious

    WHAAAARRGARBL


  • Discourse touched me in a no-no place

    Jeebus. First I tried the checking everything from their repo. Don't do that. You just want "e(fx)clipse - Install" and the IDE subitem.

    Oh, look, a different missing dependency: "Guice integration for FXML". No help on how to find that, either.

    Even worse, this is the quality of links you'll find when Googling: https://www.eclipse.org/forums/index.php/t/521935/

    "Yes - the problem is that we are requireing com.google.inject which is
    not part of our repo but from the orbit one (or the main kepler).

    Our upstream requirements are:

    • EMF
    • Xtext/Xtend (which also requires guice)
    • MWE
    • WST

    Also, I'm not going to tell you how to get those."

    I may have added that last bit.



  • Back to a console app! would be my response


  • Discourse touched me in a no-no place

    Even better. Continuing search finds this: http://tomsondev.bestsolution.at/2011/10/07/fxml-and-google-guice/

    Read the second comment. Click the link. Yes, he provided a link to a more or less blank page. Fuck you if you don't know how to navigate Github already. Eventually I found a readme here: https://github.com/tomsontom/e-fx-clipse Guess what happens if you click the "See a wiki here and make sure you use Java 7 with latest update. Minimum version is Java 7 update 7" link under "Installation": Yup, 404!

    Oh, but farther down there's a repo link. For Kepler, and I'm using Luna, but you don't really find that until you add the link, and get this:

    What the hell does this mean? What happens if I use the Kepler/Juna stuff in a Luna installation? Why isn't this any better than Blakey's troubles with Aptana 4 FUCKING YEARS AGO? Why don't I just tell Java to fuck off--again--and write in .Net instead?

    Every goddamn time I try to learn more Java I run into this type of bullshit.

    In spite of the way I talk here, I am not a violent person IRL, but if you put one of the sociopaths who thinks it's acceptable to write stuff like this in front of me, I would punch him in the face.


  • Discourse touched me in a no-no place

    @boomzilla said:

    Back to a console app! would be my response

    It's really tempting, but I'll never learn Java enough to be able to get a job writing in it at this rate. Why is it that approximately not one single person in the online community can write coherent fucking instructions?

    Like I said, I'll just do a simple .net GUI. All I wanted to do was write a socket server that would throw what it received into a textbox so I could try to debug the problem that started off this thread.

    OMG I just derailed my own goddamn thread. Would you Jeff these rants somewhere else?



  • @FrostCat said:

    It's really tempting, but I'll never learn Java enough to be able to get a job writing in it at this rate.

    Are there really jobs out there for writing Java GUI apps? I mean, outside of European tax agencies, apparently. If you want a Java job, I'd say learn something like Spring to power a web app.


  • Discourse touched me in a no-no place

    @boomzilla said:

    Are there really jobs out there for writing Java GUI apps?

    Well, my rant was not exactly focussed. That's not, strictly speaking, what I was looking for.

    Spring is something I have thought of trying to learn, or maybe Struts or Hibernate or at least one damn framework. Don't know where to start, haven't had time to date to go looking. I'm tired of the niche I'm in, though.


  • Discourse touched me in a no-no place

    Well, let's say java whatever. It's just trying to throw together a simple GUI turned into ridiculousity. Also, what passes for JavaFX tutorials on Oracle's website suck shit. "Download this zip, use some IDE that isn't Eclipse, and here's a bunch of tiny snippets to modify the prewritten code." Jeez. Present the entire program for a slightly non-trivial app, and walk me through what it does and I can figure it out from there. Don't give me a set of pinhole views.



  • My day job is (largely) Java. The only Java GUI I've done is web related.

    I've been frustrated at trying to get Eclipse extensions or whatever to work.


  • Discourse touched me in a no-no place

    @boomzilla said:

    My day job is (largely) Java. The only Java GUI I've done is web related.

    The one job I had where I did any nontrivial Java (2003) was web, although I was working on backend stuff. That's what I'd prefer, given my druthers.

    Again, the chain of thought this evening was just "i'll whip up a simple socket server in a window that puts what it receives into a text box" and then I foolishly decided "why not try something more modern than Swing".

    @boomzilla said:

    I've been frustrated at trying to get Eclipse extensions or whatever to work.

    Eclipse is pretty nice if you have a machine with plenty of horsepower, I'll admit, but yes, what you said.


  • Discourse touched me in a no-no place

    "Access restriction: The type 'Application' is not API (restriction on required library 'D:\apps\Java64\jre8u40\lib\ext\jfxrt.jar')"

    :wtf:

    ETA: This means "use 'import javafx.application.*', not 'import javafx.application.Application'".

    Hasn't the advice always been, if possible, import classes and not packages? (This tells you, probably, how fresh my experience with Java is!)

    ETA^2: And when you make THAT change, it flags "public class GoddamnThisThing extends Application" with the same exact error! No link to any kind of help as to what that means or how to fix it, either.



  • Wow, remediation makes it sound like you're being punished by trying to use their project.


  • Discourse touched me in a no-no place

    Right?

    The "solution" seems to be "Eclipse or Java got confused. Delete 'JRE System Library' from the build path and then add it back".

    :fries: :eyes:



  • @FrostCat said:

    ...throw together a quick little GUI program... ...but I've never been fond of awt/Swing...

    If you'd just used Swing, you'd be done by now.


  • Discourse touched me in a no-no place

    @Bort said:

    If you'd just used Swing, you'd be done by now.

    I'm not even mad (at you).

    Except I haven't used Swing in like 5 years.

    Also, the fear of someone else pointing this out compels me to mention that the Oracle JavaFX tutorials aren't quite as horrible as I thought, but you have to follow them in order, because each builds on the last, and so they skip stuff that isn't new.

    I don't like that, but that's probably not an entirely fair feeling.


  • Discourse touched me in a no-no place

    Also, I don't suppose anyone here's built a custom Eclipse via Yoxos (or similar) and knows how to get rid of the annoying login prompt on startup? I don't even remember the address of the mailinator account I used, let alone the password. :)



  • I've used JavaFX and is quite good. Mind you I used a separate tool to do the composition of the UI which generates the XML files and then Eclipse for the code.

    OTOH, usually NetBeans is better with this sort of stuff.



  • @FrostCat said:

    Eclipse is pretty nice if you have a machine with plenty of horsepower, I'll admit, but yes, what you said.

    Yes, day to day, it's fairly pleasant to work with.


  • mod

    I've never worked with a product that was built on eclipse or otherwise customized eclipse that integrated well with anything else. I just grab stock eclipse and install extensions. Much less headaches.



  • Eclipse + window builder pro made by Google


  • Discourse touched me in a no-no place

    Honestly, I'm pretty sure the entire Java "community" base is an echochamber of charlatans, thieves, and incompetent naive offshore types who have been taken in by the charlatans and thieves. Oh, and managers who have also been taken in.


  • Discourse touched me in a no-no place

    @Yamikuronue said:

    I just grab stock eclipse and install extensions. Much less headaches.

    That's what I'm thinking. But then that might mean having several copies of it floating around.


  • mod

    Meh, not that big a deal in the long run.



  • Desktop Java GUIs are the worst of the worst.


  • Discourse touched me in a no-no place

    @Yamikuronue said:

    Meh, not that big a deal in the long run.

    "Well," he said, in a slightly aggrieved tone, "now, I know that."



  • @Bort said:

    If you'd just used Swing, you'd be done by now.

    I maintain a Swing application for a living and can confirm.

    Also Netbeans is a lot faster than Eclipse for this sort of thing.



  • @Weng said:

    I'm pretty sure the entire Java "community" base

    Thank you. Nothing better than insulting several million people based on... nothing. I would have disregard you as just another troll, but I thought you had more intelligence than that. Oh well, you can join blakey on my black list.


  • Discourse touched me in a no-no place

    @Eldelshell said:

    my black list.

    <!-- POST IS EMPTY! -->

  • Discourse touched me in a no-no place

    IT's a little disappointing that Discurse kills animated gifs.


  • sockdevs

    Really?


  • Discourse touched me in a no-no place

    I would swear the gif was animated when I copied it.

    Oh, maybe Chrome's right-click-copy-image killed the animation.


  • sockdevs

    Yeah, it pastes the first frame as a PNG


  • Discourse touched me in a no-no place

    Shrug. Every time I bump up against Java, I see nothing and meet nobody to contradict that statement. Doesn't mean such people and things don't exist, but my fucking god why would a community of competent people allow their public face to be so outwardly shit?

    Of course, in my opinion I'm an incompetent charlatan myself.



  • JavaFX? Isn't that the toolkit oracle blacklisted for being a security hole?


  • Discourse touched me in a no-no place

    @Weng said:

    Every time I bump up against Java, I see nothing and meet nobody to contradict that statement.

    There are the good bits and the bad bits. I've yet to see any evidence that any of the Java GUI stuff ever makes it out of “the bad bits” (and yes, I've written a few Java GUI programs over the years). Spring's good though; it lets you stop worrying about how to build and hook up all the objects and instead focus on what they do.


  • Discourse touched me in a no-no place

    @PleegWat said:

    JavaFX? Isn't that the toolkit oracle blacklisted for being a security hole?

    Not that I am aware of; it's currently in the 8u40 JDK.



  • @PleegWat said:

    JavaFX? Isn't that the toolkit oracle blacklisted for being a security hole?

    I would be surprised. JavaFX is supposed to be the Next Big ThingTM1 in Java.


    1 Couple of years back I've actually worked on a project with internal name “Next Big Thing”. Yes, it was a pile of crap in unsuitable crappy technology (well, we did our best, but the technology didn't want to let us get away with good design). It was a prototype only fortunately.



  • If I were to create desktop apps in Java, I'd seriously take a look at SWT. It seems to be the only modern Java toolkit that uses standard OS widgets (although it does fake the ones that are missing on a particular OS). It started out as IBM's answer to Swing.

    @PleegWat said:

    JavaFX? Isn't that the toolkit oracle blacklisted for being a security hole?

    Since JavaFX is Swing's replacement, I really doubt Oracle would kill it.

    Starting with Java 8, it's shipped as part of Java and was renumbered to indicate this (JavaFX went from 2.2 to 8).



  • It supports Motif. what the fuck.

    This is why I write UIs in C#...


  • Discourse touched me in a no-no place

    @powerlord said:

    If I were to create desktop apps in Java, I'd seriously take a look at SWT. It seems to be the only modern Java toolkit that uses standard OS widgets (although it does fake the ones that are missing on a particular OS).

    It's also problematic in a few key ways, most notably that it's the Java widget toolkit most likely to crash and take your process with it without a by-your-leave. Having had that happen on me a few times, it's not something you really want to repeat. It also requires that you distribute code with native libraries incorporated in it, which can be problematic in some environments.

    These facts are not unconnected. ;)



  • @dkf said:

    It's also problematic in a few key ways, most notably that it's the Java widget toolkit most likely to crash and take your process with it without a by-your-leave. Having had that happen on me a few times, it's not something you really want to repeat. It also requires that you distribute code with native libraries incorporated in it, which can be problematic in some environments.

    These facts are not unconnected. ;)

    The latter would also be a problem for Swing and JavaFX... if those libraries weren't already distributed with the JDK.

    Of course, JavaFX still requires it if the person is still on Java 7 or below.


  • Discourse touched me in a no-no place

    @powerlord said:

    The latter would also be a problem for Swing and JavaFX... if those libraries weren't already distributed with the JDK.

    Not precisely. The core drawing API of Java2D is native (and has to be!) but Swing isn't; it's built on Java2D and the (venerable, old, long-in-the-tooth) AWT.



  • Been there fixed that in Linux.

    do_start () {
        local path="lib/*"
        local opts=""
    
        # This is so we can restart the app
        local exit_code=10
        while [ $exit_code -eq 10 ]; do
            "${JAVA_HOME}/bin/java" ${opts} -cp "${path}" jobhunter.gui.MainApp > /dev/null 2>&1
            exit_code=$?
        done
        if [ $exit_code -ne 0 ]; then
             zenity  --info --text="Aw, JobHunter crashed. Check the logs... or restart."
        fi
    }
    

    Maybe it could show the last stack trace, but that would take some Java developer to understand it.


  • Discourse touched me in a no-no place

    @Eldelshell said:

    Maybe it could show the last stack trace, but that would take some Java developer to understand it.

    And even then, not necessarily. At least GUI stack traces are mostly short; the monsters out of JEE apps can be quite amazingly long. I sometimes wish that Java compilers would do tailcall optimisation more frequently (e.g., when you've got a chain of a method to another one with the same name in the same class) just to keep the stack traces a bit shorter…



  • This post is deleted!

Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.