Fehler beim Ausführen von Javafx -Code von Windows auf dem MacJava

Java-Forum
Anonymous
 Fehler beim Ausführen von Javafx -Code von Windows auf dem Mac

Post by Anonymous »

Während eines Universitätsprojekts entwerfen ich und mein Team zum ersten Mal ein Javafx -Programm. Wir sind auch nicht sehr mit Java vertraut. Ich bin auf MacOS und der Rest des Teams verwenden Windows 11. Wir verwenden Intellij. Ein Mitglied seines Teams gründete das Projekt und startete die GUI. Dann schob er es auf Github. Alle anderen, das das Projekt, das es gezogen hat, hat gut funktioniert (ich bin mir nicht sicher, ob sie die Javafx -Bibliothek zuerst auf der IDE importieren mussten, oder es hat sofort funktioniert, aber ich habe auch versucht, die Mac -Version der Bibliothek herunterzuladen und ich denke, dass ich sie richtig importiert habe). Wenn ich versuche, den Code auszuführen, erhalte ich diese Fehler.

Code: Select all

WARNING: Timeout while waiting for app reactivation
Apr 13, 2025 11:53:00 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 23.0.1 by JavaFX runtime of version 17.0.6
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '0x0 is an invalid NSTrackingRectTag. Common possible reasons for this are: 1. already removed this trackingRectTag, 2.  Truncated the NSTrackingRectTag to 32bit at some point.'
*** First throw call stack:
(
0   CoreFoundation                      0x000000018f36ddf0 __exceptionPreprocess + 176
1   libobjc.A.dylib                     0x000000018ee32b60 objc_exception_throw + 88
2   Foundation                          0x0000000190696a78 -[NSCalendarDate initWithCoder:] + 0
3   AppKit                              0x00000001937e5290 -[_NSTrackingAreaAKViewHelper removeTrackingRect:] + 200
4   libglass.dylib                      0x000000012070ef7c Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 3456
5   libglass.dylib                      0x0000000120714074 RemoteLayerHostRemoteIdInLocal + 3620
6   AppKit                              0x0000000192f8617c -[NSView setFrame:] + 300
7   libglass.dylib                      0x00000001207140d4 RemoteLayerHostRemoteIdInLocal + 3716
8   AppKit                              0x0000000192f92b88 -[NSView resizeWithOldSuperviewSize:] + 488
9   AppKit                              0x0000000192f92524 -[NSView resizeSubviewsWithOldSize:] + 360
10  AppKit                              0x0000000192f789ac -[NSView setFrameSize:] + 948
11  AppKit                              0x0000000192f8617c -[NSView setFrame:] + 300
12  AppKit                              0x0000000192f92b88 -[NSView resizeWithOldSuperviewSize:] + 488
13  AppKit                              0x0000000192f92524 -[NSView resizeSubviewsWithOldSize:] + 360
14  AppKit                              0x0000000192f789ac -[NSView setFrameSize:] + 948
15  AppKit                              0x0000000192f9167c -[NSThemeFrame setFrameSize:] + 244
16  AppKit                              0x0000000192f90fe4 -[NSWindow _oldPlaceWindow:fromServer:] + 532
17  AppKit                              0x0000000192f90458 -[NSWindow _setFrameCommon:display:fromServer:] + 1988
18  libglass.dylib                      0x000000012071f0c4 Java_com_sun_glass_ui_mac_MacWindow__1setBounds2 + 416
19  ???                                 0x0000000111fe8fd4 0x0 + 4596862932
20  ???                                 0x0000000111fe5110 0x0 + 4596846864
...
42  ???                                 0x0000000111fe56b0 0x0 + 4596848304
43  ???                                 0x0000000111fe0114 0x0 + 4596826388
44  libjvm.dylib                        0x000000010163dd60 _ZN9JavaCalls11call_helperEP9JavaValueRK12methodHandleP17JavaCallArgumentsP10JavaThread + 600
45  libjvm.dylib                        0x000000010169a114 _ZL20jni_invoke_nonstaticP7JNIEnv_P9JavaValueP8_jobject11JNICallTypeP10_jmethodIDP18JNI_ArgumentPusherP10JavaThread + 644
46  libjvm.dylib                        0x000000010169da28 jni_CallVoidMethod + 212
47  libglass.dylib                      0x000000012070a998 JNI_OnLoad + 204
48  Foundation                          0x0000000190601f74 __NSThreadPerformPerform + 264
49  CoreFoundation                      0x000000018f2fcde4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
50  CoreFoundation                      0x000000018f2fcd78 __CFRunLoopDoSource0 + 172
51  CoreFoundation                      0x000000018f2fcae4 __CFRunLoopDoSources0 + 232
52  CoreFoundation                      0x000000018f2fb738 __CFRunLoopRun + 840
53  CoreFoundation                      0x000000018f2fad68 CFRunLoopRunSpecific + 572
54  HIToolbox                           0x000000019aaab27c RunCurrentEventLoopInMode + 324
55  HIToolbox                           0x000000019aaae4e8 ReceiveNextEventCommon + 676
56  HIToolbox                           0x000000019ac39484 _BlockUntilNextEventMatchingListInModeWithFilter + 76
57  AppKit                              0x0000000192f4dab4 _DPSNextEvent + 684
58  AppKit                              0x00000001938eacd4 -[NSApplication(NSEventRouting)  _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
59  AppKit                              0x0000000192f40c64 -[NSApplication run] + 480
60  libglass.dylib                      0x000000012070cb20 JNI_OnLoad + 8788
61  Foundation                          0x0000000190601f74 __NSThreadPerformPerform + 264
62  CoreFoundation                      0x000000018f2fcde4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
63  CoreFoundation                      0x000000018f2fcd78 __CFRunLoopDoSource0 + 172
64  CoreFoundation                      0x000000018f2fcae4 __CFRunLoopDoSources0 + 232
65  CoreFoundation                      0x000000018f2fb738 __CFRunLoopRun + 840
66  CoreFoundation                      0x000000018f2fad68 CFRunLoopRunSpecific + 572
67  libjli.dylib                        0x000000010015726c CreateExecutionEnvironment + 400
68  libjli.dylib                        0x0000000100153344 JLI_Launch + 1128
69  java                                0x0000000100117bac main + 392
70  dyld                                0x000000018ee72b4c start + 6000
)
libc++abi: terminating due to uncaught exception of type NSException
< /code>
(Entschuldigung für den Spam der Fehlermeldung) < /p>
Der Fehler, der besagt, dass die Versionen nicht übereinstimmen, erscheint auch auf anderen, aber das Programm funktioniert einwandfrei, sodass ich nichts damit zu tun hat. Ich habe versucht,  Primärstage zu entfernen. Hier ist die Hauptklasse. Ich habe nur eine andere Datei mit Controllern usw. < /p>

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;

public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Homepage.fxml"));
Scene scene = new Scene(root);

// Set a default size before maximizing
primaryStage.setWidth(1280);
primaryStage.setHeight(720);

// Optional: center the window before maximizing
primaryStage.centerOnScreen();

// Add listener to handle when maximized is changed
primaryStage.maximizedProperty().addListener((obs, wasMaximized, isNowMaximized) -> {
if (isNowMaximized) {
// You can check screen bounds and ensure it doesn't exceed a max
javafx.geometry.Rectangle2D screenBounds = javafx.stage.Screen.getPrimary().getVisualBounds();
if (screenBounds.getWidth() < 1280 || screenBounds.getHeight() < 720) {
// If the screen is too small, don't maximize; instead, set default size
primaryStage.setMaximized(false);
primaryStage.setWidth(1280);
primaryStage.setHeight(720);
primaryStage.centerOnScreen();
}
}
});

primaryStage.setScene(scene);
primaryStage.setMaximized(true);
primaryStage.show();
}

public static void main(String[] args) {
launch();
}
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post