SWT: JavaCocoaComponent compatiblity mode doesn't allow application to exit cleanly - java

I have a SWT application running on Mac(10.6.8). The SWT version I am using is swt-4.2.2-cocoa-macosx-x86_64.zip. My application doesn't exit properly when I call parent.getShell().close() , the UI disappears from the screen but the icon remains in the dock and hence it hasn't terminated cleanly.
I don't want to use System.exit(0) as I am doing some background processing even after the application closes in certain cases.
Is this due to the "JavaCocoaComponent compatiblity mode-Enabled" message I get when I launch my application.
How can I avoid this message and make my application exit cleanly?
I have tried using the swt-4.3 jar and ended up with the same result.
Note: I am also facing this issue when I run my application(jar) outside eclipse.
Any help provided will be greatly appreciated.
Thanks
Java Version Used: 1.6 update 51
Eclipse Version Used: Juno SR 2
Other jars used in my application
json_simple-1.1.jar
org.eclipse.core.commands_3.6
org.eclipse.equinox.common_3.6
org.eclipse.jface_3.6

Related

Using WindowBuilder in a Java Swing and JavaFX interoperability context seems to cause Eclipse to crash?

The problem: I strongly suspect WindowBuilder makes my Eclipse crashing under certain conditions. These conditions are:
the class you're working on it using the design tab has to contain some references to a JavaFX code
first time you design such class it's all good. Second time you click on design tab of another class of that kind, or click on "Reparse source and refresh design page" icon inside the design view of the first class, Eclipse crashes. Essentially, parsing the code of such classes for a second time is where it crashes.
My context: I'm coding a gui hangman game using Swing and JavaFX libs. I'm aware of the conditions for interoperability between these two guys.
I'm using Eclipse IDE for Java Developers Version: 2021-12 (4.22.0) (the current one the installer installs on your computer). The JDK 17.0.1 (installer on Oracle site for Windows x64) and I'm on Windows 10 x64.
Enviroment variables (JAVA_HOME and PATH_TO_FX) and Eclipse project settings (non modular project is my case) should be ok: my code is compiled, my program runs without troubles, I see the gui and everything is where it should be and working. But to be sure I've tried to reproduce the crash with the code of more experienced people of me for sure (article link, repository link) and it crashes in the same way. I'm gonna post my code if required of course.
I'm using WindowBuilder 1.9.8, the last good build, cause a bug me and other people have encountered (see here, here and here) has been fixed there. Anyway, it crashes even with previous versions.
I'm gonna post a bunch of additional info about logs and crash reports, please skip it to the end if you think there's no need of additional info.
I'm running Eclipse with the -consoleLog parameter in the .ini file to have the log in a shell window at runtime. This is the relevant part of the log once it ends to load Eclipse:
java.lang.Error: SWT Resource was not properly disposed
and this is what it says when I click on the design tab of a JavaFX referenced class:
com.sun.javafx.application.PlatformImpl startup WARNING: Unsupported
JavaFX configuration: classes were loaded from 'unnamed module
#3d79168b'
but as I said, my project settings should be ok: running configurations -> java application -> main class -> vm arguments:
--module-path ${PATH_TO_FX} --add-modules=javafx.graphics,javafx.controls,javafx.fxml,javafx.base,javafx.media,javafx.web,javafx.swing
Yes, I know there's no need to load all modules, but just to be sure. And yes, I've even read this, but seems like I'm getting this warning anyway.
When I click on the "Reparse source and refresh design page" icon inside the design view, It freezes and have to terminate the process. The crash report says:
"Java was started but returned exit code= -8053063696"
So I looked for it, found this, tried everything (even to unistall the jdk, eclipse including the .p2 folder), but still the same problem
When I try to open the design tab on another JavaFX related class the crash report is different:
"Java was started but returned exit code= 1"
So I've read this, but my enviroment variables should be properly setted and everything should be correctly installed. I've even edit the .ini file to add the reference to the Java Virtual Machine dll, but still the same problem.
My question: can you reproduce this crash? There's a fix or I'm doing something wrong?
p.s.
I'm getting the "Wait! Some of your past questions have not been well-received, and you're in danger of being blocked from asking any more." warning here on stackoverflow :( I've read this and I hope this question it's ok

Eclipse 2018-12 with JDK1.8 UI freezes

I am running Eclipse 2018-12 on a Windows 7 (VM) along with a JDK 1.8.0_121, as a runtime for the IDE and as JDK to build my bundles.
I am already through a couple of re-installations. Yesterday it happened again: The IDE freezes completely, not returning to be responsive even after waiting for several minutes.
Sometimes the wait cursor disappears and it seems to be responsive, but the first click anyway let the IDE return to its freeze mode.
What I did right before was a massive update of the underlying workspace through a git pull. Probably thousands of new deleted and changed files.
I've tried to start the IDE with "-clean" option.
I've created a new workspace, was able to do a couple of clicks here and there, UI freeze again.
I had the same thing with Eclipse 2019-03 and wasn't able to solve it, so I thought 2018-12 was a little more stable concerning this issue.
Is there a known issue with Eclipse-with-GIT?
Any ideas about how to get the IDE working again?
Is that probably 2018-12/2019-03 specific?

Java Swing applications not opening in NetBeans

I have been having some major issues when I try to run a new Swing application. I am using NetBeans 8.1, JDK version 1.8 and OS Windows 10.
So every time I try to open a new Swing project (doesn't matter if it's just the app project or an EA) and I run it, NetBeans deploys it correctly but the Swing window doesn't open and in the status bar of NetBeans it just shows running. I wait for several minutes and then I have to stop the build because nothing happens. When I faced this situation before I uninstalled NetBeans and Java and reinstall them, and it's fixed. But I don't want to uninstall and install everything again when I want to open a new project. I am right now learning about Swing. If that project has a Web version, it works fine. I've put my laptop on Airplane mode so WiFi is disabled (a friend told me to do this) but with no luck.
So this is my IDE and it says "Running" in the status bar when I run the project using the Swing project, but the application window is not opened
enter image description here
You should debug this application, maybe one line code is error or not complete, ... can stop your application. This status bar show is running maybe your application not dispose then it still running

Eclipse JEE Mars.2 Inspect not working

I was previously using Jboss Dev Studio (based on an older version of Eclipse) in Windows and was able to execute selected code using the shortcut Ctrl+Shift+I (when I hit a breakpoint in debug mode). A popup would appear with the result of the execution, which was extremely helpful.
I just setup Mars.2 JavaEE (4.5.2) to start a different project and am finding that this command no longer works. Under preferences->general->keys I definitely have the same shortcut (Inspect = Ctrl+Shift+i) but when I use that command, it simply obliterates the selected code and replaces it with a space! Has anyone else encountered this?
Thanks in advance.

Error: Running JavaFX Appl outside Netbeans

everyone!
Here's the thing, I've been developing a JavaFX application with JDK 7u17 (That's the one Netbeans is compilling it, anyways) and I haven't had any problem testing it and running it through Netbeans itself. I simply click Run and it goes smoothly.
I'm creating the .jar files and the other (html, jnlp) through Clean-Build using Netbeans and the app does open perfectly when I execute the Jar.
The problem is when I try to navigate through the App, the app consists of 4 scenes (Login, Main, Search and Create) with me being able to log-in and head to the main scene but that's about it. The buttons to go to the search scene or create scene don't do anything nor I get an error saying something crashed (note I'm not using the console since I don't even know how to make it appear in runtime). I simply click them and they do nothing.
As I said earlier, the app runs perfectly when it's ran through Netbeans.
Some more info:
Netbeans Version: 8.0
Compilling Version through Netbeans: 1.7u17
Existing Java versions on System: 1.8u25, 1.7u67 and 1.7u17 (I already tried enabling only 1.7u17)
The App used FXML to switch between Scenes, it works great between LogIn and Main scenes.
What could it possibly be that it works great using Netbeans and break outside Netbeans?
EDIT #1:
According to the console (Thanks to #janih) I'm running Java version 1.7u17, same as Netbeans and it looks like it's working properly. The problem persists when I'm trying to run the same jar by simply doubli clicking it. It stops showing me controls (Third party controls).
I'm not sure but it could be this:
I was trying to run a project through the given .jar and had those results but that very Project was a plain JavaFX Project, not exactly JavaFX FXML Project and my Project uses FXML files to change between Scenes. What I did is redo the Project in FXML and worked perfectly.
Special thanks to #janih for the help.

Categories

Resources