[英]biojava package import error
I have downloaded biojava jar files and kept in my classpath. 我已经下载了biojava jar文件并保存在我的类路径中。 I am trying example to test from : http://www.biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite
我正在尝试测试来自: http : //www.biojava.org/wiki/BioJava : CookBook : Core : FastaReadWrite
but, it gives me error : 但是,它给了我错误:
error: package org.biojava3.core.sequence does not exist
import org.biojava3.core.sequence.ProteinSequence;
I have 24 errors of the example file shown in site. 我有24个站点中显示的示例文件的错误。 I have kept jar files in class path.
我在类路径中保存了jar文件。 then why this gave me error?
那为什么这给了我错误? Did i miss any step?
我错过了任何一步吗?
Please check your classpath settings and biojava version. 请检查您的类路径设置和biojava版本。
I took the example from the webpage in combination with version 3.0.7 of biojava. 我从网页上结合了biojava 3.0.7版本的例子。 Here is what I have done
这就是我所做的
Download the biojava.jar 下载biojava.jar
wget http://biojava.org/download/maven/org/biojava/biojava3-core/3.0.7/biojava3-core-3.0.7.jar
FastaOpen.java
containing the code taken from your link FastaOpen.java
Compile 编
javac -cp .:biojava3-core-3.0.7.jar FastaOpen.java
Execute 执行
java -cp .:biojava3-core-3.0.7.jar FastaOpen Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at FastaOpen.main(FastaOpen.java:20)
The exception is OK, as I did not specify a filename. 例外是可以的,因为我没有指定文件名。 So, for me the example is working.
所以,对我来说,这个例子正在起作用。 And if I do not specify the classpath at compile time I get the same errors as you do, eg:
如果我在编译时没有指定类路径,我会得到与你相同的错误,例如:
FastaOpen.java:5: error: package org.biojava3.core.sequence does not exist
import org.biojava3.core.sequence.ProteinSequence;
The description above works on Linux. 以上描述适用于Linux。 On MS Windows you should try something similar to follwing commands (issued in Powershell)
在MS Windows上,您应该尝试类似于以下命令(在Powershell中发布)
Compilation 汇编
PS > & 'C:\\Program Files\\Java\\jdk1.7.0_45\\bin\\javac.exe' -cp "C:\\Users\\stefan\\Downloads\\biojava3-core-3.0.7.jar" .\\FastaOpen.java
Execution 执行
PS > & 'C:\\Program Files\\Java\\jdk1.7.0_45\\bin\\java.exe' -cp "C:\\Users\\stefan\\Downloads\\biojava3-core-3.0.7.jar;C:\\Users\\stefan\\Downloads" FastaOpen
(Both files, java source/class and jar reside in the Downloads
directory. (两个文件,java源/类和jar都位于
Downloads
目录中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.