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.

Library include problem
 Post subject: Library include problem Post rating: 0   New post Posted: Tue 09 Mar, 2010, 01:29 
User avatar

User rating: 0
Joined: Thu 16 Jun, 2011, 21:37
Posts: 98
Location: SwitzerlandSwitzerland
Hi all,

I've been developing my strategy in netbeans up until now. I created some of my own classes which I'd like to use in the jForex applet for back testing. I've copied the jar file into the strategies/files folder as mentioned in: viewtopic.php?f=5&t=477&p=1427&hilit=Library#p1427

I've tried the following things:
1) copying jar file generated at build in the "dist" folder from my netbeans project folder
2) creating a separate project using the netbeans new project wizard and selecting "java class library"
3) following these instructions and building my jar manually: https://java.sun.com/docs/books/tutorial ... build.html

The error I get by 1) and 2) in jForex is "Package annotations must be in file package-info.java". I'm not sure if it's the javadoc options in netbeans which need to be tweaked where the problem lies....
For 3) I don't even get the jForex to recognize the jar file...which was very weird.

Thanks,
jForexUser


 
 Post subject: Re: Library include problem Post rating: 0   New post Posted: Wed 17 Mar, 2010, 10:04 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
please consider this sample https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=7&t=225&p=3666&hilit=send+mail#p3666
This is sample with java-mail.jar file. Please, verify that this is working for you.
Here can you download javamail.jar file https://java.sun.com/products/javamail/downloads/index.html


 
 Post subject: Re: Library include problem Post rating: 0   New post Posted: Sat 20 Mar, 2010, 16:44 
User avatar

User rating: 0
Joined: Thu 16 Jun, 2011, 21:37
Posts: 98
Location: SwitzerlandSwitzerland
I've tried out the example and have only changed @Library("C:\\temp\\mail-1.4.jar") to @Library("mail.jar"). I unpacked the javamail jar to my "files" folder.
This compiles fine for me and I'm still thinking it has to do something with a compiler option which jForex uses or some setting in netbeans.

Could you try compiling a custom class in netbeans and then including the jar file in an empty jForex strategy?

thanks again for the help!


 
 Post subject: Re: Library include problem Post rating: 0   New post Posted: Mon 29 Mar, 2010, 14:08 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
we prepared custom jar file. It consist only of one class TestingOutput, which simply prints on the java console: "Printed from jar". Here is source code for the TestingOutput class:
package com.dukascopy.test;

public class TestingOutput {
   public static void println(){
      System.out.println(" Printed from jar ");      
   }
}

And here is a source code for the strategy.
    .  .  .
import com.dukascopy.test.*;
    .  .  .
@Library("C://Temp//test.jar")
public class Strategy implements IStrategy {

   public void onStart(IContext context) throws JFException {
        TestingOutput.println();
   }
    .  .  .


 
 Post subject: Re: Library include problem Post rating: 0   New post Posted: Mon 29 Mar, 2010, 15:30 
User avatar

User rating: 0
Joined: Thu 16 Jun, 2011, 21:37
Posts: 98
Location: SwitzerlandSwitzerland
ok thanks for this simple example! I have been able to get this compiling...mine is still coming up with the error...I have some new ideas, will try them out and will report back with some (hopefully good) results :)

thanks again!


 
 Post subject: Re: Library include problem Post rating: 0   New post Posted: Mon 29 Mar, 2010, 21:31 
User avatar

User rating: 0
Joined: Thu 16 Jun, 2011, 21:37
Posts: 98
Location: SwitzerlandSwitzerland
ok, so I've solved the problem. I had apparently named the package and strategy the same name.
I had
package Strategy;

and then
....
public class Strategy implements IStrategy {
...

The compiler doesn't like this and that's why I was getting the error "Package annotations must be in file package-info.java".

Thanks for the help :)


 

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