How do you prepare jar file for Invoke Java Method

I have been unsuccessful for two days to Invoke a method in any other jar file except the one provided on the UiPath sample download (“Object.jar”). I did however discover that if I double click on the Object.jar file which I can successfully use with UiPath I get an “Invalid or corrupt jarfile” from the JVM Launcher. On the files that DO NOT WORK with UiPath invoke method it doesn’t complain at all when I double click. So I am assuming that at minimum it cannot be an executable java. What other requirements are there for preparing a jar file for to be usable to call a method within UiPath?

Invoke Java Method Download

I have the same issue. I can’t analyze how the workflow works if I don’t know the content of objects.jar is.

Hello @AlienV, when you double click a jar file, in the background, the following command is executed: javaw -jar <<the-jar-you-clicked>>. When you run such a command, generally java searches for a manifest file, to find which is the main class of the .jar package that needs to be executed (maybe reading more here would help: Creating a JAR File (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files)).
I have successfully managed to load an “executable” jar file, the example is attached, you just need to set the correct path after you download it. I have also noticed that you need to specify the full class name when creating objects or invoking methods on them (“javax.swing.JLabel” etc.). My guess is that the only condition is for the file to be a correctly packed jar file. It does not need to be executable, but it can be. So, not necessarily a standalone app, but a simple library is enough.

Hello, @Munggary_Naudia, I have seen that the demo pack contains the java files included in the jar package. You can use any program that knows how to unpack a zip file to check the content of the jar file. You can even use a decompiler, to see the code inside the jar file: http://java-decompiler.github.io/.

CheckBoxJTable.zip (9.6 KB)
JavaActivitiesExample.xaml (6.6 KB)