Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing the Java SDK into an Enterprise Architect model

I'm using Enterprise Architect for some class modelling for a Java application, and I'd like to be able to import the Java SDK/API so that I can reference its classes in my model.

Any pointers on how to do this?

like image 724
akatkinson Avatar asked Feb 22 '23 12:02

akatkinson


1 Answers

I've done this myself a couple of times. You can download the source code for the Java runtime and reverse-engineer that, but in addition to source code EA can import a couple of binary formats, including Java byte code.

Right-click a package in the project browser, select Code Engineering - Import Binary Module, then browse to rt.jar. Make sure you do not select to create diagrams for the imported classes. On an import that size, it will take forever and I think EA may run out of memory too. Even without the diagrams, you'll have plenty of time to go get a coffee. Or lunch.

Don't create diagrams in large imports

EA will likely bump into a couple of problems with the import, but no more than a handful in the entire rt.jar so on the whole it works pretty well.

Of course, you import one very specific version of the runtime, which you need to be aware of when you make use of the classes. There's nothing stopping you from importing multiple versions of the runtime over time, but you will then need to keep track of which one you're using in each case.

There's a handy function for setting the version identity recursively, which might help. Right-click the package, select Package Control - Update Package Status. There you can set the version on all elements to 1.6.0_02, for instance.

like image 77
Uffe Avatar answered May 14 '23 05:05

Uffe