cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Issue on loading jar files

prao
7-Bedrock

Issue on loading jar files

HI Team,

               I am developing new plugin for ArborText Editor using java by following some reference documents and Help Center, I am facing some issue while running editor after keeping my updated files in this path "\Arbortext Editor\custom\init" I kept my .class files which having main method. And in the path "\Arbortext Editor\custom\classes"  I kept may all supported files as well as supported jar file "Customfunc.jar". I am getting below error while running Editor , could any one please suggest where exactly I am going wrong.

[A18115] Error in initialization file: C:\Program Files (x86)\PTC\Arbortext Editor\custom\init\initCust.class,

java.lang.UnsatisfiedLinkError: no Customfunc in java.library.path

With Regards,

M.Prashant

26 REPLIES 26
kjoono
12-Amethyst
(To:prao)

Hi Prashant

It is little bit strange your error :

    [A18115] Error in initialization file: C:\Program Files (x86)\PTC\Arbortext Editor\custom\init\initCust.class,

As I know, all custom Java class and .jar files shoud be placed in '/Arbortext Editor/custom/classes".

Would you like to check 'Customfunc.jar' path?

Kim, Joon O

prao
7-Bedrock
(To:kjoono)

HI,

      My main class is initCust.class and it has some imported classes which having in package com.java.cust and made as Customfunc.jar which was placed in  path i.e /Arbortext Editor/custom/classes  below is my folder structure

1)    \Arbortext Editor\custom\init\initCust.class (this class contains my main method)

2)    \Arbortext Editor\custom\classes\initCust.class

      \Arbortext Editor\custom\classes\Customfunc.jar  and this jar also tried to keep in the path \Arbortext Editor\custom\classes\com\java\cust\Customfunc.jar


Yes, I would like to check the Customfunc.jar path.

With Regards,

Prashant

kjoono
12-Amethyst
(To:prao)

Hi Prashant

Why does same name java files place two other folders?

Java class or jar file should be placed only one folder.

First I think that you should remove 'initCust.class' and 'CustomFunc.jar' from '/Arbortext Editor/custom/init' folder.

If initCust.class is not same in each folder, you should change class name and copy into '/Arbortext Editor/custom/classes' folder.

Kim, Joon O

prao
7-Bedrock
(To:kjoono)

HI Kim,

             Thanks for you kind cooperation . Now I made my code very simple, instead of creating jar , I kept all files in the class folder now I am not getting any issue. but my "CustomMenu" is not displaying on menu bar below is my sample code.

public static  void createMenu(){

try{

  MenuBar epicMenuBar = null;

Window BuildMenu = Application.getActiveWindow();    // in this line I am getting null when I debug

  MenuItem menu = BuildMenu.createMenuItem("CustomMenu");

  epicMenuBar.appendChild(hseMenu);

  }

  catch(Exception e){

  e.printStackTrace();

  }

  }

Am I missing any thing on this , kindly suggest

Thanks with Regards,

Prashant

kjoono
12-Amethyst
(To:prao)

Hi Prashant

Sorry, I don't remember customization using AOM. I have been too long sinse use it.

Is there a special reason using AOM ?

I recommend using the ACL instead of AOM. And If ACL does not provied a function, use java.

Because using ACL is faster, simpler, more easy modify than Java.

Kim, Joon O

prao
7-Bedrock
(To:kjoono)

HI Kim,

            Yes, we had a special reason for using AOM,  my requirement is some what different , the document which is loaded in the editor the data in the open document should be checked with the dictionaries which I get from services , if the words is not matching with the service dictionaries then the non matching words should be displayed with some color(red)  and need to provide that color words with context menu with the reason. So , I thought java can be followed to develop such functionality , I am new to ACL, I don't know whether it is possible to do this functionality by using ACL or not. I have nil knowledge in ACL.

By using ACL I have created menus, but I am not understanding how to edit the data in the editor with ACL . Is that possible by using ACL ?

With Regards,

M.Prashant rao

kjoono
12-Amethyst
(To:prao)

Hi Prashant

Yes, I fully understand for you opinion.

As far as I know, ACL is not easy. It may be need a lot of time to learn ACL.

I think your requirement can be fully implemented using ACL instead of AOM.

Usually ACL is used to customize UI & document and Java(not AOM) is used to implement interface for external service.

For example :

- To add custom menu, check matched word and change word color you can implement using ACL.

- To get external disctionaries you can implement using Java.

Thanks,

Kim, Joon O

prao
7-Bedrock
(To:kjoono)

HI Kim,

            Thanks a lot  for giving valuable information, Do we have any reference documents for customization of a text in document(i.e checking matching word and coloring) using ACL, I have created menus using ACL but I am not getting idea to customize the text which present in current open document.

Is there any reference example documents ? if so can u share with me.

With Regrds,

prashant

Hi Prashant--

Instead of trying to implement your own version of this, it might be easier to use Arbortext's built-in spell checking mechanism. You can provide your own dictionary of words in place of the standard one. If you can extract the word list from your web service and transform it into the format Arbortext uses, the software will handle the rest of it for you.

In the help center, look at the help for "Creating and Accessing a User-Defined Dictionary": http://support.ptc.com/cs/help/arbortext_hc/ae61_hc/index.jspx?id=help1034&action=show‌. This explains how to set up a custom dictionary.

Hopefully this will be easier than trying to implement the whole thing in Java!

--Clay

HI Clay,

            I agree with you, but my functionality is totally different, I need to check each and every word in the document at once and provide color for non matching words with context menu showing reason when I keep cursor on colored word, this is just like a plugin we are developing.

Regards,

Prashant

prao
7-Bedrock
(To:prao)

Hi Kim,

       I tried in that way too, Previously my folder structure is like below

1)    \Arbortext Editor\custom\init\initCust.class (this class contains my main method)

2)    \Arbortext Editor\custom\classes\Customfunc.jar

even though I am facing the same error "no Customfunc in java.library.path" , do I need to set this jar in any path ?

With Regards,

M.Prashant

kjoono
12-Amethyst
(To:prao)

Hi Prashant

By startup, Arbortext Editor load embeded JVM.

And JVM Version is not same each Arbortext Editor Version.

Pleaase try to step the following :

1. Select 'Tools > Preference'

2. Select 'Window' Category in Preference Window

3. Check 'Full Menus'

4. Select 'Tools > Administrative Tools > Java Console'

5. Verify JVM version

For use Java Class in ACL, your java class must be using java compiler same version as Arbortext Editor's embeded JVM.

Please check the JDK version when you compiled

Kim, Joon O

prao
7-Bedrock
(To:kjoono)

HI Kim,

               I am using same JVM version for both is  "Java VM Version 1.7.0_60 -- Oracle Corporation"

Regards,

M.Prashant rao

kjoono
12-Amethyst
(To:prao)

Hi Prashant

I want to test your issued java class.

If you possible can you share your java class ?

I think It is not difficut issue. So I want to see that.

Thanks,

Kim, Joon O

prao
7-Bedrock
(To:kjoono)

HI Kim,

            Sure , please find the attachment.

Regards,

Prashant

kjoono
12-Amethyst
(To:prao)

Hi Prashant


I checked your java source.

I found a bug in your logic. So I modified your source code.

(Please check line 31 in attached initCust.java.)


Pleaase try to step the following :

1. Copy 'initCust.class' into 'Arbortext Editor/custom/classes' folder

2. Copy 'ptc_add_menu.acl' into 'Arbortext Editor/custom/scripts' folder

3. Select 'Tools > Preference'

4. Select 'Window' Category in Preference Window

5. Check 'Command Line'

6. Type 'sou ptc_add_menu' in Command line

7. Type 'ptc_add_menu::createMenu()' in Command line

8. You can see 'CustomMenu' menu on Top Menu

Thanks,

Kim, Joon O


prao
7-Bedrock
(To:kjoono)

HI Kim,

            Thank you very much, It worked, but my custom menu is to be created at run time only I mean while I open editor it should be displayed on menu bar just like other menus. here we are typing commands to view that menu on menu bar. Do we have any way to do like that ?

With Regards,

Prashant

kjoono
12-Amethyst
(To:prao)

Hi Prashant

Sure, It's possible.

Try to copy attached 'ptc_init.acl' file into 'Arbortext Editor/custom/init' folder.

Then you can create custom menu when Arbortext Editor opened.

FYI,

If you want to create menu when only document opened, try to copy the file into 'Arbortext Editor/custom/editinit' folder.

Thanks,

Kim, Joon O

prao
7-Bedrock
(To:kjoono)

HI Kim,

           When I keep 'ptc_init.acl' file in Arbortext Editor/custom/editinit' folder then I able to see CustomMenu after loading the file, but this I cant use, And the second one changes is not reflecting, means keeping the file in init folder , I followed the same but not able to see the menu when I open the editor.

Regards,

Prashant

kjoono
12-Amethyst
(To:prao)

Hi Prashant

I am sorry, It's my mistake.

I should have checked before sending to you. But I didn't check..

I checked java code again.

And I found out some problem when get 'Active Window' in java source.

So I modified 'ptc_init.acl'.

Try to copy 'ptc_init.acl' into 'Arbortext Editor/custom/editinit' folder.

And you can see new menu whenever docuemnt opened.

When Arbortext Editor opened, you can't create menu.

Because 'initCust.java' is not proper logic.

Thanks,

Kim, Joon O

prao
7-Bedrock
(To:kjoono)

HI Kim,

           Thank you for your valuable support, If 'initCust.java' logic improper means I will not get the new menu when 'ptc_init.acl' kept in folder 'editinit' but I don't know exact how to follow. Do I am missing any thing or may be my approach is wrong  .. is there any reference doc to follow in a proper way. After creating new menu how to handle click operations, means when I click 'checkMenu' it should check the words in the current document  any reference to follow.

Regards,

Prashant

kjoono
12-Amethyst
(To:prao)

Hi Prashant

I say again, I think that you have a little misunderstand.

You just can't use scripts when 'ptc_init.acl' kept in 'init' folder. In 'editinit'' folder you can use scripts.

When you start Arbortext Editor, a script is executed in 'init' folder.

When you new or open document in Arbortext Editor, a scirpt is excuted in 'editinit' folder.

For add new menu, initCust.class' logic is used method of 'getActiveWindow'.

There is no 'Actve Window' object when Arbortext Editor start.

So you can't create menu by 'initCust.class'.

And now I don't know how to change the logic.

Unfortunately, I have no any reference, demo or material of AOM except Arbortext Help Center.

Hope that helps,

Kim Joon o

prao
7-Bedrock
(To:kjoono)

Hi Kim,

            I will check if I find any thing related, thanks for your valuable suggestions and support.

Thanks

Prashant

kjoono
12-Amethyst
(To:prao)

‌Hi Prashant

If you have another question, feel free ask me.

Thanks,

Kim, Joon o

Hi Prashant--

It will probably be easiest to manage the menus using ACL. The code is not that hard, and will be a lot simpler than trying to set up event listeners on the AOM side.

The basic command to create a new menu item is "menu_add", and the command would look something like this:

     menu_add .Edit. "Custom Menu" -cmd { java_static("Customfunc","main") }

This will call the Java static method main() on class Customfunc when the user selects the menu item.

As you and Kim noticed, if you try to run this command too early in the startup process, the Active Window doesn't exist, so there's no menu to be modified. So, you can put this in an ACL file inside custom/editinit, and then it will only run after the window has been created.

ACL has a handful of methods useful for running Java code from ACL.

  • java_static() will execute a static method
  • java_constructor() will create an object instance of a standard class
  • java_instance() will invoke an instance method of a java object created with java_constructor()

These are all documented pretty well in the Arbortext Help Center. ACL doesn't have very good support for java fields, so if you control the class you will want to be sure to define getter/setter methods for your data fields. If you don't control the class, you might have to use the reflection API to access instance fields.

--Clay

Hi Clay,

            Thanks, I will go through with Arbotext Help Center once.

With Regards,

Prashant

Announcements

Top Tags