I found something in Eclipse that will create a Javadoc for me.
However, I can't get it to work.
Any ideas?
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.
I found something in Eclipse that will create a Javadoc for me.
However, I can't get it to work.
Any ideas?
Its a little hard from those pictures to confirm this is the problem, but in Eclipse for the javadoc command you should point it to the actual javadoc.exe program, which should be with your JDK installation (something like C:\Program Files\java\jdk\bin\javadoc.exe)
javapenguin (November 24th, 2010)
I tried it. Doesn't recognize
As a valid command.C:\Program Files\java\jdk\bin\javadoc.exe
Is that the correct path to your JDK? Something got cut off in my previous post explaining that path was a guess and in most cases an incorrect one at best: navigate (or search) to your JDK folder to find the actual exe to use and input this path for the javadoc command.
javapenguin (November 24th, 2010)
My computer does have a file or a folder named javadoc.exe yes.
But it will let me have that as a destination, but not as a command.
I can only have a the path of a java class as a command.
Would this be it?
c:\Program Files\Java\jdk1.6.0_18\bin
No, that didn't quite work.
Creating destination directory: "C:\Program Files\Javadoc folder\"
Loading source files for package SongBook...
Constructing Javadoc information...
javadoc: warning - Error fetching URL: file:/C:/Program%20Files/Javadoc%20folder/package-list
Standard Doclet version 1.6.0_18
Building tree for all the packages and classes...
javadoc: error - Unable to create directory C:\Program Files\Javadoc folder\SongBook/
com.sun.tools.doclets.internal.toolkit.util.Doclet AbortException
at com.sun.tools.doclets.internal.toolkit.util.Direct oryManager.createDirectory(DirectoryManager.java:2 63)
at com.sun.tools.doclets.internal.toolkit.util.Util.g enWriter(Util.java:576)
at com.sun.tools.doclets.formats.html.markup.HtmlWrit er.<init>(HtmlWriter.java:61)
at com.sun.tools.doclets.formats.html.markup.HtmlDocW riter.<init>(HtmlDocWriter.java:47)
at com.sun.tools.doclets.formats.html.HtmlDocletWrite r.<init>(HtmlDocletWriter.java:95)
at com.sun.tools.doclets.formats.html.SubWriterHolder Writer.<init>(SubWriterHolderWriter.java:40)
at com.sun.tools.doclets.formats.html.ClassWriterImpl .<init>(ClassWriterImpl.java:49)
at com.sun.tools.doclets.formats.html.WriterFactoryIm pl.getClassWriter(WriterFactoryImpl.java:64)
at com.sun.tools.doclets.internal.toolkit.builders.Bu ilderFactory.getClassBuilder(BuilderFactory.java:8 3)
at com.sun.tools.doclets.formats.html.HtmlDoclet.gene rateClassFiles(HtmlDoclet.java:152)
1 error
1 warning
at com.sun.tools.doclets.internal.toolkit.AbstractDoc let.generateClassFiles(AbstractDoclet.java:164)
at com.sun.tools.doclets.internal.toolkit.AbstractDoc let.startGeneration(AbstractDoclet.java:106)
at com.sun.tools.doclets.internal.toolkit.AbstractDoc let.start(AbstractDoclet.java:64)
at com.sun.tools.doclets.formats.html.HtmlDoclet.star t(HtmlDoclet.java:42)
at com.sun.tools.doclets.standard.Standard.start(Stan dard.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.tools.javadoc.DocletInvoker.invoke(DocletI nvoker.java:269)
at com.sun.tools.javadoc.DocletInvoker.start(DocletIn voker.java:143)
at com.sun.tools.javadoc.Start.parseAndExecute(Start. java:340)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:41)
at com.sun.tools.javadoc.Main.main(Main.java:31)
com.sun.tools.doclets.internal.toolkit.util.Doclet AbortException
at com.sun.tools.doclets.formats.html.HtmlDoclet.gene rateClassFiles(HtmlDoclet.java:159)
at com.sun.tools.doclets.internal.toolkit.AbstractDoc let.generateClassFiles(AbstractDoclet.java:164)
at com.sun.tools.doclets.internal.toolkit.AbstractDoc let.startGeneration(AbstractDoclet.java:106)
at com.sun.tools.doclets.internal.toolkit.AbstractDoc let.start(AbstractDoclet.java:64)
at com.sun.tools.doclets.formats.html.HtmlDoclet.star t(HtmlDoclet.java:42)
at com.sun.tools.doclets.standard.Standard.start(Stan dard.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.tools.javadoc.DocletInvoker.invoke(DocletI nvoker.java:269)
at com.sun.tools.javadoc.DocletInvoker.start(DocletIn voker.java:143)
at com.sun.tools.javadoc.Start.parseAndExecute(Start. java:340)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:41)
at com.sun.tools.javadoc.Main.main(Main.java:31)
What now?
I'm thinking that it's my destination folder.
Also, how does javadoc work?
Do you need to comment things?
My destination folder is right now the very folder, if not the very exact same place, that I'm using as the command.
I'd think I had the right place there originally for it to go, but I lost it.
Where would be the default place to send the javadoc to?
I lost the info as I thought that my destination folder was the problem earlier when it wasn't.
I really need help!
You can choose your destination folder to be anywhere. This just tells eclipse where you want to put the generated Javadoc.
Here's a simple Javadoc tutorial on how to write Javadoc in your source code and how to export it using Eclipse (see section 4 for the latter): Javadoc
javapenguin (November 26th, 2010)
Why won't it work fully? It works but won't show what I wanted it to.
package javadoc; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import java.util.*; import java.io.*; //Paul Adcock // Assignment 4 // Lasted Worked On: 10/12/2010 /* this class is the Doubly Linked list class. It has a Node that holds a reference to some date of type T and has a reference to the next Node and to the previous Node. It is a generic class than can hold date types. */ public class DoublyLinkedList<T> { /* This is the generic class Node, a private innner class of DoublyLnkedList. */ private class Node<T> { /* * variables * T data - a variable of generic type * a Node next, which refers to the Node after the current Node * a Node previous, which refers to the Node before the current Node */ private T data; private Node<T> next; private Node<T> previous; /* * Constructor Node(T data, Node<T> next, Node<T> previous) * parameters T data * a Node next * a Node previous */ public Node(T data,Node<T> next, Node<T> previous) { this.data = data; this.next = next; this.previous=previous; } /* * returns the data of that Node */ public T getData() { return data; } /* * returns the Node after the current Node */ public Node<T> getNext() { return next; } /* * returns the Node before the current Node */ public Node<T> getPrevious() { return previous; } /* * sets the Node after the current Node to next */ public void setNext(Node<T> next) { this.next = next; } /* * sets the Node before the current Node to previous */ public void setPrevious(Node<T> previous) { this.previous = previous; } /* * creates a copy of the Node and returns that copy * @see java.lang.Object#clone() */ public Node<T> clone() { Node<T> copy = new Node<T>(this.getData(), this.getNext(), this.getPrevious()); return copy; } } /* * data for class DoublyLinkedList * Node head - beginning of DoublyLinkedList * Node tail - end of DoublyLinkedList * int side - size of DoublyLinkedList * */ private Node<T> head;//head of the linked list private Node<T> tail; // tail of linked list private int size; private ImageIcon icon; private Icon icon2; /* * constructor DoublyLinkedList() * no parameters */ public DoublyLinkedList() { /* * sets head and tail to null * sets size to 0 */ head = null; tail = null; size = 0; icon = new ImageIcon("doh3.jpg"); } /* * returns a String of all the elements in the DoublyLinkedList * @see java.lang.Object#toString() */ public String toString() { String str = "["; Node<T> curr; for (curr=head;curr!=null;curr = curr.getNext()) { str = str + curr.getData(); if (curr.getNext()!=null) str = str + " "; } str = str + "]"; return str; } /* * removeRange(int from, int to) * from - the starting index to remove * to - the last index to remove * removes all values between from and to */ public void removeRange(int from, int to) { if (from < 0 || from >= Size() || to < 0 || to >=Size()) { return; } for (int i = from; i <=to; i++) { remove(i); } } // adds the data as the first element. If the list size is 0, makes first element tail. If head is not null, it puts the old // tail as the second element and the new element as the new head. /* * addFirst(T data) * data - the type of data * adds the data to the beginning of the DoublyLinkedList */ public void addFirst(T data) { /* Since this is the first Object, previous should be null */ Node<T> newNode = new Node<T>(data,head,null); //We know that if head is null, the list is empty if (head==null) { //If the list is empty, tail will be newNode tail = newNode; } if(head!=null) head.setPrevious(newNode); //We want to set head to be newNode // if the list was empty before, both head and tail will be set to newNode; head = newNode; //Increment Size size++; } /* * removes the data the begining of the DoublyLinkedList */ public void removeFirst() { if (size == 0) { JOptionPane pane = new JOptionPane(); pane.setIcon(icon); pane.showMessageDialog(null, "Cannot remove from an empty list!", "Invalid removal", JOptionPane.ERROR_MESSAGE); pane.setMessageType(JOptionPane.ERROR_MESSAGE); return; } Node<T> current = head; // creates a Node called current and sets it to head. head = head.getNext(); //move head to the next element current.setNext(null); size--; } /* * addLast(T data) * parameters data * data- the data to be added * adds data to end of DoublyLinkedList */ public void addLast(T data) { //If there are no elements, use the addFirst method if (tail == null) { addFirst(data); return; } /* Create the new Node from the data. Set next to null * because this will be the last element and will not * have a next. Set previous to tail because tail has * not been changed yet and is currently referencing * that element that will be directly before this element */ Node<T> newNode = new Node(data,null,tail); /* Since the tail variable still references the element * directly before the new element, we can set that node's * next to our new element. */ tail.setNext(newNode); //Set tail to our new Node tail = newNode; //Increment size size++; } /* * returns the size of the DoublyLinkedList */ public int Size() { return(size); } /* * add(int index, T data) * parameters index, data * index - the index to add the data * data- the data to add * adds the data at the specified index */ public void add(int index,T data) { int i; if (index == 0) { addFirst(data); return; } if (index>size) { JOptionPane.showMessageDialog(null, "Cannot add out of bounds!", "Invalid command", JOptionPane.ERROR_MESSAGE); return; } if (index < 0) { JOptionPane.showMessageDialog(null, "Cannot add out of bounds!", "Invalid command", JOptionPane.ERROR_MESSAGE); return; } if (head==null) { addFirst(data); return; } if (index == size) { addLast(data); return; } //step 1 Node<T> current; current = head; for (i=0;i<index-1;i++) { current = current.getNext(); } //current now refers to object immediately before new node //step 2 Node<T> newnode = new Node<T>(data,current.getNext(), current.getPrevious()); //step 3 current.setNext(newnode); size++; } /* * remove(int index) * parameters index * index- the index of the data to remove * removes the data at the specified index */ public void remove(int index) { if ((index<0) || (index>=size)) { JOptionPane.showMessageDialog(null, "You cannot remove an out-of-bounds value!", "Invalid removal", JOptionPane.ERROR_MESSAGE); return; } Node <T> next2, previous3; Node<T> NodeToRemove = head; // sets Node to remove originally to head for (int v = 0; v < index; v++) { NodeToRemove = NodeToRemove.getNext(); // traverse to Node we want to remove } previous3 = NodeToRemove.getPrevious(); // sets previous3 to value before Node to remove next2 = NodeToRemove.getNext(); // sets next2 to value after Node to remove if (previous3 == null) { if (next2 == null) { head = null; tail = null; } else { head = next2; } } else { previous3.setNext(next2); } if (next2 == null) { if (previous3 == null) { head = null; tail = null; } else { tail = previous3; } } else { next2.setPrevious(previous3); } size--; } /* * get(int i) * parametsrs i * i - the index * returns the data at index i */ public T get(int i) { if (i < 0 || i >= size) return null; if (i ==0) { Node<T> thisNode = head; return(head.getData()); } if (i == size - 1) { Node<T> thisNode = tail; return(tail.getData()); } Node<T> specialNode = head; for (int x = 1; x < i + 1; x++) { specialNode = specialNode.getNext(); } return(specialNode.getData()); // How do I get it to return the data at i? } /* * getSubList(int from, int to) * parameters from, to * from - the starting index * to - the ending index * gets the data from index from to index to and copies it into another DoublyLinkedList * and returns that DoublyLinkedList */ public DoublyLinkedList<T> getSubList(int from, int to) { DoublyLinkedList<T> sub = new DoublyLinkedList<T>(); int count = 0; for (int value = from; value <=to; value++) { sub.add(count, this.get(value)); count++; } return sub; } /* * swap(int first, int second) * parameters first, second * first - the index of the first value to be swapped * second - the index of the second value to be swapped * swaps the data at index first and index second * Not yet written */ public void swap(int first, int second) { } /* * getIndex(T data) * parameters data * data - the data to look for * if it finds the data, it returns the index where it finds it * otherwise it returns -1 if it cannot find it */ public int getIndex(T data) { for (int x =0; x < Size(); x++) { if (this.get(x).equals(data)) return x; } return -1; } // calls get method of first index /* * returns the data at the beginning of the DoublyLinkedList */ public T front() { if (head == null) return null; return(get(0)); } // calls get Method of last index /* * returns the data at the end of the DoublyLinkedList */ public T back() { if (tail == null) return null; return(get(size - 1)); } /* * removes the data at the end of the DoublyLinkedList */ public void removeLast() { if (head == null) { JOptionPane.showMessageDialog(null, "Cannot remove from an empty list!", "Invalid removal", JOptionPane.ERROR_MESSAGE); return; } remove(Size() -1 ); } // gets a String for the first bracket. Then stores each set of first and last, 2nd and 2nd to last, etc, in a String array; // it then sets the third string to the concatination of all of the Strings in the array. It thens puts these together and adds // the last set of brackets and returns the final string. public String printAlternate() { /* This method returns a string that has the data in the following fashion (assume for this example that the list stores String objects) If the list is currently [amit is now here], it will return a string �[amit here is now]� If the list is currently [amit is now currently here], it will return a string �[amit here is currently now]� */ String str = "["; String [] str2 = new String[size]; for (int v = 0; v < size; v++) { str2[v] = this.get(v) + " " + this.get(size - (v+1) ); } String str3 = ""; for (int x = 0; x < size - 2; x++) { str3 = str2[x].concat(str2[x+1]); } String str4 = str + " " + str3 + " " + "]"; return(str4); } // removes all data /* * removes all data in the DoublyLinkedList */ public void removeAll() { int x = 0; int y = this.Size() - 1; removeRange(x,y); } /* * copies the data from this DoublyLinkedList into another one and returns that * DoublyLinkedList * @see java.lang.Object#clone() */ public DoublyLinkedList<T> clone() { DoublyLinkedList<T> copy = new DoublyLinkedList<T>(); for (int x = 0; x < this.Size(); x++) { copy.add(x, this.get(x)); } return copy; } }
hmm, I wonder if this is a problem with Windows User account settings? The C:/Program Files folder is write-protected under normal circumstances, and you need to run the application as an administrator to be able to write to that directory.
Do you have windows Vista/7?
Try picking another directory (such as C:/Temp/JavaDoc/)
javapenguin (November 27th, 2010)
It's working, but it doesn't show what I thought it would like the regular javadoc online.
It never says what the methods do and what the parameters to it are.
I have that in javadoc comment
/*
* commment
*/
but it doesn't seem to notice.
You need to format the commenting for the javadoc tool using particular annotations. See How to write doc comments.
javapenguin (November 27th, 2010)
Javadoc starts with 2 stars instead of 1. See the link copeg posted on other things you can do with Javadoc annotations.
/** * this is a Javadoc comment */ /* * this is a regular block comment */
javapenguin (November 27th, 2010)