# Calling liquibase from java

**URL:** <https://forum.liquibase.org/t/calling-liquibase-from-java/997>\
**Category:** General Discussion\
**Created:** [December 13, 2010, 7:45am UTC](https://forum.liquibase.org/t/calling-liquibase-from-java/997 "2010-12-13T07:45:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xpoinsard](https://avatars.discourse-cdn.com/v4/letter/x/f0a364/32.png) [@xpoinsard](https://forum.liquibase.org/u/xpoinsard)\
**Post date:** [December 13, 2010, 7:45am UTC](https://forum.liquibase.org/t/calling-liquibase-from-java/997/1 "2010-12-13T07:45:00Z")

</div>

I saw that there are several ways of using liquibase (maven, servlet, command line etc…) but I doesn’t mention API call from java application.  
Is it possible or not recommended ?  
I would like to do this in order to change by program liquibase parameters like contexts and files.

---

<div class="post-metadata">

**Author:** ![xpoinsard](https://avatars.discourse-cdn.com/v4/letter/x/f0a364/32.png) [@xpoinsard](https://forum.liquibase.org/u/xpoinsard)\
**Post date:** [December 13, 2010, 7:45am UTC](https://forum.liquibase.org/t/calling-liquibase-from-java/997/2 "2010-12-13T07:45:00Z")

</div>

I just found similar question and answer : [http://liquibase.org/forum/index.php?topic=509.0](http://liquibase.org/forum/index.php?topic=509.0)  
Is this officially supported ?

---

<div class="post-metadata">

**Author:** ![alwyn\_schoeman](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@alwyn\_schoeman](https://forum.liquibase.org/u/alwyn_schoeman)\
**Post date:** [December 13, 2010, 7:45am UTC](https://forum.liquibase.org/t/calling-liquibase-from-java/997/3 "2010-12-13T07:45:00Z")

</div>

I have been using Liquibase straight from Izpack actions and the use case is very similar to how the Liquibase commandline uses the API.&nbsp; So as long as you use it in a similar fashion to how Liquibase does your code should be relatively safe.

---

<div class="post-metadata">

**Author:** ![ekupcik](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@ekupcik](https://forum.liquibase.org/u/ekupcik)\
**Post date:** [December 13, 2010, 7:45am UTC](https://forum.liquibase.org/t/calling-liquibase-from-java/997/4 "2010-12-13T07:45:00Z")

</div>

When i did this i didn’t have the time to study the “internal” APIs and just called the main method using the standard command line parameters. I am not really happy with that and want to change that sooner or later is that is a bit fishy. There is no reason why it shouldn’t work unless Liquibase changes the command line parameters. But i would suggest to use a cleaner solution.

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [December 13, 2010, 7:45am UTC](https://forum.liquibase.org/t/calling-liquibase-from-java/997/5 "2010-12-13T07:45:00Z")

</div>

Yes, it is perfectly fine to call liquibase from a java application.&nbsp; Before 2.0 we did not have our object interfaces officially supported, but with 2.0 onward they will be stable.&nbsp; Integration and extension is the primary goal of the upcoming 2.0 release.

Nathan
