Hi, We check the code and it works fine with Java, and I'd like to share the code that works(Tested in NetBeans IDE 7.0).
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package launcho;
/**
*
* @author OriginLab
*/
public class LaunchO {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("---This is demo project from OriginLab---");
String strCmd = "K:\\OriginPro86\\Origin86_64.exe -r (import(K:\\data.csv);) K:\\importCSS.opj";
try
{
String strRet = exec(strCmd);
}
catch(Exception e)
{
System.out.println("Exception while execute DOS command");
}
}
public static String exec(String strCmd) throws Exception
{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(strCmd);
int nRet = proc.waitFor();
if ( nRet != 0 )
{
return "Exit code not right";
}
return "Successfully executed";
}
}
and the Origin C code which is attached to the project is like the following:
#include <Origin.h>
////////////////////////////////////////////////////////////////////////////////////
//#pragma labtalk(0) // to disable OC functions for LT calling.
////////////////////////////////////////////////////////////////////////////////////
// Include your own header files here.
////////////////////////////////////////////////////////////////////////////////////
// Start your functions here.
void import(string lpcszFileName)
{
string strCmd;
strCmd.Format("impcsv %s;", lpcszFileName);
LT_execute(strCmd);
}
Hope it will help.
If there is any further problem, would you please send you sample Java code together with your sample project and CSV files to our Technique Support team, so we can do more checking.
You could follow the instructions below to send your file.
http://www.originlab.com/index.aspx?go=Support&pid=752
Best Regards.