Developing a new library: error while creating javadoc and some general question

Hi, I’m working on a library for processing for the first time. I followed the guidelines on Github and downloaded the template.

Everything works correctly but I have an issue because when I run ant in eclipse it doesn’t create javadoc and I got this error

 [javadoc] Generating Javadoc
  [javadoc] Javadoc execution
  [javadoc] Loading source file /Users/federicopepe/GitHub/nice-color-palettes/tmp/NiceColorPalettes/src/nice/palettes/ColorPalette.java...
  [javadoc] Constructing Javadoc information...
  [javadoc] 1 error
  [javadoc] javadoc: error - An internal exception has occurred. 
  [javadoc] 	(java.lang.NoClassDefFoundError: com/sun/tools/doclets/Taglet)
  [javadoc] Please file a bug against the javadoc tool via the Java bug reporting page
  [javadoc] (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)
  [javadoc] for duplicates. Include error messages and the following diagnostic in your report. Thank you.
  [javadoc] java.lang.NoClassDefFoundError: com/sun/tools/doclets/Taglet
  [javadoc] 	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
  [javadoc] 	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
  [javadoc] 	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
  [javadoc] 	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
  [javadoc] 	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
  [javadoc] 	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
  [javadoc] 	at java.base/java.security.AccessController.doPrivileged(Native Method)
  [javadoc] 	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
  [javadoc] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
  [javadoc] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.taglets.TagletManager.addCustomTag(TagletManager.java:229)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.BaseConfiguration.initTagletManager(BaseConfiguration.java:837)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.BaseConfiguration.finishOptionSettings0(BaseConfiguration.java:777)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration.finishOptionSettings0(HtmlConfiguration.java:861)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.BaseConfiguration.setOptions(BaseConfiguration.java:798)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:200)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:114)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:72)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:582)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:431)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:344)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
  [javadoc] 	at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)
  [javadoc] Caused by: java.lang.ClassNotFoundException: com.sun.tools.doclets.Taglet
  [javadoc] 	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
  [javadoc] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
  [javadoc] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
  [javadoc] 	... 23 more

I also saw there’s an issue posted on GitHub but couldn’t find the solution.

Beside that I would like to know if there are some rules/suggestion/standards about naming methods, parameters etc in my library. I hope my library will be used by many people and I want it to be simple and straightforward.

Thanks

Here are two possible solutions:

  1. remove this line from build.xml.

    <taglet name="ExampleTaglet" path="resources/code" />

  2. make sure that the Eclipse project is using Java 8 – not just targeting 8 but using a built-in Java 10 or 11. Under Your project > Properties > Java Build Path > Libraries, confirm that you see JavaSE 1.8

Hi @jeremydouglass, I was not using JavaSE 1.8.

Now I changed it in the Java Build Path as shown in the screenshot but the error persist while generating the javadoc

Then I deleted the line from build.xml and it seems to work.

2 Likes

Any hint on rules/standards to follow?

What do you mean? I’m not sure that I understand this question.

@jeremydouglass as I said this is the first time I’m developing a Library for Processing. Since the Library is something that I’m creating from scratch it reflects the way I usually write code (and I am a self-taught programmer) so I was wondering if there are some kind of standards on naming variables or methods for example: if I got a a method that returns a random value how should I call it? getValueRandom, getRandomValue etc?

Probably I should just worry less, write my library, write a good documentation and just let the people use it and send suggestion on GitHub :smiley:

Good question.

Yes, just do it and get feedback --don’t get bogged down.

That said, I would suggest models. Look at 2-3 Processing libraries that you like and appreciate and browse their documentation and source code, looking at how they do everything – what do you like and not like about what they did? You will discover than many libraries are quite different from each other – there isn’t one standard approach.

Also, keep in mind that good bundled examples are going to matter even more than good javadoc – that is what most of your users will look at first, and they will assume that the example set has reasonable coverage of what your library can do. If they don’t find ready examples to run and then adapt, they may move on.

For naming, keep in mind that your library co-exists with the Processing API – so you often want to either align it or disambiguate it. For example, if you were writing a kaleidoscope library that creates a Kaleidoscope ks object, you might decide that ks.tint() will tint it (just like the Processing canvas), but that ks.random() looks like returning a random number – and instead you want to call that ks.randomLayout() to distinguish it. Often writing non-trivial example sketches helps work these namespace issues out, because you will better notice things that are confusing or unclear and might be renamed when you class methods are being mixed in with normal sketch functions.

Thanks! I just released the first beta of the library: https://github.com/federico-pepe/nice-color-palettes :slight_smile:

I will use it in a workshop tomorrow so I’ll have a feedback from some users.

1 Like

Very nice! It looks really good. Thanks so much for sharing this! Have you looked at other color libraries?

Minor suggestions:

  1. Add an explicit getPalleteCount() so that you can know how many are available.

  2. Drop the random “seed” println log line. If you do anything in a loop with this function it could spam the console and slow the sketch–and anyone who needs to know their random index can just create their own, then they know it, e.g.

int rindex = (int)random(getPalleteCount()-1);
int[] rpallete = getPallete(rindex);

Finally, this is a question of style, but I would personally suggest dropping the fail-to-random design for getPallete(i). Just have it fail. If someone doesn’t care what they get, they can use getPallete(). If they do care and use getPallete(i), they should get an error to debug – or that could optionally be handled with try. This also gets away from potentially printing tons of console warnings in a loop.

1 Like

Thanks for this feedback. This is exactly what I needed.

A suggestion – your github repo forked the template-- that’s a problem, because now your library appears to be one of 380+ forks contributing to the template, and it isn’t.

If instead you click on the green “Use this template” button on the original template repo then you get all the benefits of github – people can fork you and contribute to you, etc. You will have to move your commits onto the new template-fork, but it is a much nicer setup.

I just deleted the old repo and created a new one. Everything should be alright. Thanks for this tip as well :slight_smile:

1 Like