Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Trying to import Library from MathLab
 Post subject: Trying to import Library from MathLab Post rating: 0   New post Posted: Fri 15 Feb, 2013, 06:26 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Dear support,

I am trying to import a couple a library from Mathlab into my strategy. But I facing several issues :

1. in all my tentative, I am getting error when compiling into JForex :
05:16:02 ----------
05:16:02 MWArray cannot be resolved
05:16:02 ^^^^^^^
05:16:02 MWArray.disposeArray(y);
05:16:02 13. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 120)
05:16:02 ----------
05:16:02 MWArray cannot be resolved
05:16:02 ^^^^^^^
05:16:02 MWArray.disposeArray(x);
05:16:02 12. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 119)
05:16:02 ----------
05:16:02 MWException cannot be resolved to a type
05:16:02 ^^^^^^^^^^^
05:16:02 catch (MWException e){
05:16:02 11. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 113)
05:16:02 ----------
05:16:02 MWNumericArray cannot be resolved to a type
05:16:02 ^^^^^^^^^^^^^^
05:16:02 res = ((MWNumericArray)y[0]).getDouble(1);
05:16:02 10. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 105)
05:16:02 ----------
05:16:02 maximux cannot be resolved to a type
05:16:02 ^^^^^^^
05:16:02 maxy = new maximux();
05:16:02 9. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 101)
05:16:02 ----------
05:16:02 MWClassID cannot be resolved
05:16:02 ^^^^^^^^^
05:16:02 x[i] = new MWNumericArray(vals[i], MWClassID.DOUBLE);
05:16:02 8. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 99)
05:16:02 ----------
05:16:02 MWNumericArray cannot be resolved to a type
05:16:02 ^^^^^^^^^^^^^^
05:16:02 x[i] = new MWNumericArray(vals[i], MWClassID.DOUBLE);
05:16:02 7. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 99)
05:16:02 ----------
05:16:02 maximux cannot be resolved to a type
05:16:02 ^^^^^^^
05:16:02 maximux maxy = null;
05:16:02 6. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 88)
05:16:02 ----------
05:16:02 MWArray cannot be resolved
05:16:02 ^^^^^^^
05:16:02 MWArray.disposeArray(y);
05:16:02 5. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 77)
05:16:02 ----------
05:16:02 MWException cannot be resolved to a type
05:16:02 ^^^^^^^^^^^
05:16:02 } catch (MWException e){
05:16:02 4. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 70)
05:16:02 ----------
05:16:02 MWNumericArray cannot be resolved to a type
05:16:02 ^^^^^^^^^^^^^^
05:16:02 res = ((MWNumericArray)y[0]).getDouble(1);
05:16:02 3. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 63)
05:16:02 ----------
05:16:02 addJava cannot be resolved to a type
05:16:02 ^^^^^^^
05:16:02 cls = new addJava();
05:16:02 2. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 60)
05:16:02 ----------
05:16:02 addJava cannot be resolved to a type
05:16:02 ^^^^^^^
05:16:02 addJava cls = null;
05:16:02 1. ERROR in C:\Users\dominique.vita\Local Settings\JForex\dominique_vita\jfxide\tmp\compile\Strategy.java (at line 53)
05:16:02 ----------
05:16:01 Compiling Strategy.java


you can see my code attached to this post.

2. I am using NetBeab as IDE for coding, every time I compile the strategy in JForex, it unedit everything I did in Netbean just before. I have to remove the strategy from JForex, and open it again so it can consider the previous modifications.

3. Please may you explain : in the external IDE, we cannot use "import" for non Jforex API library ?

Last point, do you have any sample of JForex and Mathlab, or any other mathematical packages ?

Thank you,

Dominique


Attachments:
Strategy.java [4.7 KiB]
Downloaded 282 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Fri 15 Feb, 2013, 06:47 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Hi Support,

issue solved , I was support to put all the import in one line as here :

@RequiresFullAccess
@Library("C:/Users/dominique.vita/Documents/NetBeansProjects/Depedency/maximux.jar;C:/Users/dominique.vita/Documents/NetBeansProjects/Depedency/risultato.jar;C:/Users/dominique.vita/Documents/NetBeansProjects/Depedency/add_inJava.jar;C:/Users/dominique.vita/Documents/NetBeansProjects/Depedency/javabuilder.jar")


But the other issues related to Netbean IDE and JForex are still going wrong.


 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Fri 15 Feb, 2013, 06:52 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Hi Support,
me again, Matlab is the true "parcours du combatant", please have a look to the warning I am getting after running my strategy, which call MathLab jar files;

(picture in attachment)

AND, the all JForex platform shut down...

Best regards

Dominique


Attachments:
matlabJForex.png [212.4 KiB]
Downloaded 310 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Fri 15 Feb, 2013, 13:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Does the strategy run without problems from the JForex-SDK?


 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Fri 15 Feb, 2013, 19:23 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
API Support wrote:
Does the strategy run without problems from the JForex-SDK?


Dear Support,
the strategy work perfectly in the JForex_SDK. On my side I try to digg a little bit in web and I discovered that similar error are cause of securirty setting on the applet or configured again the applet. So I am asking do you have any kind of setting or way to downgrade the applet security ?

Or do you have any idea about the possible solution to this problem ?

best regards

Dominique


 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Fri 15 Feb, 2013, 21:56 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Hi support
I did find some place over the web which may give us solution to my problem. It is related to the java security policy, with more precision in java.policy file in jre/lib/.
here are some link about this : https://blog.danieldee.com/2009/06/signing-java-applet-allowing-applet.html
and
https://www.coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem

where it is explained that it is need to change the "grant" paragraph more or less like this
 grant codeBase "https://geosim.cs.vt.edu/geosim/-" {
   permission java.io.FilePermission "<<ALL FILES>>", "read, write, execute, delete";
   permission java.net.SocketPermission "*", "accept, connect, listen, resolve";
   permission java.util.PropertyPermission "*", "read, write";
   permission java.lang.RuntimePermission "*";
   permission java.awt.AWTPermission "showWindowWithoutWarningBanner";
 };



Please support, do you have any idea ?

thanks


 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Sat 16 Feb, 2013, 17:12 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Hi,
waiting for a reply, I am still digging : I have been able to find the following usefull link about security permission and access for java applet :
https://blog.danieldee.com/2009/06/signing-java-applet-allowing-applet.html
https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_Application_Platform/5/html/Security_Guide/chap-Java_EE_Security_Manager.html
https://www.coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem
https://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frsec_javapolicy.html
https://www.ccp4.ac.uk/jwc/image_applet/Policy_file_examps_ccp4.html
https://stackoverflow.com/questions/6099661/java-policy-file-and-local-applet

I think there are closing related to the solution of my problem, so I am still on, when I get an answer I will be back;

Dominique


 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Sun 17 Feb, 2013, 07:48 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Hi everyone,

where is support ?

anyway, still digging, After following many tutorials, documentations online, I discovered the following;

1. The policy file can be mofified by the following executable :

{javahome}\jre7\bin\policytool.exe
- You should start it as "administrator"
- and you should edit the file java.policy

2. Since the error is related to the RunTimePermission at the level of "createClassLoader" I added in the rule <<ALL>>, since this is for my one PC I don't affraid for the risk.


So after doing this, the error evaluate and it have been move to Java.io.FilePermission on the java patch folder of Matlab, as shown in the picture:

so now I will try to solve this error,


see you soon


Attachments:
change_error.png [514.75 KiB]
Downloaded 286 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Sun 17 Feb, 2013, 08:37 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Wahooo huuuuuuge editing work on the policy file, after editing, jforex crashing, and more and more, here a copy of my final java.policy file :
/* AUTOMATICALLY GENERATED ON Sun Feb 17 09:30:21 CAT 2013*/
/* DO NOT EDIT */

grant codeBase "file:/C:/Program%20Files/Java/jre7/lib/ext/*" {
  permission java.security.AllPermission;
};

grant codeBase "file:/C:/windows/Sun/Java/lib/ext/*" {
  permission java.security.AllPermission;
};

grant {
  permission java.lang.RuntimePermission "stopThread";
  permission java.net.SocketPermission "localhost:1024-", "listen";
  permission java.util.PropertyPermission "java.version", "read";
  permission java.util.PropertyPermission "java.vendor", "read";
  permission java.util.PropertyPermission "java.vendor.url", "read";
  permission java.util.PropertyPermission "java.class.version", "read";
  permission java.util.PropertyPermission "os.name", "read";
  permission java.util.PropertyPermission "os.version", "read";
  permission java.util.PropertyPermission "os.arch", "read";
  permission java.util.PropertyPermission "file.separator", "read";
  permission java.util.PropertyPermission "path.separator", "read";
  permission java.util.PropertyPermission "line.separator", "read";
  permission java.util.PropertyPermission "java.specification.version", "read";
  permission java.util.PropertyPermission "java.specification.vendor", "read";
  permission java.util.PropertyPermission "java.specification.name", "read";
  permission java.util.PropertyPermission "java.vm.specification.version", "read";
  permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
  permission java.util.PropertyPermission "java.vm.specification.name", "read";
  permission java.util.PropertyPermission "java.vm.version", "read";
  permission java.util.PropertyPermission "java.vm.vendor", "read";
  permission java.util.PropertyPermission "java.vm.name", "read";
  permission java.lang.RuntimePermission "createClassLoader";
  permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete, execute";
  permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete, execute";
  permission java.util.PropertyPermission "*", "read, write";
  permission java.util.PropertyPermission "mathworks.CallWSPPEUponStartup", "read, write";
};

grant codeBase "https://www.dukascopy.com/client/demo/jclient/-" {
  permission java.io.FilePermission "<<ALL FILES>>", "read, write, execute, delete";
  permission java.net.SocketPermission "*", "accept, connect, listen, resolve";
  permission java.util.PropertyPermission "*", "read, write";
  permission java.lang.RuntimePermission "*";
  permission java.awt.AWTPermission "showWindowWithoutWarningBanner";
};

grant codeBase "file: /C:/Users/dominique.vita/Documents/NetBeansProjects/Depedency/javabuilder.jar" {
  permission java.io.FilePermission "<<ALL FILES>>", "read, write, execute, delete";
  permission java.net.SocketPermission "*", "accept, connect, listen, resolve";
  permission java.util.PropertyPermission "*", "read, write";
  permission java.lang.RuntimePermission "*";
  permission java.awt.AWTPermission "showWindowWithoutWarningBanner";
};



I know it is very highly insecure ! but dont worry, this is just for test ambient, I will modify it to be more secure or full permissive only on matlab stuff, when I will move the all on my VPS.

BUT

here are the new error :

"Failed to load nativejmi" and the boy get crashed... any insides ? any idea ?

thanks


 
 Post subject: Re: Trying to import Library from MathLab Post rating: 0   New post Posted: Mon 18 Feb, 2013, 05:36 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Hi all,
I finally get a solution; this is absolutely insecure but this is the only solution I find after editing so much that file;
I just grant all right to all applet adding the following line on the bottom of my policy file:

permission java.security.AllPermission;


So please I am requesting to the support to set/create a correct java.policy file to allow use to work with Matlab,
in the meantime, I will be able to use this one for development an test.

So now, I am figthing with JForex freezing when running my algo, but I think this have to be with my code, so I will be able to fix it, otherwise I will just use the SDK... I need my algo to be tested in Jforex

Thank you and best regards


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com