diff --git a/build.gradle.kts b/build.gradle.kts index 86d65d3..d6444cb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,7 @@ plugins { + id("application") id("java") + kotlin("jvm") version "1.9.22" } group = "org.jdetect" @@ -17,4 +19,16 @@ dependencies { tasks.test { useJUnitPlatform() -} \ No newline at end of file +} + +sourceSets { + main { + resources { + srcDir("src/main/resources") + } + } +} + +application { + mainClass.set("org.jdetect.MainApp") +} diff --git a/src/main/java/org/jdetect/MainApp.java b/src/main/java/org/jdetect/MainApp.java index 369dcf5..59ce972 100644 --- a/src/main/java/org/jdetect/MainApp.java +++ b/src/main/java/org/jdetect/MainApp.java @@ -71,6 +71,7 @@ public class MainApp extends JFrame { } public static void main(String[] args) { + System.out.println("it runs?"); try { SwingUtilities.invokeAndWait(() -> { try { diff --git a/src/main/java/org/jdetect/ModelLoader.java b/src/main/java/org/jdetect/ModelLoader.java index c1784ea..f067fc3 100644 --- a/src/main/java/org/jdetect/ModelLoader.java +++ b/src/main/java/org/jdetect/ModelLoader.java @@ -26,9 +26,14 @@ public class ModelLoader { InputStream weightsStream = ModelLoader.class.getResourceAsStream("/yolov4-tiny.weights"); InputStream configStream = ModelLoader.class.getResourceAsStream("/yolov4-tiny.cfg"); - assert weightsStream != null; + if (weightsStream == null) { + throw new IOException("Could not find yolov4-tiny.weights in classpath"); + } byte[] weights = weightsStream.readAllBytes(); assert configStream != null; + if (configStream == null) { + System.err.println("Could not find yolov4-tiny.cfg in classpath"); + } byte[] config = configStream.readAllBytes(); // Create temp files