Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Having trouble with a really simple javadoc build

 
Bill Howanski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, I'm having some trouble with a really simple build problem

So basically I have one class, let's call it test.java, and I want my build file to generate javadocs for it, so I did the following:

<target name="javadoc">
<javadoc sourcepath="./" destdir="./docs" />
</target>

the test.java is in the same directory as the build file

When I try to do this it tells me that "you must specify them as source files and not packages" and also "no source files and no packages have been specified."

Thanks in advance for all your help!
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom, welcome to Java Ranch! Please see you private messages...

Could you post the full Ant output? I helps to see the full output and exact error message.

Generally, it is not a good idea to write packageless classes (several things don't work correctly with packageless classes). Also, it is generally not a good idea to place Java source files in the base directory. Usually you designate a directory such as src to contain Java sources. (I suspect that the javadocs task got confused because it will also look in the cods directory for things to process...)
 
Bill Howanski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Peter thank you a lot for taking time to help me.

I think the problem is that I'm using a packageless class (so, my next question is, do I need to put my things in a jar file?)

[javadoc] /home/dc23/b2 contains source files in the default package, you must specify them as source files not packages.
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] javadoc: error - Illegal package name: "/home/dc23/b2/test.*"
[javadoc] 1 error

BUILD SUCCESSFUL

Basically I have one java file (I compiled it so also the class) and I just want to use a build file to make a javadocs and store it in docs. Thanks a lot!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill,
Welcome to CodeRanch!

Putting the code in a jar doesn't put it in a package. You need to add "package bill" or the like to all your classes and put them in a folder called "bill".
 
Bill Howanski
Greenhorn
Posts: 3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it to work, thank you very much!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic