Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Exported Eclipse Oxygen Jar not running

Options
  • 15-05-2018 11:32am
    #1
    Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,240 Mod ✭✭✭✭


    So as the title says, I wrote a small app to grab a file from an FTP and mail it to myself. Not an app for sh and giggles, it will serve a purpose eventually.

    However, I have tested it, runs perfectly, no errors or warnings at all. I exported it as a runnable Jar in Eclipse Oxygen. My problem is, the Jar does not run whatsoever. Tried recompiling and creating the Jar in the command prompt. Using Windows 10. Never had an issue generating and running Jar files before.

    I swear I checked everything. Updated the JDK and JRE from 8 to 10. Cleared out old settings and reinstalled Eclipse just in case a configuration went horribly wrong somewhere.

    Still nothing. Anyone experience a similar issue exporting and running Jar files? I don't particularly fancy installing another IDE and exporting Jars that way.


Comments

  • Moderators, Sports Moderators, Regional Abroad Moderators Posts: 2,639 Mod ✭✭✭✭TrueDub


    L.Jenkins wrote: »
    So as the title says, I wrote a small app to grab a file from an FTP and mail it to myself. Not an app for sh and giggles, it will serve a purpose eventually.

    However, I have tested it, runs perfectly, no errors or warnings at all. I exported it as a runnable Jar in Eclipse Oxygen. My problem is, the Jar does not run whatsoever. Tried recompiling and creating the Jar in the command prompt. Using Windows 10. Never had an issue generating and running Jar files before.

    I swear I checked everything. Updated the JDK and JRE from 8 to 10. Cleared out old settings and reinstalled Eclipse just in case a configuration went horribly wrong somewhere.

    Still nothing. Anyone experience a similar issue exporting and running Jar files? I don't particularly fancy installing another IDE and exporting Jars that way.

    Rather than doing it through an IDE, why not look at using something like Maven?

    Pros: standard build processes, lots of tooling, supported by all major IDEs, lots & lots of examples & tutorials

    Cons: learning curve, might be excessive for a very simple jar

    I simply wouldn't start a new app these days without Maven.
    L.Jenkins wrote: »
    grab a file from an FTP and mail it to myself.

    ???? Really? Once you've grabbed it, wouldn't you save it somewhere instead of then mailing it?


  • Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,240 Mod ✭✭✭✭L.Jenkins


    TrueDub wrote: »
    Really? Once you've grabbed it, wouldn't you save it somewhere instead of then mailing it?

    What I'm doing is downloading a generated file from a web service we have running, the file passes through a checks and balances system for correctness, then gets mailed onto a client, who we don't share an FTP with.

    The less time I have to spend interacting with these people, the better.


  • Moderators, Sports Moderators, Regional Abroad Moderators Posts: 2,639 Mod ✭✭✭✭TrueDub


    L.Jenkins wrote: »
    What I'm doing is downloading a generated file from a web service we have running, the file passes through a checks and balances system for correctness, then gets mailed onto a client, who we don't share an FTP with.

    The less time I have to spend interacting with these people, the better.

    Ah right, the mailing is not ultimately to yourself, makes sense now.


  • Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,240 Mod ✭✭✭✭L.Jenkins


    So the issue is, I'm using Java Mail to send the file and I've attached the output from the cmd when I run java -jar time.jar.

    The output is in the picture attached. I may be using the api wrong.

    450869.JPG


  • Registered Users Posts: 4,758 ✭✭✭cython


    L.Jenkins wrote: »
    So the issue is, I'm using Java Mail to send the file and I've attached the output from the cmd when I run java -jar time.jar.

    The output is in the picture attached. I may be using the api wrong.

    450869.JPG

    Seems like it might be a widespread enough issue, with suggestions of the DataSource interface having been removed (or at least not loaded by default) in Java 9 as well. https://github.com/rpremraj/mailR/issues/77 is just one such issue.


  • Advertisement
  • Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,240 Mod ✭✭✭✭L.Jenkins


    It's interesting because, the script runs fine without issue in the IDE. No errors or warnings whatsoever in the code itself. No when I generate the Jar, I've used Eclipse, Netbeans and IntelliJ, the issue mentioned arises.

    I've spend a fair few hours looking for a solution to the problem with no joy, so I took my own, different approach to the problem. Instead of creating a scheduled task to run a Jar from Monday to Friday at 10am since the Jar won't run, I redeveloped it in C#.

    Relatively simple to implement the functionality without the need to import additional dlls, compiled and published the script, created a .bat file and used that in the scheduled task instead.

    Don't get me wrong, I love java, but sometimes it makes things a little too complicated or awkward in trying to do the simplest of things. For example, I don't know why things like Java Mail aren't packaged in the latest JRE. I assume that sending a mail might be more common than the occasional script.


  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice


    Its hardly something obvious like a classpath issue is it?


  • Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,240 Mod ✭✭✭✭L.Jenkins


    I've tried that when running the script. Checked the class path in multiple IDEs. Still has a fit when I try to run the Jar. So as I mentioned, I took a different approach to the problem. A possible solution probably exists out there somewhere, but I'm too pressed for time to go looking any further than I already have.


  • Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,240 Mod ✭✭✭✭L.Jenkins


    I think the primary issue I've seen arise in multiple requests for an answer is the DataSource Class in the Java Mail Jar. Didn't have time to create a work around though. Might be something to contribute to later editions of the Jar going forward when I do.


  • Registered Users Posts: 4,758 ✭✭✭cython


    L.Jenkins wrote: »
    I think the primary issue I've seen arise in multiple requests for an answer is the DataSource Class in the Java Mail Jar. Didn't have time to create a work around though. Might be something to contribute to later editions of the Jar going forward when I do.

    Have you thoroughly checked out the areas I mentioned earlier? JavaMail has an FAQ around javax.activation classes not being loaded by default on Java 9 and later, due to the more modular nature arising from Project Jigsaw: https://javaee.github.io/javamail/FAQ#jdk9-jaf

    So try adding --add-modules java.activation to the java command when executing the jar. Your descriptions are unclear as to where this particular error arose on Java 8 as well, or just following upgrade to 9 or later.


  • Advertisement
Advertisement