Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Eclipse - Extracting dependencies into jar

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Eclipse - Extracting dependencies into jar

    I have a java applet which I want to extract into a jar (using Eclipse). The project has a handful of external dependencies (also created by me). I know if I create a runnable jar, I can extract the dependencies into the jar, but I cannot create a runnable jar since it's an applet. Does anyone know if it is possible to do the same for non-executable jars?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Eclipse - Extracting dependencies into jar

    Why do you think you can't create a runnable jar because it's an applet? That option works okay for me...
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Eclipse - Extracting dependencies into jar

    You need to have run commands to create the runnable jar. Does that exist for applets?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Eclipse - Extracting dependencies into jar

    You don't need the jar to be runnable by the operating system, you just need eclipse to "think" it's runnable so it includes the libraries, right?

    One quick solution is to create a dummy main method that doesn't actually do anything. A better solution would be to modify your program so it works as both an applet and an application.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Eclipse - Extracting dependencies into jar

    Quote Originally Posted by KevinWorkman View Post
    A better solution would be to modify your program so it works as both an applet and an application.
    ^^

    In Eclipse when you choose export you should be given the option of what to include in the jar, runnable or not.
    File -> Export -> Jar -> click next, does that window not allow you to browse and select the contents of all projects?

  6. The Following User Says Thank You to jps For This Useful Post:

    aussiemcgr (September 11th, 2013)

  7. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Eclipse - Extracting dependencies into jar

    Yeah that actually works perfectly. I'm not sure why I didn't think that was an option. Maybe it wasn't an option in older versions of eclipse?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. #7
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Eclipse - Extracting dependencies into jar

    Yep. That works. Painfully obvious now, lol.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

Similar Threads

  1. "Services with missing/unavailable dependencies
    By Namrata@nanowebtech in forum What's Wrong With My Code?
    Replies: 0
    Last Post: September 10th, 2013, 05:51 AM
  2. images are loaded while using eclipse but i get NullPointerException in jar
    By Teuthoidea in forum What's Wrong With My Code?
    Replies: 16
    Last Post: June 12th, 2012, 02:47 AM
  3. How to make a program into a working .jar? (eclipse)
    By ynnad95 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 16th, 2011, 08:29 PM
  4. Creating JAR file in eclipse HELP !
    By Maheshkh in forum Java IDEs
    Replies: 3
    Last Post: September 16th, 2011, 12:37 PM
  5. Jar Versioning with Eclipse
    By KevinWorkman in forum Java IDEs
    Replies: 4
    Last Post: July 12th, 2011, 05:49 PM