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.

Re: How do you generate javadoc?

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)

Re: How do you generate javadoc?

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.

Re: How do you generate javadoc?

Why won't it work fully? It works but won't show what I wanted it to.

packagejavadoc;importjavax.swing.Icon;importjavax.swing.ImageIcon;importjavax.swing.JOptionPane;importjava.util.*;importjava.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.
*/publicclass DoublyLinkedList<T>{/* This is the generic class Node, a private innner class of DoublyLnkedList.
*/privateclass 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
*/publicvoid setNext(Node<T> next){this.next= next;}/*
* sets the Node before the current Node to previous
*/publicvoid 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 listprivate Node<T> tail;// tail of linked listprivateint size;privateImageIcon icon;privateIcon icon2;/*
* constructor DoublyLinkedList()
* no parameters
*/public DoublyLinkedList(){/*
* sets head and tail to null
* sets size to 0
*/
head =null;
tail =null;
size =0;
icon =newImageIcon("doh3.jpg");}/*
* returns a String of all the elements in the DoublyLinkedList
* @see java.lang.Object#toString()
*/publicString 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
*/publicvoid 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
*/publicvoid 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 emptyif(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
*/publicvoid removeFirst(){if(size ==0){JOptionPane pane =newJOptionPane();
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
*/publicvoid addLast(T data){//If there are no elements, use the addFirst methodif(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
*/publicint 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
*/publicvoid 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
*/publicvoid 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 headfor(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 removeif(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)returnnull;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
*/publicvoid 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
*/publicint 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)returnnull;return(get(0));}// calls get Method of last index/*
* returns the data at the end of the DoublyLinkedList
*/public T back(){if(tail ==null)returnnull;return(get(size -1));}/*
* removes the data at the end of the DoublyLinkedList
*/publicvoid 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. publicString 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 =newString[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
*/publicvoid 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;}}

Re: How do you generate javadoc?

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.