Is there a way to generate a latex document from my java sourcefile's documentation?
I don't want to include LaTeX Elements in my documentation comments, I simply want to create LaTeX files instead of HTML.
Thanks
An alternative to Texdoclet is the ltxdoclet I created.
I think the main difference is that it also includes the source code, not only the Javadoc comments, though you can switch this off.
It is not very well documented on the github site - just download the code and do ant pdfdoku for an example output (ant latexdoku if you only want the LaTeX files). (It is documented in german, though.)
I really should add a readme file there.
For now, here is the jar file - download it somewhere, and then use
javadoc -docletpath ltxdoclet.jar -doclet de.dclj.paul.ltxdoclet.DocletStart -help
to see a list of options available. (This will be in german, if you have no english locale. Prefix it with "LC_ALL=en_US" or similar on bash to get the english version, or have a look at help_en.txt instead if you don't know german.)
I'm working on a webpage with some more documentation, but I'm not sure when it will be ready.
Now we have a webpage, too. It links the jar file, and also as an example the javadocs when applied to itself.
Texdoclet seems to be what you need. As for how to use it: just like any other doclet.
If you don't want to rely on any doclet dependency, but rather on a javascript one, you can just add the following javadoc param:
-header "<script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>"
and simply use clean latex inside your comments such as \(\sum_i a_i\) or \[\sum_i a_i\]
Related
Is there a way to look into originally given methods by API?
I am a beginner in programming and sometimes feel like taking huge shortcuts when using given methods and not really having an idea what tools i would use if i had to write it on my own.
Thanks in advance for given advices.
You want to look into Java code?
Here is a snapshot to attach java documentation and source code
Click Windows
Click Preferences
Click Java
Click Installed JRE
See the image for more steps
After you clarified your question, I think I can suggest you a solution. Let's suppose that you want to see what java.util.Collections.reverse(List list) do! When you downloaded the JDK you downloaded the sources too. You can find it here (or else to where you placed) for example for JDK8: C:\Program Files\Java\jdk1.8.0_66 => src.zip In this zip file you can find \java\util directories and inside this you can find Collections.java and inside this you can find the reverse(List list) method in JAVA source format. (Anyway, you can find the bytecode of this example method too in the rt.jar...but I think you shouldn't bother yourself with it if you are a beginner.) I hope I could help.
This question was already asked here on Stack Overflow, BTW even after reading the answer provided, I do not manage to add MyOwnAnalyzer, so that I can use it directly from Luke.
Please can someone help me on the right way to do, that is how and what to do so that MyOwnAnalyzer can be usable directly from Luke?
Can I do this (it did not work, may be my included jar are incomplete?):
java -cp .;d:\java\mylibs\MyOwnAnalyzer.jar -jar lukeall-3.5.0.jar
(MyOwnAnalyzer.jar was built from Eclipse and contains : MyOwnAnalyzer.java, MyOwnTokenizer.java, and MyOwnToken.java inside a subdirectory com.MyCompany... Eclipse added META-INF and manifest.mf for me)
Maybe I am wrong in adding classpath and MyOwnAnalyzer.jar with my command line?
Or must I build Luke from source including MyOwnAnalyzer somewhere in its directory?
Or is there something else to include/write so that my analyzer can be usable and imported from Luke? (looks like there is a mechanism to detect all classes that subclasses Analyzer - MyOwnAnalyzer is already declared as "extends Analyzer" )
BTW, even if it not really the same question but still in the same topic of using a custom analyzer from Luke... si I have an Error when using the tab Analyzer Tool I get Error analyzing:com/google/common/io/CharStreams , this lib is included in a jar, where I included a main that do a sample analysis to check and everything work fine when using it alone. If I use it as explained by JPountz, from Luke, I can see MyOwnAnalyzer from all the Luke tabs, but it did not work!
from the Luke code source, I think what throw the exception this is located somewhere inside the method analyze.
Note: The call to CharStreams.toString(input); is to transform the Reader input to a String inside MyOwnTokenizer.
Java ignores the -cp option when the -jar option is also used. You need to run Luke this way:
java -cp lukeall-3.5.0.jar;MyOwnAnalyzer.jar org.getopt.luke.Luke
When using the standard api, for example the collections library, the predictive text options windows also shows the comments on class/methods.
however when I do the same style comments on my own code - the open project I am working on (code completion works correctly, just no comments appear), and then reference it later. These comments are not displayed. I get the correct code completion options, just none of the associated comments/documentation. They are not in jar, they are source files, that are built using maven into a war file.
Is there a setting I need to enable in eclipse, or do I need to set up javadoc or something ?
How embarassing, you to have to specify double asterix at the begininng of comment to create a javdoc comment
/**
* read the documentation before asking questions on stackoverlow
*/
If the class is part of a jar you need to associate the javadoc jar or path. You can right click on the jar in eclipse and specify the path in the properties dialog.
I'm trying to write an SVN Post-Commit hook to generate javadoc on a webpage whenever someone submits any changes to relevant files.
I was new to the hook concept, but I didn't expect to run in any strange errors when generating the javadoc.
java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc
at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDescImpl.java:46)
at com.sun.tools.doclets.internal.toolkit.util.Util.isDeprecated(Util.java:811)
at com.sun.tools.doclets.formats.html.AbstractIndexWriter.printComment(AbstractIndexWriter.java:186)
After a few succesful searches on StackOverFlow I discovered it had something to do with third-party-annotations. (I make use of the Play framework and that uses a number of other libraries)
So I included everything in a script:
#!/bin/sh
CLASSPATH="~/Play/play-1.1.1/;"
javadoc -d ~/svndoc/ -classpath $CLASSPATH -sourcepath ~/svntest/avon/trunk/ScoreDB/app #packages
But this generates the exact same errors. Sometimes there are 10 warnings, but most of the time there are 27 of them.
Could you guys help me out?
Thanks in advance,
Jasper
Your classpath looks wrong. First, there should be no ; in it (in Unix, the separator is :, but it is not needed at the end). Secondly, do you really have the individual class files in this directory? If there are jar files, you need to either list them individually, or put a * there (but pay attention that bash does not expand it, since you would need : instead of spaces between).
I have no idea if this would solve the problem, though.
Having just wrapped up a GWT-1.5 based project, I'm taking a look at what we'll have to do to migrate to 1.6. I'm very surprised to see that GWT seems to want to write its compiled output to the war directory, where you would normally have items under source control.
What's the reason behind this? Did Google really think this was a good idea? Is there a workaround to keep source code separate from compiler-generated artifacts? Is there some other reason for this that I'm missing?
EDIT:
It's been suggested that I use the -war option to specify an output directory. I wrote some ANT scripts, and have this mostly working. I've had to copy over my static resources such as HTML, JSPs, etc into this directory (I'm using target/war, maven-style). Is that what most people are doing? Or are you just letting GWT write its output into your source-code-controlled war dir, and telling your VCS to ignore the non-version-controlled files? It occurred to me that there might be some benefit to letting GWT write to this dir directly, since then Jetty could automatically notice changes to JSPs, HTML etc, and avoid having to do a copy to make these changes visible.
Use the "-war" option to control where the output goes.
FYI: The Wiki has the design doc which will, hopefully, give you a bit of insight as to what they were thinking.
See also the Release Notes which discuss the new project layout, as well as some things to watch out for with this change.
Salvador Diaz has provided an excellent solution to this.
Yep, look at the -war option which may help.
What I'm doing (which may not be as clean as maven, and I dont use the -war) is I'm putting my entire project dir on SVN, and then ignoring the subdir that holds the js and other compiled bs along with the classes dir. That way I have everything else on source control, including the libs which I wanted. So another team member can just check out the whole project from SVN, compile, and ready to go.