Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javadoc help

 
Mike Lipay
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried running javadoc against both of my .java files and received an error that there were no public or protected classes, I thought they both had public classes. Below is one of the java files and the error I received.

Software.java



Error message
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just change


to:


I thought they were public by default. Maybe the javaDoc generator needed an explicit public definition to function. Not really sure.

-Hunter
 
Mike Lipay
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that was it, thanks. I also assumed that public was the default.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike Lipay wrote:that was it, thanks. I also assumed that public was the default.

Don't assume anything. It's the #1 cause for errors.

And no, the default access means a class or member is only visible to classes in the same package. Apart from private, it's the most restrictive visibility.
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to document package private / private classes
there are options you could pass to javadoc.

just type javadoc... check the following extract..

G:\>javadoc
javadoc: error - No packages or classes specified.
usage: javadoc [options] [packagenames] [sourcefiles] [@files]
-overview <file> Read overview documentation from HTML file
-public Show only public classes and members
-protected Show protected/public classes and members (default)
-package Show package/protected/public classes and members
-private Show all classes and members
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also note that your whitespace-based formatting won't work: Javadoc creates HTML output (by default), so the extra spaces will be invisible.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But that can be solved using <table>, <pre> or some other nice HTML tag.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic