atomchace function in biojava - java

Hi everyone I'm fairly new to biojava and trying to implement this piece of code:
AtomCache cache = new AtomCache();
cache.setPath("/tmp/");
FileParsingParameters params = cache.getFileParsingParams();
params.setLoadChemCompInfo(true);
StructureIO.setAtomCache(cache);
Structure strucuture = StructureIO.getStructure("4HHB");
after executing these lines im getting the following error message:
Exception in thread "main" java.lang.NoSuchFieldError: lineSplit
at org.biojava.bio.structure.align.util.UserConfiguration.(UserConfiguration.java:87)
at org.biojava.bio.structure.align.util.AtomCache.(AtomCache.java:115)
at protein_structure.main(protein_structure.java:27)
Java Result: 1
I cant figure out the reason for this error, I downloaded the pdb files for the proteins that Im working with (in this case "4HHB" in the /tmp/ directory but still the same error is showing up. can anyone tell me how Atomcache function works? Thanks

Related

Nashorn failed to call a static method of a 3rd party Java class, any solutions?

The code in Nashorn is to parse a very simple JSON string into a JSONObject (com.alibaba.fastjson.JSONObject), simply going as:
var jso = Java.type('com.alibaba.fastjson.JSONObject').parseObject('{"name": "nothing"}');
But when ran the Java project, I received below error message:
Exception in thread "main" javax.script.ScriptException: TypeError: Java.type("com.alibaba.fastjson.JSONObject").parseObject is not a function in <eval> at line number 1
at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:454)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
...
I tried to print(Java.type('com.alibaba.fastjson.JSONObject')), and the class is obviously there with output [JavaClass com.alibaba.fastjson.JSONObject]
Anybody knows what's the root cause of this error, and how to fix it?

R Code from java giving error : Error in lev(modelFit) : could not find function "lev"

Am getting RConnection in java, am assigning data by following
rConnection.assign(".tmp.","'{json goes here}'");
rCon.parseAndEval("try(eval(parse(text=model_S(.tmp.))),silent=TRUE)");
when the above call is made am getting
Error in lev(modelFit) : could not find function "lev"
In R, I have installed Caret, Kernlab packages also. When I execute the same code in R, its working fine. but when the call is made from Java, its giving error.
Any inputs will be Helpful. Thankyou.
Using following statement :
rCon.parseAndEval("library(caret)")
resolved the issue.

Source code link in log in NetBeans IDE / Java

When my program prints stack trace in NetBeans IDE, for example this:
Exception in thread "main" java.lang.RuntimeException: Not implemented yet
at App.App.main(App.java:202)
The "App.java:202" part is a link. When I click it, it directs me to the file and line.
I would like to do this in my own logs. Just printing it doesn't work for me.
My not functional log line example:
2015/06/01 10:27:19.197 (DbConnection.java:119) ExecuteQuery ....
Solution:
StackTraceElement s = Thread.currentThread().getStackTrace()[1];
System.out.printf("%s.%s(%s:%s)%n", s.getClassName(), s.getMethodName(),s.getFileName(), s.getLineNumber());
New problem:
If I print this:
App.App.RunTests(App.java:128) th_id:1,main WARN null Database.DbValuesCache.run(DbValuesCache.java:153) ....
.. only the first link works.
What now?

ColdFusion using Javaloader error

I have a question regarding calling java class from ColdFusion using Javaloader 1.1.
I attempted to access java class from ColdFusion in a local server, and there was no problem. But when I tried the same thing in office server, I got an error:
"the specified directory
mypath\Javaloader/tmp/AEFACE9B-1C6F-6569-2329 could not be created.
The most Likely cause of this error that mypath \ /
tmp/AEFACE9B-1C6F-6569-2329 already exists on your file system."
And another message
"The error occured in Javaloader.cfc line 269". Javaloader.cfc line
269 is < cfdirectory action="create" directory="#path#" >
what do those error messages mean?
this is my code:
//calling java from coldfusion
<cfscript>
sourcePaths = [expandPath("./src")];
loader = createObject("component", "javaloader.JavaLoader").init(sourceDirectories=sourcePaths);
obj = loader.create("myClass").init();
</cfscript>
I really have no idea. Any solution will be much appreciated. Thank you in advance...

Java game not working

I found this java source code for a brick breaker game online. I downloaded it and tried to run it but it gives me a NullPointerException. What is giving this exception and how do I fix it? Thanks.
http://zetcode.com/tutorials/javagamestutorial/breakout/
Here is the stacktrace:
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:181)
at Ball.<init>(Ball.java:16)
at Board.gameInit(Board.java:48)
at Board.addNotify(Board.java:43)
at java.awt.Container.addNotify(Container.java:2578)
at javax.swing.JComponent.addNotify(JComponent.java:4685)
at java.awt.Container.addNotify(Container.java:2578)
at javax.swing.JComponent.addNotify(JComponent.java:4685)
at java.awt.Container.addNotify(Container.java:2578)
at javax.swing.JComponent.addNotify(JComponent.java:4685)
at javax.swing.JRootPane.addNotify(JRootPane.java:739)
at java.awt.Container.addNotify(Container.java:2578)
at java.awt.Window.addNotify(Window.java:663)
at java.awt.Frame.addNotify(Frame.java:470)
at java.awt.Window.show(Window.java:859)
at java.awt.Component.show(Component.java:1584)
at java.awt.Component.setVisible(Component.java:1536)
at java.awt.Window.setVisible(Window.java:842)
at Breakout.<init>(Breakout.java:14)
at Breakout.main(Breakout.java:18)
Exception in thread "Timer-0" java.lang.NullPointerException
at Board$ScheduleTask.run(Board.java:110)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apparently this code is supposed to work, but it isn't.
You probably didn't download the images as well, or at least didn't put them in the right folder. Make sure you put the images here:
Browse to Ball.java, go two folder levels up, create there a folder called images and put there your images.

Categories

Resources