Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 45
  1. #21
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    I followed all the steps described to create a jar file containing external jar files.

    While creating the jar file manually I copied the external jars into a folder lib and use that in Class-Path attribute..

    The manifest file that I created is exactly same as that generated by NetBeans. In both the problem is same.. The jar file is executing only in the current location.

  2. #22
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    It should work pal. I've followed the same way in large number of times. At leas that dist folder content should work, even in another location, after extracting the jar file into the dist folder.

  3. #23
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    Yes.There is lib folder containing all the external jars for my application.

    The manifest file I created manually and the one generated by the NetBeans are same.I copied the jar files into a folder lib and used that path as Class-Path attribute value.

    Both jar files-that I created and Netbeans created -have the same problem..They can execute only in the location where they are created.

  4. #24
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by gowry View Post
    Both jar files-that I created and Netbeans created -have the same problem..They can execute only in the location where they are created.
    Sorry if I asking the same thin and dump you. In the different location did you try it by extracting the jar which is in the dist folder. Not the jar file create. :rolleyes:

  5. #25
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    Yes.. extracted the jar in the dist folder in another location and execute.thats giving an exception like class in the external jar file not found..

    In the manifest file everything is fine.its having the main class name and class path..

    If I copied the dist folder and execute the jar.its working.. I think its because the lib folder is within it and so.

  6. #26
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    No I think still you are not doing what I say.

    Now you have a dist folder, which contain a jar file and the folder called 'lib' and README.txt file. Now copy that dist folder to separate location. Say D:\Temp\


    Still that dist folder contain lib folder, text file and jar file.

    In that point, execution of the jar file is not work.

    Then extract the jar file to same folder, I mean to dist folder. Now you have followings in the dist folder.

    1. lib folder
    2. README.txt file
    3. jar file which has the name of your project
    4. META-INF folder
    5. Another folder which has the same name as your project.

    Is that right?

  7. #27
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    No I think still you are not doing what I say.

    Now you have a dist folder, which contain a jar file and the folder called 'lib' and README.txt file. Now copy that dist folder to separate location. Say D:\Temp\?

    Still that dist folder contain lib folder, text file and jar file.

    In that point, execution of the jar file is not work.
    Copied dist to D:\temp and execute it there using

    java -jar jarfile.

    Its working..

    The exception occures when am
    move the jarFile from dist to D:\temp and try to execute the jar file at D:\temp.



    Quote Originally Posted by Eranga View Post

    Then extract the jar file to same folder, I mean to dist folder. Now you have followings in the dist folder.

    1. lib folder
    2. README.txt file
    3. jar file which has the name of your project
    4. META-INF folder
    5. Another folder which has the same name as your project.

    Is that right?
    yes.

  8. #28
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by gowry View Post
    The exception occures when am
    move the jarFile from dist to D:\temp and try to execute the jar file at D:\temp.
    Just only jar file moving to another location it's not work. It simply destroyed the folder structure of the package. Moving whole dist folder and do stuff is the way to do.

  9. #29
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    Ohhhhhh NO..

    That means I was wasting ur time for the last two days ..

    Sorry.. :(

  10. #30
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Don't worry. In most the things we have learn after doing the wrong things in thousand times. I like to let others what I know ;)

    Now what happened. Is it ok.

  11. #31
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    Yes. its working within the dist folder.

    Thank You...

  12. #32
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    You are welcome.

    If you feel that your problem is solved, please mark this thread solved from the Thread Tools of the menu. If not, it's ok. Just leave this as it is.

    Still you have some issues relating to this topic, post here, please don't start a new thread.

    Eranga :)

  13. #33
    new_2_java is offline Member
    Join Date
    Feb 2008
    Posts
    60
    Rep Power
    0

    Default

    Just to add to it:

    If you require to add external jar files to your executable jar, in your Manifest file, then you need to provide the relative path to your external jars in your Manifest file.

  14. #34
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    Yes.I specified the relative path of jars in Manifest file as Class-Path attribute.yes its working.but I should carry that jar files folder with my application wherever I want to execute my application.Is there any solution to execute jar file independently?

  15. #35
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  16. #36
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    Yes..I want to load my application using only that jar file.

  17. #37
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  18. #38
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    yes.I create jar file by giving the external jar file path as Class-Path values in manifest file,.My problem occures from that time.. I cant execute the jar file in any other location without copying the external jar am using..

  19. #39
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Yes it's true. You have to include all the jar files into single file, as a example,

    Java Code:
    jar cfm jar-file-name manifest_file input-file(s)/folder(s)
    in manifest file you have to refer all folders you use.

  20. #40
    gowry's Avatar
    gowry is offline Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    27
    Rep Power
    0

    Default

    I used

    jar cfm jar-file manifest-file *

    to create my jar-file.

    is'nt it enough? and I specified the folder that containing external jars in the Class-Path attribute.

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Replies: 28
    Last Post: 10-26-2010, 05:39 AM
  2. External JavaScript files not loading
    By sajut in forum New To Java
    Replies: 0
    Last Post: 02-15-2008, 06:47 AM
  3. Using Runtime to execute external commands
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-05-2008, 10:14 AM
  4. External Program execution problems
    By vital101 in forum Advanced Java
    Replies: 3
    Last Post: 10-30-2007, 06:17 PM
  5. Use a external file in my program
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:28 AM

Posting Permissions

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