Hi everyone,
I just followed the instruction to using ForexConnectAPI 1.6.5 and met a small issue.
Is there someone could help me to solve it.
IDE: Eclipse 2023-3
Language: Java JDK-19
Java.library.path: .;.\bin;C:\Program Files\Candleworks\ForexConnectAPIx64\bin\java;C:\Program Files\Candleworks\ForexConnectAPIx64\bin
Java class.path: C:\Users\guest\eclipse-workspace\Forex\bin
Java working directory: C:\Users\guest\eclipse-workspace\Forex
Add external JARs: C:\Program Files\Candleworks\ForexConnectAPI\bin\java\fxcore2.jar
Code:
public static void main(String[] args) {
O2GSession session = O2GTransport.createSession();
...
}
Issue: java.lang.NoClassDefFoundError: com/fxcore2/O2GTransport at Test.main(Test.java:28)
I tried same code in MacOS/Ubuntu/Win11 and med the same issue.
Below attached official instruction for Java API using from:
http://www.fxcorporate.com/help/Java/web-content.html#order2go2_Java.html
How to include ForexConnect API in Java (Brief)
The article discusses how to include ForexConnect API in Java application.
Details
Let's say ForexConnect API is installed to C:\Program Files\Candleworks\ForexConnectAPI.
To include ForexConnect API in your Java application, you should:
Add fxcore2.jar to the libraries
In NetBeans: Libraries->Add JAR/Folder
In Eclipse: Project->Properties->Java Build Path->Libraries tab->Add External JARs
1.Add: C:\Program Files\Candleworks\ForexConnectAPI\bin\java\fxcore2.jar
2.Change working directory
In Netbeans: Run->Working Directory
In Eclipse: Project->Properties->Run/Debug Settings->New->(Select Configuration Type)->Main tab (Pick the main class)->Arguments tab->Working Directory (click "Other")
3.Add: C:\Program Files\Candleworks\ForexConnectAPI\bin
Send java.library.path to Java VM
In Netbeans: Project->Properties->Run->VM options
In Eclipse: Project->Properties->Run/Debug Settings->(pick up configuration you just created)->Arguments tab->VM arguments
4.Add: -Djava.library.path=.;./java
Add namespace com.fxcore2 to your project:
import com.fxcore2.*;
I followed the steps but it didn't work. Is there something i missed?
Kind regards,
George