\label{doc_tutorials_mount-java_md_md_doc_tutorials_mount_java}%
\Hypertarget{doc_tutorials_mount-java_md_md_doc_tutorials_mount_java}%
 Mounting a Java plugin is a bit more complicated than mounting a \char`\"{}normal\char`\"{} C plugin. This is because you actually need to mount the {\ttfamily process} plugin with the correct configuration for a Java plugin.

The following snippet mounts the C plugins {\ttfamily dump} and {\ttfamily type} together with the Java plugin {\ttfamily org.\+libelektra.\+plugin.\+Whitelist\+Plugin} with the file {\ttfamily config.\+file} at {\ttfamily user\+:/tests/process}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{KDB\_VERSION="{}\$(kdb -\/-\/version | sed -\/nE 's/KDB\_VERSION: (.+)/\(\backslash\)1/gp')"{}}
\DoxyCodeLine{sudo kdb mount config.file user:/tests/process dump process "{}executable=\$(command -\/v java)"{} 'args=\#3' 'args/\#0=-\/cp' "{}args/\#1=/usr/share/java/libelektra-\/\$KDB\_VERSION-\/all.jar:/usr/share/java/process-\/\$KDB\_VERSION.jar:/usr/share/java/whitelist-\/\$KDB\_VERSION.jar"{} 'args/\#2=org.libelektra.process.ProcessApp' 'args/\#3=org.libelektra.plugin.WhitelistPlugin' type}

\end{DoxyCode}


This can get complicated very quickly. For one, you need to know that Elektra\textquotesingle{}s JARs are installed in {\ttfamily /usr/share/java} and then you need to add 7 long arguments for every Java plugin. To make this easier, we provide a helper script which can be used like this\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{sudo kdb mount-\/java config.file user:/tests/process kdb:dump java:org.libelektra.plugin.WhitelistPlugin type}

\end{DoxyCode}


The line above has exactly the same effect as the previous snippet. However, here you don\textquotesingle{}t need to know where the JARs are installed, and you just need to prefix the class names of Java Plugins with {\ttfamily java\+:}. Additionally, you can (but only have to in case of ambiguities) prefix C plugins with {\ttfamily kdb\+:}.

The {\ttfamily mount-\/java} works as is for all plugins that come bundled with Elektra. If you have external plugins, you must also specify the classpath for these plugins like this\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{CLASSPATH=/path/to/foo.jar:/path/to/bar.jar sudo kdb mount-\/java config.file user:/tests/foobar java:org.example.Foo java:org.example.Bar java:org.libelektra.plugin.WhitelistPlugin}

\end{DoxyCode}


Here we added {\ttfamily /path/to/foo.jar} and {\ttfamily /path/to/bar.jar} to the classpath, so that the classes {\ttfamily org.\+example.\+Foo} and {\ttfamily org.\+example.\+Bar} can be found. We can still use {\ttfamily org.\+libelektra.\+plugin.\+Whitelist\+Plugin}, because Elektra\textquotesingle{}s JARs are always added to the classpath. 