0

When I launch Myapp.jar - works fine. But when I use ant + app bundler and + jar bundler and make Myapp.app with those folders like MacOS, Java, Resources and Plugin, then it gives me Exceptions:

`Myapp.app`/Contents/MacOS/JavaAppLauncher ; exit;
Exception in Application start method
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at 

com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)

        at

 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at `enter code here`sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
    at c$launchApplication$155(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: ./src/config/config.txt (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.io.FileInputStream.<init>(FileInputStream.java:93)
    at java.io.FileReader.<init>(FileReader.java:58)
    at doelist.DoeList.start(DoeList.java:159)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    at 

com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    Exception running application doelist.DoeList
    logout
    Saving session...
    ...copying shared history...
    ...saving history...truncating history files...
    ...completed.

[Process completed]

What to do? How deploy jar program with scr folder(classes in it, with additional folders). Exception show problem in BufferedReader("scr/config/config.txt"); But when I run jar - there no exceptions. It finds scripture and config.txt.

Exceptions occur in lines:

BufferedReader br = new BufferedReader(new FileReader("src/config/config.txt"));
Kolia
  • 17
  • 7
  • 1
    Post the code that is throwing the exception. In general, you should be reading from a *resource*, not a file (since your `config.txt` will be an element in the jar file, not an actual file on the file system). See the related https://stackoverflow.com/questions/34755630/javafx-location-is-not-set-error – James_D Aug 16 '17 at 18:19
  • I add line with error, I made program with NetBeans IDE, does there is exist resources folder? Thanks. I am in trouble. I need everything which relate to reading a file move to resources? Did you deploy jar to Mac OSX? – Kolia Aug 16 '17 at 23:22
  • Switch to an [tag:embedded-resource], for [example](https://stackoverflow.com/tags/embedded-resource/info). – trashgod Aug 17 '17 at 00:37
  • Possible duplicate of [FileNotFoundException using Notepad](https://stackoverflow.com/questions/38325430/filenotfoundexception-using-notepad) – nllsdfx Aug 18 '17 at 13:37

0 Answers0