B4J Question [SOLVED] Cannot generate library javadocs on Eclipse (with openjdk 19.0.2).

max123

Well-Known Member
Licensed User
Longtime User
Hi all,

after a long time that I don't use Eclipse to compile my libraries, today I modified one.

I recompiled the project, it is compiled with java 1.8 level, it compiled successfully.

Then I'm going to create javadocs. When I opened the javadocs creation windows I saw that no NEXT button
was accessible, so I discovered that in the meantime I installed jdk 19.0.2 and my javadocs.exe was set to the older jdk I used
the last time, jdk 11.

When I set the right javadocs executable in C:\java\dk-19.0.2\bin\javadocs.exe, I set my javadocs name and
then I press the button to generate the javadocs.... but Eclipse return this error and do not generate it.

Please, can someone help me to know what happen here ?

I have the custom BADoclet configured and a C:\eclipse\Doclet folder with inside BADoclet$Property.class and BADoclet.class.
My target is -b4atarget "C:\eclipse\jar\jMidiBus.xml"

Thanks

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/javadoc/Doclet
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at jdk.javadoc/jdk.javadoc.internal.tool.Start.loadDocletClass(Start.java:799)
at jdk.javadoc/jdk.javadoc.internal.tool.Start.preprocess(Start.java:770)
at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:375)
at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:346)
at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:57)
at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:46)
Caused by: java.lang.ClassNotFoundException: com.sun.javadoc.Doclet
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 16 more
 
Last edited:

max123

Well-Known Member
Licensed User
Longtime User
Please some help here....
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
SLC works only with Java 8 source files. You can try to create BADoclets with the two class files that come with SLC and use those in the Eclipse "Use custom doclets" option.
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Thanks both for replies.

I never used SLC, I don't know how to do it at all. I always used the BADoclet provided by @Erel in the "Create java libraries" tutorial.

Projects compiles, only javadocs doesn't.

How other peolpes do this if it doesn't works on jdk 19 ?
There are out there some other custom BADoclet that peoples use ?

In the javadocs compatibility box when create it, I currently set java 1.8.

Thanks
 
Last edited:
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
The idea of the latest version of SLC is that you use the separately designated Java 1.8 for the creation of the Doclets in addition to the Java version of your library source. I don't know if Java 1.8 is only used to create the doclets after the source code has been compiled with Java 19. If that doesn't work you can make a copy of your Java 19 project and change it back to Java 1.8 via the properties. For source code that produces errors under Java 1.8 you could simply remove the source code with errors from the copied source library so that you get an unusable jar file, but you do get the creation of the xml file that you can copy again with the error-free Java 19 based jar file. Let me know what a working solution is.
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
I don’t use Eclipse since Erel released SLC. I use VSCode and then SLC to compile.

Regarding the doclet I think that it has a requirement for Java 8/11. It’s not specifically an SLC issue it’s the doclet generator.
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Please help me to solve this problem, I have 10+ libraries that I can compile .jar files for B4A and B4J,
but I cannot generate .xml files on Eclipse and I'm stuck to panic .....

If there is no way to generate javadocs I can downgrade java to 11, without this I can only
use old .xml files for my libraries, and I cannot update and improve them.
 
Last edited:
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
Start with looking at the video which explains how to do it.
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
Hi @MicroDrie thanks for the link, I will study it, but I've seen this video at least 10 times in past, it just explain what the "Create Java libraries" post shows. https://www.b4x.com/android/forum/threads/java-creating-libraries-for-b4a.6810/

@Daestrum compiled now a modified version of BADoclet to test, I even will try this one.

Hi @tchart thanks for reply.

Yes, I can do it, I tried here to put Java 1.8 compatibility but nothing changed.
May this is not the right place and Eclipse have this option somewhere else?

Do not matter to me if I compile Javadocs with Java 19, Java 11 or Java 8,
it's just important that I can create .xml files, so that I can load the libraries on B4X ide.

1747640114674.png
 
Last edited:
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
I tried the BADoclet2 that @Daestrum compiled and sent me....
and it seem to be a magic hand, I've successfully created my xml file for one library.
Not yet tested on the IDE but it should work.

Here the result:
1747643406377.png
 
Last edited:
Upvote 0
Top