Christopher Schene
asked on
Eclipse: How do I force Eclipse to Build a Specific Project in a Multiple project Work Space?
Hi,
I have three projects in my Eclipse work space and I want to create executable jars for each of them.
However, when I select the top project (ReadZipBlb) the Jar that is created is actually the .jar for the project at the bottom of list list of projects.
How do I force Eclipse to build the one I want when I have multiple projects in my work space?
I have three projects in my Eclipse work space and I want to create executable jars for each of them.
However, when I select the top project (ReadZipBlb) the Jar that is created is actually the .jar for the project at the bottom of list list of projects.
How do I force Eclipse to build the one I want when I have multiple projects in my work space?
How are you creating the executable jars? Can I assume that it is via the File -> Export -> Runnable JAR File option? If so, are you choosing the correct "Launch Configuration" at the top of the next dialog box? This is how Eclipse knows what/how to create the JAR and it does NOT default to the project that you have selected prior to starting this action. If you don't see the correct Launch Configuration, it means that you need to run it at least once first within Eclipse (or otherwise manually create the Launch Configuration).
ASKER
I looked at this and I set the launch configuration but I am not sure what to do from there
if you are looking for three separate runnable jar files for the three files that you have, you should be having main method compulsorily in all of them to make the individual jar runnable.
you should be doing following in eclipse for each jar file you want :
File--> Export--> select java node --> JAR file (not the Runnable jar file) -- next --> select your project -- > select files that you want in the jar file -- > choose the location and provide jar file name.( here you can optionally select to export source files also). -- > next--> select appropriate options -- > next --> select the radio button with "Generate the manifest file" -- > provide the Main class by browsing --> click Finish
you are done.
Go to the location you provided for the jar file and use it as runnable jar file.
you should be doing following in eclipse for each jar file you want :
File--> Export--> select java node --> JAR file (not the Runnable jar file) -- next --> select your project -- > select files that you want in the jar file -- > choose the location and provide jar file name.( here you can optionally select to export source files also). -- > next--> select appropriate options -- > next --> select the radio button with "Generate the manifest file" -- > provide the Main class by browsing --> click Finish
you are done.
Go to the location you provided for the jar file and use it as runnable jar file.
ASKER
Ok, I will try what you suggested
ASKER
Under File-> export there is no such option as "File--> Export--> select java node"
I am confused
I am confused
ASKER
I tried your solution and I think it i working. I have run into another issue that is complicating things that I need to debug.
Stand by for points
Stand by for points
Ok, I think I know what your issue in your other question is now, and it is related to the above.
Unfortunately, for what you are trying to do, I don't believe @Sushant answer will work for you. There is a major difference between the "Export as a JAR" and "Export as a Runnable JAR" options, and that is in the former option, I believe that you CAN'T include dependent libraries in with the JAR (not in a way that will allow it to run how you are trying to). What that option does it to pack all YOUR code into a JAR, but you therefore still need to have the dependency JARs alongside it for it to run correctly.
That is what the "Runnable JAR" option does, it attempts to unpack all your dependencies and directly include the class files alongside your code, so that it can all run together from within the JAR file that is created.
Unfortunately, for what you are trying to do, I don't believe @Sushant answer will work for you. There is a major difference between the "Export as a JAR" and "Export as a Runnable JAR" options, and that is in the former option, I believe that you CAN'T include dependent libraries in with the JAR (not in a way that will allow it to run how you are trying to). What that option does it to pack all YOUR code into a JAR, but you therefore still need to have the dependency JARs alongside it for it to run correctly.
That is what the "Runnable JAR" option does, it attempts to unpack all your dependencies and directly include the class files alongside your code, so that it can all run together from within the JAR file that is created.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
You're welcome!