How does Eclipse generate Javadoc? - eclipse

I have a batch file that creates Javadoc for me but I am getting this error: javadoc: error - No source files for package [package name]. The part of the batch file for the doc just provides a -sourcepath, a -classpath and a -subpackages argument. However, if I try to create my Javadoc with Eclipse (file -> export -> javadoc) it works perfectly fine without any errors. Anyone here knows how Eclipse generates Javadoc so I can implement it into my batch file?

To get the arguments that are used by Eclipse:
Create a batch file containing echo %1 > "C:\path\to\javadoc_arg.txt"
In the Javadoc export wizard choose this batch file instead of the javadoc.exe and generate the Javadoc
This will create a javadoc_arg.txt file that contains the file path of a javadoc-arguments<number>.tmp file containing all the arguments for javadoc.exe used by Eclipse.

Related

I cannot access MANIFEST.MF, but the jar file has one. How could I access and edit it?

I try to execute a jar file in the command prompt, but I always get the message 'no main manifest attribute, in 2056751-0.0.1-SNAPSHOT-src.jar'. So, I guess I should edit the manifest file. If I check it in the command prompt with the command 'jar tf 2056751-0.0.1-SNAPSHOT-src.jar' I can see that there is a MANIFEST.MF file, still I cannot see it in Eclipse project view.
To partially answer the question asked, IF on Windows (which you didn't say and isn't the only system with a command prompt), a jar file is really a ZIP file underneath and Explorer in all supported versions (>XP/S03) can treat a ZIP file as a directory subtree, so just rename to have the extension .zip and open in explorer, go to META-INF, select MANIFEST.MF and open with plain-text editor of your choice such as notepad. However this may not allow you to edit; if so copy to somewhere writable like the desktop, edit, then copy or move back. Then rename back to .jar
Although the manifest file in a jar can be loaded from an actual file, usually it is created by the jar tool. If you want a jar containing classes to run from the usual file association on Windows use the jar tool with the e option as described in the man page or Windows version on the web and help message. However if your file name is accurate and this is actually a source jar, it will never be runnable by only changing the manifest and you need to learn how Java works.

Running an eclipse created jar file

I have created a jar file in eclipse and now I want to execute the jar file in command prompt.
How can I do that?
When your creating jar file using eclipse
While reaching JAR manifest specification
enter main class
Run this command from command prompt:
java -jar <JarName>.jar
Note: you will need to jar a file called META-INF/MANIFEST.MF in order to run the jar after compilation.
If you are creating the jar using Eclipse do this:
Go to file > Export > Java > Jar file (hit next)
Select your project and all the files you would like to jar
Type below the destination of the jar (e.g. c:\MyJar.jar) (hit next x2)
On the bottom Main class either hit browse and choose the class which contains main or type: package_name.class_name (wihch contains the main entry point)
Hit Finish
Go to the jar location in command prompt and run as i mentioned above

Can you run xmllint within eclipse to validate xml and dtd files?

Is it possible to run xmllint inside Eclipse or Motodev? If so can someone show me? I would like to validate my DTD and XML files. Thanks.
Use the following steps to run xmllint in Eclipse:
Click Run > External Tools > External Tools...
Select the Program configuration
Click the New button
Enter a name for your external tool (xmllint in this case)
Click the Browse File System button
Find the xmllint executable
In the Arguments field, enter the necessary arguments (XML file name)
In the Working Directory field enter the working directory (XML file path)
Click Run
Ant can be configured to run these steps automatically for future reference.
References
Workbench User Guide > Concepts > Ant & External tools

Eclipse error:cannot opn .obj file

I'm using CDT plugin for eclipse for C/C+ development. But i'm not able to compile code it shows following error LINK : fatal error LNK1104: cannot open file 'C:\Program.obj'
What could be reasons?
One workaround would be to make sure to get your sources and generate your object files in a path with no space (not like "C:\Program Files (x86)\...")
The other workaround would be to check in the settings of the project if you can add double-quotes around any path defined. Check also the content of the .project file itself.

Eclipse console link for files not in source

I'm writing an application in Java that does some processing on arbitrary .java files. I'm using Eclipse, and when there's part of a .java file that it doesn't understand, I print out to the System.err stream:
System.err.format("Unable to resolve name %s (%s:%d)\n",
node.getName(), node.filePath(), node.getStartLine());
So it will print out something like this:
Unable to resolve name Foo (C:\project\src\Project\bar.java:63)
And the Eclipse console puts a link on the path and line part of the error. When I try to click on it, it says:
Source not found for C
I assume that's because Eclipse is only looking at source files in the project I'm running, not in the arbitrary .java file I'm processing. Is there any way to make it actually open that file and go to that line?
Unfortunately, the answer is no. Eclipse will only match the files against the resources in the workspace.