我正在尝试Oracle网站上的JavaFX教程[fxml tutorial](http://docs.oracle.com/javase/8/javafx/get-started-tutorial/fxml_tutorial.htm).
package fxml;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
class Main extends Application {
public Main() {}
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("welcome.fxml"));
Scene scene = new Scene(root);
stage.setTitle("FXML UI");
stage.setScene(scene);
stage.show();
}
public static void main(String args[]) {
launch(args);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我不断得到的例外.应用程序未显示在屏幕上.我从另一个堆栈溢出答案做了非args Main()构造函数,但它没有修复它.
Exception in Application constructor
Exception in thread "main" java.lang.RuntimeException: Unable to construct Application instance: class fxml.Main
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:884)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
at …Run Code Online (Sandbox Code Playgroud) 分段错误发生在函数un()中,它返回两个数组的并集.
但这里是完整的代码以防万一.我尝试在un()中添加一些print语句,但它仍然显示Segmentation fault而没有其他内容.
我正在使用GCC.
#include <stdio.h>
#include <stdlib.h>
void input_set(int* set, int size) {
int i;
for(i = 0; i < size; i++) {
scanf("%d", set+i);
if(i != 0 && set[i] == set[i-1]) {
printf("A set cannot have repeated values. Enter again!\n");
i--;
}
}
}
void display_set(int *set, int size) {
int i;
printf("{ ");
for(i = 0; i < size-1; i++)
printf("%d, ", set[i]);
printf("%d }\n\n", set[size-1]);
}
int* difference(int *setA, int sizeA, int *setB, int sizeB, int …Run Code Online (Sandbox Code Playgroud)