I have downloaded biojava jar files and kept in my classpath. I am trying example to test from : 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. I have kept jar files in class path. then why this gave me error? Did i miss any step?
Please check your classpath settings and biojava version.
I took the example from the webpage in combination with version 3.0.7 of biojava. Here is what I have done
Download the 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 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. On MS Windows you should try something similar to follwing commands (issued in 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.