# Demo: Running Python using the new java integration in Lucee 6.2

**URL:** <https://dev.lucee.org/t/demo-running-python-using-the-new-java-integration-in-lucee-6-2/14768>\
**Category:** language\
**Tags:** lucee-62\
**Created:** [March 2, 2025, 9:57am UTC](https://dev.lucee.org/t/demo-running-python-using-the-new-java-integration-in-lucee-6-2/14768 "2025-03-02T09:57:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [March 2, 2025, 9:57am UTC](https://dev.lucee.org/t/demo-running-python-using-the-new-java-integration-in-lucee-6-2/14768/1 "2025-03-02T09:57:50Z")

</div>

Here’s a quick example of how to run Python using [Graalvm](https://www.graalvm.org/latest/reference-manual/python/) with Lucee 6.2

Lucee will dynamically download the java libraries defined in the javaSettings (when required), it’s that simple!

The jars are stored in the `lucee-server\context\mvn\` directory.

**EDIT** it’s `lucee-server\mvn\`

 ![image](https://dev.lucee.org/uploads/default/original/2X/9/96b40ee673f5908c02861df30558af84ec98d2e3.png)

We also added support for the more concise Graal style syntax  
`"org.graalvm.polyglot:polyglot:24.1.2"`

Note the use of static syntax `::` when calling java functions directly

```auto
<cfscript>
	python = new component 
		javaSettings = '{ maven: [
			"org.graalvm.polyglot:polyglot:24.1.2",
			"org.graalvm.polyglot:python:24.1.2",
			"org.graalvm.python:python-language:24.1.2"
		]}'
	{
		import org.graalvm.polyglot.Source;
		import org.graalvm.polyglot.Context;
		import java.io.File;

		function executePython(src) {
			var c = Context::newBuilder(javaCast("String[]",["python"]))
				.allowAllAccess(true)
				.allowExperimentalOptions(true)
				.build();
			
			//echo(c.eval("python", "print('Hello from GraalPy!')"));
			script = Source::create("python", src);
			c.eval(script);
			result = c.getPolyglotBindings().getMember("hello").execute(["hello lucee"]); 
			return result.asString();
		}
	};
</cfscript>

<cfsavecontent variable="python_src">
import polyglot
@polyglot.export_value
def hello(externalInput):
	return 'Got output from graal python: ' + externalInput
</cfsavecontent>
<cfscript>
	dump(python.executePython(python_src));
</cfscript>

```

![image](https://dev.lucee.org/uploads/default/original/2X/4/43053026fdeb406250b36113cccbe15a6500c189.png)

Here’s are some posts relating to the new functionality being used in this example

> [@Interacting with Java Libraries in Lucee 6.2](https://dev.lucee.org/t/interacting-with-java-libraries-in-lucee-6-2/14362):
>
> With Lucee 6.2, one of our main objectives was to simplify Java integration as much as possible. We focused on making it easier to load libraries and adapt existing Java code to work seamlessly in Lucee. To achieve this, we approached it with a simple challenge: pick a third-party Java library and try to use it in Lucee with the least amount of friction. If we encountered any hurdles, we adapted Lucee accordingly. In short, we learned a lot from real-world examples and worked to overcome any une…

> [@Inline components in Lucee 6](https://dev.lucee.org/t/inline-components-in-lucee-6/8499):
>
> We are working to support for inline components in Lucee 6 and they can be defined in a similar way you define closures inside a .cfc or .cfm template today. test=component { function init(caller) { variables.caller=caller; } function getCaller() { return variables.caller; } } dump(test.getCaller()); Like a closure the inline component should “see” the caller scope (birth place). But in contrast to a closure this is not happening implicitly, because we do not want to br…

> **[Java in Functions and Closures :: Lucee Documentation](https://docs.lucee.org/recipes/java-in-functions-and-closures.html)**
>
> Learn how to write CFML code directly in a function or a closure with Java types in Lucee. This guide demonstrates how to define functions and components with Java types, and how to use Java lambda functions within Lucee. You will see examples of how...

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [April 6, 2025, 9:59pm UTC](https://dev.lucee.org/t/demo-running-python-using-the-new-java-integration-in-lucee-6-2/14768/2 "2025-04-06T21:59:11Z")

</div>

> [@Demo: Rendering SVG using Batik](https://dev.lucee.org/t/demo-rendering-svg-using-batik/14951):
>
> Another quick demo of using the new Java Integration in Lucee 6.2 \<cfscript\> svgRender = new component javasettings='{ maven: ["org.apache.xmlgraphics:batik-transcoder:1.18", "org.apache.xmlgraphics:batik-codec:1.18"] }' { import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.File; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.image.PNGTranscoder; import org.a…

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [May 10, 2025, 11:53am UTC](https://dev.lucee.org/t/demo-running-python-using-the-new-java-integration-in-lucee-6-2/14768/3 "2025-05-10T11:53:35Z")

</div>

Split this topic on May 10, 2025, 11:53am UTC

6 posts were split to a new topic: [Can’t find /mvn directory with 6.2](https://dev.lucee.org/t/cant-find-mvn-directory-with-6-2/15111)
