Search code examples
javaeclipsejar

Unable to export runnable jar, launch configuration grayed out


I am not able to figure out how to export a runnable jar in eclipse.

I have a java project (project A) (written by someone else) which when imported in Eclipse, I can click Build Project and it will create a projectName.jar file under bin/ directory. That jar file contains binary *.class files.

This jar file is added as external library for another java project (project B) which I want to debug. But because all the class files are binary I'm not able to do line-by-line debugging when classes from projectA are called.

I tried exporting Runnable Jar in Eclipse, for that I have to select a Launch Configuration. But there is no main class in project A. (I recursively grepped for main and didn't find any).

What can I do to export jar of project A that contains respective source code also (which will be used in line-by-line debugging)?


Solution

  • When building there is an option in Eclipse (a check box) to include source code in the JAR, and it has nothing to do with being an executable JAR (an executable JAR must have a class with a public static void main (String[] args) method, because that's the entry point).