The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Importing jar files for script operartor
Dear All,
Is it possible to make imports to third party jar files in the script operator?
For example:
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
I'm unsure when I can set the class path so it actually recognizes these classes.
Best regards,
Wessel
Is it possible to make imports to third party jar files in the script operator?
For example:
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
I'm unsure when I can set the class path so it actually recognizes these classes.
Best regards,
Wessel
0
Answers
RM6 builds the classpath on-the-fly when being started. Just put the .jar file in the /lib folder. Afterwards you should be able to import the classes (if the .jar's dependencies are fulfilled).
Best,
Nils
I hope it's ok to answer to this topic, otherwise please just move this topic or tell me to do so...
I am using RM5 community version and want to include my jar-file so that I can use it in the script-operator.
But copying the jar-file to the lib folder did not work for me....I always get the error java.lang.NoClassDefFoundError. Could this be caused by missing dependencies in my jar-file? My jar-file only contains Logger.class and Logger$1.class.
Logger.java:
you will need to add your .jar file to the classpath of RapidMiner. You can either manipulate the .bat start script and add your .jar to the -classpath attribute (probably the easiest way), or you could extract the rapidminer.jar with a zip program of your choice, edit the /META-INF/MANIFEST.MF file by adding the name of your .jar to the list of .jar files in the classpath attribute already present and then rezip everything up into the rapidminer.jar again.
Regards,
Marco
thanks for your help. I tried the hard way with extracting, adapting the MANIFEST.MF and putting it all back together but didn't manage to do so...after that I had to install RM again. With this new RapidMiner the .bat scripts in the script folder are working again but my .jar is still not recognized in the script operator....
I didn't need to adapt the .bat files because it adds all .jar files in the lib folder to the classpath...at least I think so. I added an echo for the RAPIDMINER_LIBRARIES variable to check if my jar appears in it and it does. You can see this in the log file I created by running the .bat file via cmd (the classpath in the .bar file is later set to: set COMPLETE_CLASSPATH=%RAPIDMINER_CLASSPATH%;%RAPIDMINER_LIBRARIES%): the jar-file I want to add is called dailab.jar. So whatelse can I try to get the .jar file available in the script operator? Or is it wrong to just import the package I defined for my class I want to use?
Regards,
elnecesario
the jar seems to be available at runtime, so now I'd like to see the xml of your process which contains the Execute Script operator.
Regards,
Marco
here the xml: and here the error message that pops up:
https://www.dropbox.com/sh/dhd4t4qvsbkm3cy/AACg4qUSeCc0NXwzDKUBXvgia
Regards,
elnecesario
the error message and the code you posted earlier do not match, they show the same class in two different packages. I assume the code example is no longer up to date and the package structure now matches in the .jar and in the script import statement?
Regards,
Marco
yes you are right, I changed the package name, sorry....
here is the up-to-date dailab.jar:
https://www.dropbox.com/s/7fay3keet3fnwhi/dailab.jar
btw.... how can I upload files to the forum instead of linking to my dropbox? One day I may delete the files in my dropbox and than my posts may not be as helpfull anymore to other people....
Regards,
elnecesario