Author Topic: Need Help with JAVA API for Sparx EA  (Read 6367 times)

Risky

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Need Help with JAVA API for Sparx EA
« on: January 21, 2017, 01:47:26 am »
Friends,

I'm absolutely new to Sparx EA and know Java.

I want to write a Java code to connect to an existing repository (which is in SQL db).
my use case is to find what package under a specific element was modified in last 24 hours.

I tried following, but am getting this error:

       org.sparx.Repository repo = new org.sparx.Repository();
       repo.OpenFile("Connection String to DB");
       System.out.println(Repository.class);
       repo.CloseFile();

error:
Exception in thread "main" java.lang.Exception: Failed to construct object. Error code: 0x80004002
   at org.sparx.Repository.comConstructor(Native Method)
   at org.sparx.Repository.<init>(Repository.java:190)
   at ConnectEARepo.main(ConnectEARepo.java:6)

Appreciate your help

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Need Help with JAVA API for Sparx EA
« Reply #1 on: January 21, 2017, 02:56:39 am »
Have you tried the simple case with a path to an EAP first?

q.

Nabil

  • EA User
  • **
  • Posts: 147
  • Karma: +5/-2
    • View Profile
    • View My LinkedIn Profile Here
Re: Need Help with JAVA API for Sparx EA
« Reply #2 on: January 23, 2017, 04:33:55 pm »
Hello,

You can refer these

https://exploringea.com/2013/12/11/ea-automation-with-java/

Refer C:\Program Files (x86)\Sparx Systems\EA13\Java API

C:\Program Files (x86)\Sparx Systems\EA13\Code Samples\Java_Sample


BR
Nabil
Nabil

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13295
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Need Help with JAVA API for Sparx EA
« Reply #3 on: January 27, 2017, 11:02:14 pm »
Java and EA are really not the best of friends.
If at all possible you better switch to C#

Geert