I'm trying to start Lint4J (0.9.1) from the command line on a mac. And I wanted to run it on a small test class. But unfortunately I always get a null pointer exception.
I have JDK 1.8.0
My test class:
package ch.ntb.sir.testmain;
public class TestMain {}
I've downloaded the lint4j package from the official website. It's not in the same folder as the test class.
This is the command I executed:
/Users/.../lib/lint4j-0.9.1/bin/lint4j -sourcepath /Users/.../ClassToCheck/src ch.ntb.sir.testmain
I execute it from the terminal in the project folder from my test class.
What I get as output:
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
at lint4j.aZ.a(Unknown Source)
at lint4j.aZ.a(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.b(Unknown Source)
at lint4j.fx.a(Unknown Source)
at lint4j.aw.c(Unknown Source)
at lint4j.aw.e(Unknown Source)
at lint4j.ai.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dq.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.eO.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.by.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dP.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.dI.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at lint4j.ap.a(Unknown Source)
at lint4j.cQ.a(Unknown Source)
at com.jutils.lint4j.Lint4j.initialize(Unknown Source)
at com.jutils.lint4j.Lint4j.execute(Unknown Source)
at com.jutils.lint4j.cmdline.Main.main(Unknown Source)
Caused by: java.lang.NullPointerException
at lint4j.q.a(Unknown Source)
... 25 more
I've found nothing that helped me on this sites:
http://www.jutils.com/uguide.html
http://www.jutils.com/auditingcode.html
and also in the lint4j.pdf was nothing helpful
All tips are welcome! Thanks for your help.
I've learned, that Lint4J is a "dead" project. Last updated in 2007
Static Analysis tool recommendation for Java?
https://github.com/checkstyle/checkstyle/wiki/Java-static-code-analysis-tools
So it would be a bad idea to use it for a new project.
I'll try: FindBugs, Checkstyle, PMD,... their last update was in between 2015-2016
Related
I am trying to automate BUILDS with anthill3 using remoting API but am getting an error when i try to get the Workflows from a project.
It seems the jar commons-graph.jar which is required to run this is not provided in anthill3-devkit.
As per the below link it says to download the JAr from anthill 5 , but i get an error when i try to download any fixes or release of anthill5 .
So if anybody has a resolution or the required JAR it will be very helpfull.
http://www-01.ibm.com/support/docview.wss?uid=swg1PI43350
Exception in thread "main" java.lang.NoClassDefFoundError: Lcom/urbancode /commons/graph/TableDisplayableGraph;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredField(Unknown Source)
at java.io.ObjectStreamClass.getDeclaredSUID(Unknown Source)
at java.io.ObjectStreamClass.access$700(Unknown Source)
at java.io.ObjectStreamClass$2.run(Unknown Source)
at java.io.ObjectStreamClass$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.<init>(Unknown Source)
at java.io.ObjectStreamClass.lookup(Unknown Source)
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readClass(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readArray(Unknown Source)
From your question its hard to understand why you are getting the error and why you might need JAR from a newer version of Anthill. From what I know, even sending you the JAR won't do the job because of the different versions. Please try to explain what is exactly you try and maybe we can find another way of doing it without using upper version
Anyway how can I send it to you ? E-mail ?
Thanks,
Elyahu
When I'm trying to start my Derby Network Server, I'm getting this exception. This has never happened before and I don't now what's the cause of problem. Any ideas?
Exception in thread "main" java.lang.NoSuchFieldError: completionKey
at sun.nio.fs.WindowsNativeDispatcher.initIDs(Native Method)
at sun.nio.fs.WindowsNativeDispatcher.<clinit>(Unknown Source)
at sun.nio.fs.WindowsLinkSupport.getRealPath(Unknown Source)
at sun.nio.fs.WindowsPath.toRealPath(Unknown Source)
at sun.nio.fs.WindowsPath.toRealPath(Unknown Source)
at sun.util.calendar.ZoneInfoFile$1.run(Unknown Source)
at sun.util.calendar.ZoneInfoFile$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.util.calendar.ZoneInfoFile.<clinit>(Unknown Source)
at sun.util.calendar.ZoneInfo.getTimeZone(Unknown Source)
at java.util.TimeZone.getTimeZone(Unknown Source)
at java.util.TimeZone.setDefaultZone(Unknown Source)
at java.util.TimeZone.getDefaultRef(Unknown Source)
at java.util.TimeZone.getDefault(Unknown Source)
at java.text.SimpleDateFormat.initializeCalendar(Unknown Source)
at java.text.SimpleDateFormat.<init>(Unknown Source)
at java.text.DateFormat.get(Unknown Source)
at java.text.DateFormat.getDateInstance(Unknown Source)
at org.apache.derby.iapi.tools.i18n.LocalizedResource.init(Unknown Source)
at org.apache.derby.iapi.tools.i18n.LocalizedResource.<init>(Unknown Source)
at org.apache.derby.impl.drda.NetworkServerControlImpl.init(Unknown Source)
at org.apache.derby.impl.drda.NetworkServerControlImpl.<init>(Unknown Source)
at org.apache.derby.drda.NetworkServerControl.main(Unknown Source)
This is an Error (!) that is due to running code that was compiled against a class with a field and executing it with another (compiled) version without that field.
Go back and check installed versions, recompile everything, etc. etc-
I have created a java application to connect to a MySQL database.
Once through the program install creator I created an .exe .
This executable runs, and the first form is login. When he tries to access the database to confirm the details of login gives this error.
java.lang.NullPointerException
Someone can help me solve this? The path is correct, because if run the .jar the application runs normally.
I apologize for the inconvenience.
Only have this to try explain better my question :S
I'm so sorry... I'm running a executable version from my java aplication.
java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at sensores.forms.jTMainMenu.initComponents(jTMainMenu.java:786)
at sensores.forms.jTMainMenu.<init>(jTMainMenu.java:57)
at sensores.forms.jTLoginConsulta.jBLoginActionPerformed(jTLoginConsulta.java:351)
at sensores.forms.jTLoginConsulta.access$000(jTLoginConsulta.java:59)
at sensores.forms.jTLoginConsulta$1.actionPerformed(jTLoginConsulta.java:110)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
You have an error in this class/line
jTMainMenu.java:786
Seems you tried to load a image in this point of your code, i don't know how you are generating a executable from your java code but this may be the source of the problem. Try to put this image outside of your executable/jar and use a relative path to load the image, like './my_image'.
You also have to take care if your user make a link to your executable, in this case a relative path can't resolve your problem. A simple way to solve this in java is get the source code location.
getClass().getProtectionDomain().getCodeSource().getLocation();
And use this location to find your image.
Please check the line number from the Stacktrace where you are getting the NullPointerException.
it is straight forward to find out the null pointer exception. Object is null or not initialize on which you are calling the method
try{
// add database connection statement here
}catch(Exception e){
e.printstacktrace();
}
// run the program from the command prompt.
// you can print the e.printstacktrace() on the popup as well to get the exception details
If you make a .jar, move that jar somewhere separate from the IDE (i.e. their classpaths), and start the jar, do you receive a NullPointerException?
This can be caused by resources, getResource, getResourceAsStreem, getBundle, as they are not case-sensitive in the Windows file system, but are case sensitive in a jar(and under Linux/MacOS).
(Also File cannot be used for jar resources.)
You might look in the jar with 7zip or so to inspect all paths.
I think it is not getting image icon in defined path
at javax.swing.ImageIcon.<init>(Unknown Source)
I have the following two guesses:
There is a problem with your path or classpath and loading the resource
The lines
at sensores.forms.jTMainMenu.initComponents(jTMainMenu.java:786)
at sensores.forms.jTMainMenu.(jTMainMenu.java:57)
indicate that something is initialized. Usually Swing/AWT uses multiple threads, so you might have a race condition here: The reference to the resource is handed to ImageIcon in your ìnitComponents method before another thread could set the value to something non-null. Try using proper synchronization/locking.
I am collaborating on a Project and we have a problem integrating some code I produced and that works in my local tesintg implementation of the jAudio library but once we include the library in the project (we all use eclipse) the project doesnt build throuwing the classnotfound exception - even though the IDE (Eclipse) knows the library (I can use autocomplete) and the methods are resolved it keeps insisting that it cannot resolve the classes to a type:
https://www.dropbox.com/s/9tsa0xh1uq1kg8d/Screenshot%202014-01-18%2011.44.58.png "Example of Type not resolved"
What do you think might be the problem behind "I cant see you" problem ?
Stacktrace:
java.lang.ClassNotFoundException: eExtractor.AudioFeatures.AreaPolynomialApproximationConstantQMFCC
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at jAudioFeatureExtractor.ACE.XMLParsers.FeatureListHandler.endElement(FeatureListHandler.java:95)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at jAudioFeatureExtractor.ACE.XMLParsers.XMLDocumentParser.parseXMLDocument(XMLDocumentParser.java:97)
at jAudioFeatureExtractor.DataModel.<init>(DataModel.java:173)
at org.tuhh.cpmgg.weka.JAudioCommandLine.execute(JAudioCommandLine.java:47)
at org.tuhh.cpmgg.weka.AudioClassifierWithJAudio.privjanalyse(AudioClassifierWithJAudio.java:365)
at org.tuhh.cpmgg.weka.AudioClassifierWithJAudio.classifyAudioFile(AudioClassifierWithJAudio.java:223)
at org.tuhh.cpmgg.weka.AudioClassifierWithJAudio.main(AudioClassifierWithJAudio.java:57)
java.lang.Exception: The src\main\java\org\tuhh\cpmgg\weka\features.xml file must be of type feature_list. <ClassNotFoundException> Class 'eExtractor.AudioFeatures.AreaPolynomialApproximationConstantQMFCC' does not exist in the path.
at jAudioFeatureExtractor.ACE.XMLParsers.XMLDocumentParser.parseXMLDocument(XMLDocumentParser.java:105)
at jAudioFeatureExtractor.DataModel.<init>(DataModel.java:173)
at org.tuhh.cpmgg.weka.JAudioCommandLine.execute(JAudioCommandLine.java:47)
at org.tuhh.cpmgg.weka.AudioClassifierWithJAudio.privjanalyse(AudioClassifierWithJAudio.java:365)
at org.tuhh.cpmgg.weka.AudioClassifierWithJAudio.classifyAudioFile(AudioClassifierWithJAudio.java:223)
at org.tuhh.cpmgg.weka.AudioClassifierWithJAudio.main(AudioClassifierWithJAudio.java:57)
Go to your project and right click ----> Build path ----> configure buildpath and add that jar into your project.
just try this one.
Already you completed the Buildpath, restart the eclipse once. I think your problem will be solved.
I'm having some problems while trying to open a web-client for a game that I play. I get this error and I don't know what to do. Help would be appreciated. If you need any more information please let me know and I will do the best I can to get it.
load: class client.class not found.
java.lang.ClassNotFoundException: client.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: client.class
It seems you are running your web client like this:
$ java client.class
Try running this instead:
$ java client