Results 1 to 7 of 7
  1. #1
    buggedup is offline Member
    Join Date
    Apr 2011
    Posts
    19
    Rep Power
    0

    Default Make a runnable jar of my project in Eclipse

    I have a Java swing project which i need to test on other computers. I have some classes and a sqlite db which stores login information. I have some lib jars as well. The application takes information from the user and stores it in the sqlite db and then pushes data to the web. I want to package my project so that whoever uses my project has to just double click on an executable or jar. Here is my folder structure -

    Java Code:
    root
      >src
          >default package
          >rest package
          >images
      >lib
      >file.fcl
      >db.sqlite

    I tried to Export to a Runnable Jar file in Eclipse but this does not give desired results. After the runnable jar is created and i run it for the first time it creates the sqlite db beside it and is not able to read the fcl file.

    How can i package my data properly?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,931
    Rep Power
    19

    Default Re: Make a runnable jar of my project in Eclipse

    If the sqllite db needs to be written to (and your requirements imply it is) then you will need to copy the db file from the jar to the machine.
    What's the fcl file?
    What error do you get trying to read it?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    buggedup is offline Member
    Join Date
    Apr 2011
    Posts
    19
    Rep Power
    0

    Default Re: Make a runnable jar of my project in Eclipse

    After the user provides user creds it gets written to the sqlite db. As i told after creating the runnable jar, if i execute it it creates a db.sqlite file beside it and pushes login data into it.
    I am using a java fuzzy logic controller package. This package has a fcl file which it reads to generate a factor. This fcl file has all the fuzzy rules. After i create the jar file from the Export -> Java -> Runnable Jar File, and try to execute it from cmd by java -jar app.jar, the execution hangs after login credentials are provided and throws error -
    Error reading file 'file.fcl'
    Cant load file 'file.fcl'

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,931
    Rep Power
    19

    Default Re: Make a runnable jar of my project in Eclipse

    Then somewhere you (or a package you are using) is not printing the stack trace on an exception properly.
    Without it you will be left to guess what the problem with the fcl file is.

    For the SQL Lite db then, I take it this is working OK? Because that's what I would expect your app to do with a writeable database.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    buggedup is offline Member
    Join Date
    Apr 2011
    Posts
    19
    Rep Power
    0

    Default Re: Make a runnable jar of my project in Eclipse

    I had thought migrating into a runnable jar in Eclipse would include all the files in the project except the java code. That is why i was expecting that the sqlite and the fcl file would be included within the jar. But i think it is not. I wanted the application to write into the sqlite db which should be within the jar itself. But if thats not possible then the additional sqlite file beside the jar is also fine.
    I also tried to keep the file.fcl in the folder but to no good. This runs fine in Eclipse but i dont know why it is not if i make a runnable jar. Is there any alternative ?

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,848
    Rep Power
    5

    Default Re: Make a runnable jar of my project in Eclipse

    Why guess? Open the jar in your favorite zip tool and see for yourself.

    The database can be in the jar - but then you can't write to it. If you want to write to your database you'll have to copy it out of the jar ("unpack" if you will) to the local file system. Or create a database from scratch in stead of pre-packaging it in your jar.

  7. #7
    buggedup is offline Member
    Join Date
    Apr 2011
    Posts
    19
    Rep Power
    0

    Default Re: Make a runnable jar of my project in Eclipse

    ya opened the jar file in Winrar. I have an org folder which contains a sqlite folder. But i could not find my db.sqlite anywhere. Moreover could not find the file.fcl as well :(

Similar Threads

  1. Replies: 3
    Last Post: 05-07-2012, 06:07 PM
  2. Trying to make runnable jars
    By mwr1976 in forum New To Java
    Replies: 18
    Last Post: 04-16-2012, 02:24 PM
  3. Runnable Jar Export cant make more than one JFrame
    By oinca in forum Advanced Java
    Replies: 5
    Last Post: 12-29-2011, 06:48 PM
  4. Can not make a runnable jar of my project
    By liran in forum Advanced Java
    Replies: 5
    Last Post: 05-18-2010, 11:25 AM
  5. How to make a runnable jar with necessary libraries
    By Atriamax in forum New To Java
    Replies: 2
    Last Post: 10-27-2009, 10:36 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •