When Coding Goes Wrong: Frustrated coder considers writing Java GUI
-
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.
-
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
-
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
-
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.
-
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?
-
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.
-
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.
-
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.
-
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".
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.
-
"Access restriction: The type 'Application' is not API (restriction on required library 'D:\apps\Java64\jre8u40\lib\ext\jfxrt.jar')"
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.
-
Right?
The "solution" seems to be "Eclipse or Java got confused. Delete 'JRE System Library' from the build path and then add it back".
-
...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.
-
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.
-
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.
-
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.
-
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
-
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.
-
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.
-
Meh, not that big a deal in the long run.
-
Desktop Java GUIs are the worst of the worst.
-
Meh, not that big a deal in the long run.
"Well," he said, in a slightly aggrieved tone, "now, I know that."
-
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.
-
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.
-
my black list.
-
IT's a little disappointing that Discurse kills animated gifs.
-
Really?
-
I would swear the gif was animated when I copied it.
Oh, maybe Chrome's right-click-copy-image killed the animation.
-
Yeah, it pastes the first frame as a PNG
-
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?
-
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.
-
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.
-
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.
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#...
-
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. ;)
-
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.
-
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.
-
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!