openjdk 8: error - No public or protected classes found to document - swing

I'm on Debian, and have already installed OpenJDK 8 along with the packages openjdk-8-doc and default-jdk-doc; However I can't view any documentation for the classes of JDK 8 API, whenever I specify the class or package name to the javadoc utility, which fails to show the doc throwing the following errors:
ArrayList case:
kais#debian:~$ javadoc ArrayList
Loading source files for package ArrayList...
javadoc: warning - No source files for package ArrayList
Constructing Javadoc information...
javadoc: warning - No source files for package ArrayList
javadoc: error - No public or protected classes found to document.
1 error
2 warnings
kais#debian:~$ javadoc java.lang.ArrayList
Loading source files for package java.lang.ArrayList...
javadoc: warning - No source files for package java.lang.ArrayList
Constructing Javadoc information...
javadoc: warning - No source files for package java.lang.ArrayList
javadoc: error - No public or protected classes found to document.
1 error
2 warnings
JPanel case:
kais#debian:~$ javadoc JPanel
Loading source files for package JPanel...
javadoc: warning - No source files for package JPanel
Constructing Javadoc information...
javadoc: warning - No source files for package JPanel
javadoc: error - No public or protected classes found to document.
1 error
2 warnings
kais#debian:~$ javadoc javax.swing.JPanel
Loading source files for package javax.swing.JPanel...
javadoc: warning - No source files for package javax.swing.JPanel
Constructing Javadoc information...
javadoc: warning - No source files for package javax.swing.JPanel
javadoc: error - No public or protected classes found to document.
1 error
2 warnings
kais#debian:~$ javadoc javax.swing
Loading source files for package javax.swing...
javadoc: warning - No source files for package javax.swing
Constructing Javadoc information...
javadoc: warning - No source files for package javax.swing
javadoc: error - No public or protected classes found to document.
1 error
2 warnings
This seems to me weird, as the installed package openjdk-8-doc is supposed to contain the doc required by the javadoc ..
Any thoughts?

The Javadoc tool is supposed to create Javadoc out of Java source. It's not a tool to show the javadoc of a particular class. The Javadocs of the classes in the JVM is available for download at Oracle or can be browsed online.
As you said in your question, you "installed" the docs for your corresponding JDK, so instead of downloading it again or browsing it online, you can change to the "installation directory" of the doc-package and open the index-html file that should be there at its root.

Related

Checkstyle Can't Generate Report With Custom Check

I am trying to create my own custom check for Checkstyle. I created an artifact and gave it on the classpath (dependency in the POM). Then included it in my configuration.xml file. I am getting the following error:
An error has occurred in Checkstyle report generation.: Failed during checkstyle configuration: cannot initialize module TreeWalker - Unable to instantiate 'com.lft.cos.checkstyle.custom.MethodsOrderCheck' class.
Can someone point me to what I am doing wrong?

java.lang.No classDefFound error while using PEXML for android in Libgx

I am using PEXML library for giving physics to bodies in my game. It worked very well in desktop but when I ran in android it is giving me error at code
playerPhysics = new PEXML(Gdx.files.internal("data/physics.xml").file());
and showing error
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/bind/JAXBContext; at com.hi5dev.box2d_pexml.PEXML.loadXML(PEXML.java:124) at com.hi5dev.box2d_pexml.PEXML.(PEXML.java:24)
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.xml.bind.JAXBContext" on path: DexPathList[[dex file "/data/data/com.myplayer.football/files/instant-run/dex/slice-slice_9...
Google search shows javax.xml.bind.JAXBContext is in the file javax.xml.bind.jar
Java needs to find this file at runtime. It looks for it in your Java classpath ( set of directories ).
You need this Jar to be in your runtime classpath
The error you wrote about shows you the classpath.
You can either
put javax.xml.bind.jar in the current classpath
or
Modify the classpath to include the location of javax.xml.bind.jar
Lookup how to modify the Java classpath for your operating system.

Data does not exist in the namespace System

Can anyone throw any light on the following error importing System.Data:
/home/baloo/HellooCSharp/HellooCSharp/HellooCSharp.cs(14,14): Error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing `System.Data' assembly reference? (CS0234) (HellooCSharp)
Build command:
Building: HellooCSharp (Debug|x86)
Performing main compilation...
/usr/bin/mcs /noconfig "/r:/usr/lib/mono/4.5/mscorlib.dll" -nostdlib "/out:/home/baloo/HellooCSharp/HellooCSharp/bin/Debug/HellooCSharp.exe" "/r:/usr/lib/mono/4.5/System.dll" "/r:/usr/lib/mono/4.5/System.Core.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 /platform:x86 "/define:DEBUG" /t:exe "/home/baloo/HellooCSharp/HellooCSharp/Properties/AssemblyInfo.cs" "/home/baloo/HellooCSharp/HellooCSharp/HellooCSharp.cs"
Compilation failed: 2 error(s), 0 warnings
The assembly ca be found in /usr/lib/mono/4.5, which has been duly configured in the build assembly folders preferences dialog. [Edit: mcs compiles the test code fine with this added to the command line.]
Fedora 23, mono-core and -data rpm version 4.0.5. [Edit: MonoDevelop Version 5.9.7 (build 9)]
Hint: Are you missing `System.Data' assembly reference?
You need to reference System.Data in order for it to be found/resolved.
Importing System does not import System.Data
To resolve this you just need to do edit edit references and check the system.Data.

How to setup Robot Framework standalone jar with SwingLibrary?

I'm using Robot Framework with SwingLibrary to test a Java Swing based application. Since I'm not used to Python and also don't want to setup the Python environment, I decided to go with the Robot standalone JAR version (current version 2.8.4).
My problem is the setup in combination with SwingLibrary (version 1.8.0). I don't know where to put the library such that it gets recognized by Robot.
So far, I have the following test case (mytest.txt):
*** Settings ***
Library SwingLibrary
*** Test Cases ***
MyTestCase
Start Application MyApp
I tried with putting the standalone jar in conjunction with the test case in a folder, and created one subfolder (called it Lib) where I put the SwingLibrary JAR (and later also extracted the JAR).
I added the SwingLibrary as well as my own application to the classpath, tried executing robot the following way:
java -Xbootclasspath/a:Lib/swinglibrary-1.8.0.jar:Lib/MyApp.jar -jar robotframework-2.8.4.jar mytest.txt
and also with
java -jar robotframework-2.8.4.jar mytest.txt
I always get one of the following errors:
[ WARN ] Imported library 'SwingLibrary' contains no keywords
==============================================================================
Mytest
==============================================================================
MyTestCase | FAIL |
No keyword with name 'Start Application' found.
or
[ ERROR ] Error in file 'mytest.txt': Importing test library 'SwingLibrary' failed: ImportError: No module named SwingLibrary
You can use the standalone jar without the -jar option, allowing you to specify the classpath in the standard manner. The main class for the standalone jar is org.robotframework.RobotFramework, so the syntax would be
java -cp robotframework-2.8.4.jar:Lib/swinglibrary-1.8.0.jar:Lib/MyApp.jar org.robotframework.RobotFramework
Slightly more verbose but it's standard and so avoids any oddnesses caused by using the non-standard -Xbootclasspath option.

How do I get log4J to work - I'm getting "package org.apache.log4j does not exist"

i know this may be a newbie qestion, but I'm having issues with setting up Log4J:
I want to run a log4j demo, and here's my code:
import org.apache.log4j.Logger;
import org.apache.log4j.BasicConfigurator;
public class HelloLOG4j {
private static final Logger logger = Logger.getLogger(Hello.class);
public static void main(String argv[]) {
BasicConfigurator.configure();
logger.debug("Hello world.");
logger.info("What a beatiful day.");
}
}
I set my Classpath:
C:\Users\Adel\Downloads\apache-log4j-1.2.17\log4j-1.2.17.jar
in both System and User var's
But when I run my program I still get
errors found:
File: C:\Users\Adel\Desktop\various_topics\JavaProjects\HelloLOG4j.java [line: 2]
Error: package org.apache.log4j does not exist
I know that I set classpath right - if I run cmd line:
C:\Program Files\Java\jdk1.6.0_20>print %LOG4J_HOME%
C:\Users\Adel\Downloads\apache-log4j-1.2.17\log4j-1.2.17.jar is currently bein
g printed
You need to add log4j home to the classpath as the JVM needs the path to the log4j classes
if on windows, you can use
set classpath=%classpath%;%LOG4J_HOME%
On linux/ ubuntu (much better than windows for development & servers)
export classpath=$classpath:$LOG4J_HOME
then run your app after adding other paths to classpath
like
set classpath=%classpath%;c:\users\adel\....
You do not need to add log4JHOME again - as %classpath%; will add to the current classpath.
LOG4J_HOME is not known to Java. It is just used by log4j in case of auto config/default config.
On a side note try using the new log4j2 !
Can you show how you are trying to compile the code?
And also, try adding the log4j.jar to 'lib' directory and compile with the classpath referencing this jar
Just want to remind that don't capitalized Log4j keyword , unlike Logger:
import org.apache.Log4j.Logger; //typo
import org.apache.log4j.Logger; //correct
/usr/share/java/log4j-1.2-api-2.8.2.jar path can be located by issue dpkg -L liblog4j2-java(debian-based) command, then do:
$ sudo javac -cp .:xxx.jar:/usr/share/java/log4j-1.2-api-2.8.2.jar xxx.java