How to get java to ignore an error while running? - java

My java program runs perfectly in eclipse (just outputting the error) but when I try and export it and run it as a jar it stops because of the error. How do I get java to ignore the error?
Here is the error I encountered:
ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger
FATAL Launcher Unhandled exception in thread Thread[main,5,main] java.lang.refle
ct.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)
at net.minecraft.launcher.ui.TexturedPanel.<init>(TexturedPanel.java:23)
at net.minecraft.launcher.ui.LauncherPanel.<init>(LauncherPanel.java:36)
at net.minecraft.launcher.SwingUserInterface.initializeFrame(SwingUserIn
terface.java:108)
at net.minecraft.launcher.Launcher.<init>(Launcher.java:91)
at net.minecraft.launcher.Main.main(Main.java:56)
... 5 more

Use a try catch method try{ } catch(Exception)
this is a helpful link too https://docs.oracle.com/javase/tutorial/essential/exceptions/try.html

Related

i want to use stanford-parser-full-2015-01-30 in java command line

when i use this command
java -mx100m edu.stanford.nlp.trees.EnglishGrammaticalStructure
-sentFile input.txt -collapsedTree -CCprocessed -parseTree -parserFile englishPCFG.ser.gz it return this Error: unable to find or load main
class edu.stanford.nlp.trees.EnglishGrammaticalStructure
and when i use this command
java -cp "*" edu.stanford.nlp.trees.EnglishGrammaticalStructure
-sentFile input.txt -collapsedTree -CCprocessed -parseTree -parserFile englishPCFG.ser.gz it retruns
Loading parser from serialized file englishPCFG.ser.gz ...
java.io.IOException: Unable to resolve "englishPCFG.ser.gz" as either class path, filename or URL
at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:463)
at edu.stanford.nlp.io.IOUtils.readStreamFromString(IOUtils.java:396)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromSerializedFile(LexicalizedParser.java:599)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromFile(LexicalizedParser.java:394)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:181)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at edu.stanford.nlp.trees.GrammaticalStructure.loadParser(GrammaticalStructure.java:1394)
at edu.stanford.nlp.trees.GrammaticalStructure.main(GrammaticalStructure.java:1645)
Loading parser from text file englishPCFG.ser.gz java.io.IOException: Unable to resolve "englishPCFG.ser.gz" as either class path, filename or URL
at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:463)
at edu.stanford.nlp.io.IOUtils.readerFromString(IOUtils.java:591)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromTextFile(LexicalizedParser.java:533)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserFromFile(LexicalizedParser.java:396)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:181)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.loadModel(LexicalizedParser.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at edu.stanford.nlp.trees.GrammaticalStructure.loadParser(GrammaticalStructure.java:1394)
at edu.stanford.nlp.trees.GrammaticalStructure.main(GrammaticalStructure.java:1645)
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
at edu.stanford.nlp.trees.GrammaticalStructure.main(GrammaticalStructure.java:1655)
Caused by: java.lang.NullPointerException
at edu.stanford.nlp.trees.GrammaticalStructure.main(GrammaticalStructure.java:1652)
i don't know where is the problem and how to use this library
You have to supply the resource's full path in the command.
edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz
When Java tries to find something, it looks for that path in all of the jar files in the CLASSPATH. Also the -cp "*" will only work if you are executing the command in the directory with all of the .jar files.

Exported a project and getting this error

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
at renderEngine.DisplayManager.createDisplay(DisplayManager.java:23)
at engineTester.MainGameLoop.main(MainGameLoop.java:45)
this is the error that i get saying that there is no lwjgl how could i fix this
I got this error after I exported the project since when i had it in the jde it worked just fine
java -jar Ecosistembio.jar -Djava.library.path=C:\Users\User\Desktop\Eco\lib
This is the command i have tried using thought its to no result
Your path no have the necessary dependency(artifact) for the Ecosistembio.jar.
Check this https://stackoverflow.com/a/6092576/10354937

Getting java.lang.IllegalStateException, how to correct it?

Why this exception printing all the time when run the server?
NFO: Illegal access: this web application instance has been stopped already. Could not load java.net.BindException. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1600)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at com.mysql.jdbc.SQLError.createLinkFailureMessageBasedOnHeuristics(SQLError.java:1220)
at com.mysql.jdbc.exceptions.jdbc4.CommunicationsException.<init>(CommunicationsException.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
Change your old mysql-connector-java-5.X-bin.jar to latest mysql-connector-java-5.1.38-bin.jar
Get it here:
http://dev.mysql.com/downloads/connector/j/

error running javafx application with Intellij

I have a javafx program that I was formerly developing in sublime text before migrating to intellij as my editing environment. As of now, I can compile and run without error through the command line (Windows). However, when I try to run it from intellij, I get the following message:
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(LauncherImpl.java:157)
at com.sun.javafx.application.LauncherImpl$$Lambda$1/868693306.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3201)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3169)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3142)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3118)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3098)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3091)
at Main.setNewScene(Main.java:40)
at Main.start(Main.java:29)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821)
at com.sun.javafx.application.LauncherImpl$$Lambda$50/2069914884.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/646648017.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/1106256089.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/151108218.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/2004449016.run(Unknown Source)
... 1 more
Process finished with exit code 1
I don't know how to fix this.
The problem turned out to be intellij having an issue with the source folder in the project directory. By moving all my java files to a new directory and reopening it in intellij as a new project with a single, correct source folder, the problem completely went away.
(As stated in the question, the code itself was functional and worked through the command line.)

soapUI error when testing for WSI compliance

When I test my web service for WSI conformance I get a java exception thrown - please see console output below. I know the issue isn't caused by absence of a main() method as the service isn't an application.
soapUI Console output:
command: [cmd.exe, /C, C:\Web Services\eclipse\wsi-test-tools\java\bin\Analyzer.bat, -config, C:\Users\Admin\AppData\Local\Temp\wsi-analyzer-config6023712173002373188.xml]
Exception in thread "main" java.lang.NoSuchMethodError: org/apache/xerces/dom/ElementImpl.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/apache/xerces/dom3/UserDataHandler;)Ljava/lang/Object;
at org.wsi.xml.dom.DOMParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(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.DOMParser.parse(Unknown Source)
at org.wsi.xml.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.wsi.xml.XMLUtils.parseXML(Unknown Source)
at org.wsi.xml.XMLUtils.parseXML(Unknown Source)
at org.wsi.test.analyzer.config.impl.AnalyzerConfigReaderImpl.readAnalyzerConfig(Unknown Source)
at org.wsi.test.analyzer.config.impl.AnalyzerConfigReaderImpl.readAnalyzerConfig(Unknown Source)
at org.wsi.test.analyzer.config.impl.AnalyzerConfigImpl.parseArgs(Unknown Source)
at org.wsi.test.analyzer.Analyzer.<init>(Unknown Source)
at org.wsi.test.analyzer.BasicProfileAnalyzer.<init>(Unknown Source)
at org.wsi.test.analyzer.BasicProfileAnalyzer.main(Unknown Source)
Log Output:
ERROR:An error occurred [org.xml.sax.SAXParseException: Premature end of file.], see error log for details
When I run C:\Web Services\eclipse\wsi-test-tools\java\bin\Analyzer.bat, -config, C:\Users\Admin\AppData\Local\Temp\wsi-analyzer-config6023712173002373188.xml] directly from command prompt I get:
Analyzer Error: The specified option is not supported: ,.
For some reason soapUI doesn't run the service but analyses the generated WSDL. WSI compliance html report file is generated but with no content. I suspect this might be a result of a configuration issue. I've double checked the following:
Java applets run correctly in Eclipse
Logs directory has been created
soapUI preference is correctly entered
WSI_HOME environment variable is correctly set up
Any ideas what might be causing the error?
Looks like you have incompatible jars:
java.lang.NoSuchMethodError: org/apache/xerces/dom/ElementImpl.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/apache/xerces/dom3/UserDataHandler;)Ljava/lang/Object
But without seeing your dependencies i can not say which.

Categories

Resources