Calling java from matlab

Discussion in 'Java' started by Ojki, Feb 5, 2009.

  1. Ojki

    Ojki Guest

    Hi,

    I'm trying to build a database in Java (using MySQL), and the aim is
    to be able to call the connection from Matlab. I've built a .jar
    project with netbeans, and apparently it works when running in
    netbeans, but when I try to call from Matlab I've found some problems.
    I've updated my jvm in matlab, and be sure I add the project to the
    javaclasspath.
    More or less my code is as follows:

    javaaddpath('/home/ojki/Documentos/Oscar/Investigacion/DataBase/
    cardiacDataModel/dist/cardiacDataModel.jar');

    %Carga de las librerias que se utilizan, dispuestas en lib
    cd /home/ojki/Documentos/Oscar/Investigacion/DataBase/
    cardiacDataModel/
    dist/lib;
    cdir = dir('*.jar');

    for m = 1:length(cdir)
    javaaddpath(['/home/ojki/Documentos/Oscar/Investigacion/DataBase/
    cardiacDataModel/dist/lib/',cdir(m).name]);
    end


    %importar los paquetes necesarios
    import es.urjc.cardiac.dataentities.*;
    import es.urjc.cardiac.dataentities.trace.*;
    import javax.persistence.*;
    import javax.persistence.spi.*;
    %Crear una instancia de conexion
    %keyboard

    Connection.getManager

    %%%%%%%%%%%%%%%%%%%%%%%

    When I try to connect with getManager I've got this error:

    ??? Java exception occurred:
    javax.persistence.PersistenceException: No resource files named
    META-INF/services/javax.persistence.spi.PersistenceProvider were
    found. Please make sure that the
    persistence provider jar file is in your classpath.
    at javax.persistence.Persistence.findAllProviders(Persistence.java:
    167)
    at javax.persistence.Persistence.createEntityManagerFactory
    (Persistence.java:103)
    at es.urjc.cardiac.dataentities.Connection.getManagerTopLinkFactory
    (Connection.java:40)
    at es.urjc.cardiac.dataentities.Connection.getManager
    (Connection.java:
    21)


    I've used geronimo-jpa_3.0_spec_1.0.jar which provides with
    javax.persistence.

    I've tried hard to solve this problem but I wasn't be able to solve.
    Has anyone a Idea? I'll appreciate.

    Best.
     
    Ojki, Feb 5, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mohammed Smadi

    calling matlab

    Mohammed Smadi, Oct 12, 2005, in forum: Python
    Replies:
    3
    Views:
    581
    David Isaac
    Oct 25, 2005
  2. Robert Kern

    Re: calling matlab

    Robert Kern, Oct 12, 2005, in forum: Python
    Replies:
    0
    Views:
    402
    Robert Kern
    Oct 12, 2005
  3. siki
    Replies:
    0
    Views:
    961
  4. Replies:
    3
    Views:
    1,072
    nonother
    Jul 9, 2011
  5. Luna Moon
    Replies:
    16
    Views:
    1,339
    Giovanni Gherdovich
    Aug 8, 2008
Loading...

Share This Page