Trouble compiling a custom import filter with JabRef 3.7

Hi!

I’m trying to import a csv file with multiple citations exported by the search feature of SpringerLink (springerlink.com -> make a search -> download search results). I have got the impression that I need to create a custom import filter for this.

I’m trying to follow the instructions at (http://help.jabref.org/en/CustomImports). I

  1. created a file like in the instructions and saved it as “SpringerLinkCSVImporter.java”,
  2. opened the Terminal and navigated to the folder where I have the file, and
  3. tried to compile it using the following command:

javac -classpath /Applications/JabRef.app/Contents/java/app/JabRef-3.7.jar SpringerLinkCSVImporter.java

But I got the following compile error:

SpringerLinkCSVImporter.java:4: error: package net.sf.jabref.importer does not exist
import net.sf.jabref.importer.ImportFormatReader;
                             ^
SpringerLinkCSVImporter.java:5: error: package net.sf.jabref.importer does not exist
import net.sf.jabref.importer.OutputPrinter;
                             ^
SpringerLinkCSVImporter.java:6: error: package net.sf.jabref.importer.fileformat does not exist
import net.sf.jabref.importer.fileformat.ImportFormat;
                                        ^
SpringerLinkCSVImporter.java:10: error: cannot find symbol
public class SpringerLinkCSVImporter extends ImportFormat {
                                             ^
  symbol: class ImportFormat
SpringerLinkCSVImporter.java:25: error: cannot find symbol
    public List<BibEntry> importEntries(InputStream stream, OutputPrinter printer) throws IOException {
                                                            ^
  symbol:   class OutputPrinter
  location: class SpringerLinkCSVImporter

If I try to compile it without a correct reference to the jabber file, I get even more errors, so the path seems to be correct.

The example uses JabRef 2.0. Has Jabref changed since then so that the net.sf.jabref.importer.ImportFormatReader packages etc do no longer exist, or am I doing something else wrong?

I’m using JabRef 3.7 on Mac OS Yosemite 10.10.5 with java version 1.8.0_92.

Yes the example old was quite old and a few things changed in the meantime. I updated the example code and everything should work now.
Let us know if you need further assistance creating the Springer importer. Once you have finished the development, please consider to publish the final code here so that other people can reuse it and we might include it in JabRef itself. Thanks!

Thanks for the quick reply, I got it to compile now!

However, I’m now stuck in how to actually use it in JabRef. I’ve imported it into JabRef using the dialog, but I can’t find the mentioned places where it should be used as said in the text; there is no File > Import > Custom importers menu:

"All custom importers will appear in the 
File -> Import -> Custom Importers 
and 
File -> Import and Append -> Custom Importers"

Also, in the example code there is this line:
return FileExtensions.TXT;
I guess it should be changed to FileExtensions.CSV for .csv files, but that doesn’t seem to exist as an option as I get a compiler error when trying.

Hi!
You can find the custom imports now in the dialog “Manage Custom Imports” which is available in the “Options” menu.

Regarding the FileExtensions you are right. There is currently no “CSV” file extension (check GitHub for the sourcecode). Thus you’ll have to use the workaround of renaming the csv files to “txt”.

Sidenote: You know that you can directly perform searches at SpringerLink using the WebSearch feature (Search -> Web Search) of JabRef?

Hi
Following the instructions at Page Redirection for JabRef 4.1,
I tried to compile custom importer filter on Windows 10 64bits and get following errors :

SimpleCSVImporter.java:6: error: package org.jabref.logic.importer does not exist
import org.jabref.logic.importer.Importer;
^
SimpleCSVImporter.java:7: error: package org.jabref.logic.importer does not exist
import org.jabref.logic.importer.ParserResult;
^
SimpleCSVImporter.java:8: error: package org.jabref.logic.util does not exist
import org.jabref.logic.util.FileExtensions;
^
SimpleCSVImporter.java:9: error: package org.jabref.model.entry does not exist
import org.jabref.model.entry.BibEntry;
^
SimpleCSVImporter.java:10: error: package org.jabref.model.entry does not exist
import org.jabref.model.entry.BibtexEntryTypes;
^
SimpleCSVImporter.java:12: error: cannot find symbol
public class SimpleCSVImporter extends Importer {
^
symbol: class Importer
SimpleCSVImporter.java:20: error: cannot find symbol
public FileExtensions getExtensions() {
^
symbol: class FileExtensions
location: class SimpleCSVImporter
SimpleCSVImporter.java:35: error: cannot find symbol
public ParserResult importDatabase(BufferedReader input) throws IOException {
^
symbol: class ParserResult
location: class SimpleCSVImporter
SimpleCSVImporter.java:14: error: method does not override or implement a method from a supertype
@Override
^
SimpleCSVImporter.java:19: error: method does not override or implement a method from a supertype
@Override
^
SimpleCSVImporter.java:21: error: cannot find symbol
return FileExtensions.TXT;
^
symbol: variable FileExtensions
location: class SimpleCSVImporter
SimpleCSVImporter.java:24: error: method does not override or implement a method from a supertype
@Override
^
SimpleCSVImporter.java:29: error: method does not override or implement a method from a supertype
@Override
^
SimpleCSVImporter.java:34: error: method does not override or implement a method from a supertype
@Override
^
SimpleCSVImporter.java:36: error: cannot find symbol
List bibitems = new ArrayList<>();
^
symbol: class BibEntry
location: class SimpleCSVImporter
SimpleCSVImporter.java:42: error: cannot find symbol
BibEntry be = new BibEntry();
^
symbol: class BibEntry
location: class SimpleCSVImporter
SimpleCSVImporter.java:42: error: cannot find symbol
BibEntry be = new BibEntry();
^
symbol: class BibEntry
location: class SimpleCSVImporter
SimpleCSVImporter.java:43: error: cannot find symbol
be.setType(BibtexEntryTypes.TECHREPORT);
^
symbol: variable BibtexEntryTypes
location: class SimpleCSVImporter
SimpleCSVImporter.java:51: error: cannot find symbol
return new ParserResult(bibitems);
^
symbol: class ParserResult
location: class SimpleCSVImporter

Seems that soething changed from JabRef 3.7 to 4.1 regarding custom filters.

Hi,

the wiki page seems outdated. The easiest way for you would be simply to check out the source code for other file based importers.
Importer Interface/Abstract class

All other filebased importers:

If you are interested in contributing a new Importer, you are also welcome to submit a Pull Request so that we can include it in JabRef for all users.
Here you can find some information

Sorry for the last response.
Finally, the original template works.
Thanks for your reply.