Re: [api-dev] Re: OOoBean
On Wed, 19 Jan 2005 20:40:32 +0100 Jochen Staerk [EMAIL PROTECTED] wrote: Hi, I always thought that adding the class path to your manifest would be sufficient and has the same effect than using the cp-commandline switch but I could be completely mistaken. I thought a MANIFEST like this would work: --8-- Manifest-Version: 1.0 Main-Class: at/bestsolution/oeush/members/MembersAdmin Class-Path: lib/a.jar /usr/lib/openoffice/program/classes/officebean.jar ... 1) I'm not sure I'm right either, today was the first time I learned about how to add classpaths to manifests but 2) AFAIK manifest-classpaths can be relative and CLASSPATHs are absolute. And with a manifest very similar to yours (adding jurt and juh.jar and stuff) I get a libofficebean.so not-found-exception. bye, Jochen Hi Jochen, normally if you have the oo-jars (all from oo-home/program/classes) in your classpath (manifest or CLASSPATH or with the -cp switch) the libraries are found. There is a helüper-class, which load the native-libraries in the parent-directory of officebean.jar (if the library is not in LD_LIBRARY_PATH or %PATH% on Windows). If you want to deploy your application together with the oo-jars (in a relative subdirectory) the native-libraries cannot be found. If I understand you correct and you want to deploy your application (some mails above on this list) on different systems and OS. You have to find a way to set the correct-classpath and native-ölibrary-path on the target system. You can use start-scripts (run.bat run.sh) which create a classpath and launch your application with java -cüüp mypath my.package.Main. But the users have to set the OO-path by hand before. In this case you cannot use a selfstarting jar. You can use a classloader to load your application. There you can use a selfstarting jar (double-click on Windows). There are some launcher-projects available like: http://jakarta.apache.org/commons/launcher/ You can develop your own Launcher and add the oo-jars from the target-system to your application. Example: create a subdirectory 'lib' of your application and add there all your application-jars. In the parent-directory place the launcher-class or self-starting jar like(untested): import java.io.*; import java.net.*; import java.util.*; public class Launcher{ public Launcher(){ } public static void main(String[] args){ Launcher l = new Launcher(); l.launchApplication(args); } public launchApplication(String[] args){ ArrayList urls = new ArrayList(); //add your application jars addJars(urls,lib); //get now the path of the OO-installation //from a property-file, dialog or scan the filesystem String oopath = get...(); //add all to the classpath addJars(urls,oopath); //create URL[] from the urls-List URL[] classpath ... URLClassLoader loader = new URLClassLoader(classpath); //now load your application Main-class and start this try{ Class clazz = loader.loadClass(my.Main); //get the main-method Class[] params = new Class[1]; params[0] = args.getClass(); Method m = clazz.getDeclaredMethod(main,params); //prepare the args Object[] methodparams = new Object[1]; //the args from the commandline methodparams[0] = args; //lauch the application m.invoke(null,methodparams); }catch(Exception e){ //handle this } } private void addJars(List list,String dir){ File f = new File(dir); if(f.isDirectory()){ File[] jars = f.listFiles(); for(int i=0;ijars.length;i++){ if(jars[i].getName().toLowerCase().endsWith(.jar)){ try{ list.add(jars[i].toURI().toURL(); }catch(Excpetion e){ //handle this } } } } } } This will launch your application with custom-classloader, which puts the oo-jars to his classpath. On the windows-platform you will get problems if the oo-home/program directory is not int the %PATH%. You can preload the native-libs, but you need the right order of the libs and this can simple changed by newer OO-releases. I hope this can help. Best Regards, Simon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Re: OOoBean
Hi Simon, and thanks for your answer and the classloader-sample-code, normally if you have the oo-jars (all from oo-home/program/classes) in your classpath (manifest or CLASSPATH or with the -cp switch) the libraries are found. There is a helüper-class, which load the If you want to deploy your application together with the oo-jars (in a relative subdirectory) the native-libraries cannot be found. OK If I understand you correct and you want to deploy your application (some mails above on this list) on different systems and OS. You have to find a way to set the correct-classpath and native-ölibrary-path on the target system. OK. That's what I want to do; deploy my application (if possible as a single java JAR) to users which use different OSses and have their OOs in different locations. I do not need to have officebean.jar in my JAR, but I'll explain why that would have helped in the next paragraph. I won't do it, anyway, because this obviously is not the way it's ment to be. You can use start-scripts (run.bat run.sh) which create a classpath and launch your application with java -cüüp mypath my.package.Main. But the users have to set the OO-path by hand before. In this case you cannot use a selfstarting jar. OK. Additionally, I can not use a selfstarting JAR if I do not have a classloader or a launcher application that changes the JAR-Manifest according to the user's OO-location because a java -jar-Application won't react on the -cp-Argument nor or the CLASSPATH-environment. (http://java.sun.com/j2se/1.4.2/docs/tooldocs/findingclasses.html, The JAR archive specified by the -jar option, which overrides all other values. If this option is used, all user classes come from the specified archive.) You can develop your own Launcher and add the oo-jars from the target-system to your application. Example: ... On the windows-platform you will get problems if the oo-home/program directory is not int the %PATH%. You can preload the native-libs, but you need the right order of the libs and this can simple changed by newer OO-releases. Do you mean this order can change in a newer OO-release or this problem can be resolved by using a newer OO-release? I hope this can help. very much, thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Re: OOoBean
Hi Simon, I mean the order can changed by newer releases. The officebean.dll depends on MSVCR70, UWINAPI, sal3, jpipe (this is the order to load it). But this can be changed with OO2.0 or 1.1.x. I have not looked at OO2.0 and I don't know if the new OfficeBean will handle this self, Yes, OOoBean (the new Java Bean baseclasss for OOo) does load these libraries. But if you translate it yourself with a new compiler, other libraries might be needed. Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] AGAIN: auto grammar checking
Following Michael Hoenig's advice (unanswered questions), here I am again. AIM: check the current API's support for prototyping a grammar-checker API externally, i.e. without messing with OOo's source. MY QUESTIONS TO API DEVELOPERS REGARDING THE CURRENT API'S CURRENT FEATURES (not necessary now to answer HOW, just if the following are possible and an idea of difficulty level) 1 - Can specific context menus be assigned to specific portions of text? 2 - Can a specific portion of text be assigned a user-defined property, e.g. its language? My (not new) idea is let the user specify which language(s) they intend for each portion of text. 3 - Can error underlining (like the curly red one for auto spell-checking) be assigned to specific portions of text in a way that it would neither (i) conflict with end users' formatting nor (ii) be printed out eventually? 4 - Is it possible to implement a service, component or whatever might be plugged-in through the API such that: it _concurrently_ looks for visible text, breaks visible paragraphs into sentences, checks them for grammar and _asynchronously_ request the API to perform (1), (2) and (3) above? Thanks in advance! Cheers, Jorge. Quoting Michael Hoennig [EMAIL PROTECTED]: Dear OpenOffice.org community, We really would like to see all questions answered, but we need your help to keep track of your questions and their answer status. Thus, if you still have a question unanswered for more than two days, feel free to place a reminder on the list. But maybe you should think about simplifying your question, strip down your code example etc. I'd like to remind that this mailinglist is not a support forum. We core developers like to see all questions answered, but we cannot do your work. Thus, even though some background information can be helpful, phrase your question as easy as possible to us and focus on the OOo API rather then your application. Michael -- http://api.openoffice.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Collaborative macro development and an expt with a Find Files macro
I have been blathering on for some time about the need for an environment that facilitates collaborative development of OOo macros. I have decided (being rather stupid I needed others to recommend this) to try using Issue Tracker. As an experiment I have cobbled together a macro for finding OOo files that match user specified criteria including text within the file. I have posted the file to: http://qa.openoffice.org/issues/show_bug.cgi?id=41011 I encourage people to pull apart what I have done so that it can either be improved or discarded as a waste of time. Thanks, Ian Laurenson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]