We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting Paths on linux urgent

My case :I am trying to merge some data i have in databse [mysql] with a doc file i did that perfectly under windows

//======================================================================

<?php
require\_once("<http://localhost:8080/JavaBridge/java/Java.inc>");
//Load libraries
java\_require("C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\JavaBridge\WEB-INF\lib\Aspose.Words.jdk15.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\JavaBridge\WEB-INF\lib\jaxen-1.1.jar");
$headerFooterType = new Java("com.aspose.words.HeaderFooterType");

$doc = new Java("com.aspose.words.Document", "C:\Temp\out.doc");
$String=array("CompanyName","Address","City","PostalCode","Country");
$Object=array("123","Hello","Slah","Ferh","Opom");
$doc->getMailMerge()->execute(
$String,
$Object);

$doc->save("C:\Temp\out.doc");
?>

//======================================================================

The Problem is under linux

<?php

require\_once("<http://localhost:8180/JavaBridge/java/Java.inc>");

//Load libraries
java\_require("/usr/share/tomcat5.5/webapps/JavaBridge/WEB-INF/lib/Aspose.Words.jdk15.jar;/usr/share/tomcat5.5/webapps/JavaBridge/WEB-INF/lib/jaxen-1.1.jar");

$headerFooterType = new Java("com.aspose.words.HeaderFooterType");

$doc = new Java("com.aspose.words.Document","/home/out.doc");

$String=array("CompanyName","Address","City","PostalCode","Country");
$Object=array("12323232323","Hello","Slah","Ferhat","OpeTechCom");

$doc->getMailMerge()->execute(
$String,
$Object);

$doc->save("/home/out.doc");

?>

it returns

Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new com.aspose.words.Document((o:String)[o:String]). Cause: java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: asposewobfuscated.bt. -- Unable to call constructor, see the README section "Java platform issues" for details. VM: <1.5.0@http://gcc.gnu.org/java/>" at: #-6 php.java.bridge.JavaBridge.getUnresolvedExternalReferenceException(JavaBridge.java:427) #-5 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:498) #-4 php.java.bridge.Request.handleRequest(Request.java:447) #0 [http://localhost:8180/JavaBridge/java/Java.inc(265](http://localhost:8180/JavaBridge/java/Java.inc%28265)): java\_ThrowExceptionProxyFactory->getProxy(2, NULL, false) #1 [http://localhost:8180/JavaBridge/java/Java.inc(417](http://localhost:8180/JavaBridge/java/Java.inc%28417)): java\_Arg->getResult(false) #2 [http://localhost:8180/JavaBridge/java/Java.inc(420](http://localhost:8180/JavaBridge/java/Java.inc%28420)): java\_Client->getWrappedResult(false) #3 [http://localhost:8180/JavaBridge/java/Java.inc(602](http://localhost:8180/JavaBridge/java/Java.inc%28602)): java\_Client->getInternalResult() #4 <http://localhost:8180/JavaBridge/java/Java.inc>( in <http://localhost:8180/JavaBridge/java/Java.inc> on line 228

so any suggestions

Hi

Thanks for your inquiry. Try copying the lib folder to the root folder of your PHP project. And use relative path.

<?php 

require\_once("http://localhost:8080/JavaBridge/java/Java.inc"); 

java\_require("lib/Aspose.Words.jdk15.jar;lib/jaxen-1.1.jar");

I hope this helps.

Best regards.

The problem is in this line and i did what u said alexey.noskov but nothing happened same error

$doc = new Java("com.aspose.words.Document","/home/out.doc");

meaning the path here is \home\out.doc which cause such problem while in winodws C:\Temp\out.doc it runs perfectly

so any suggestions

Hi

Thanks for your inquiry. Maybe you can try putting your document into the root folder of your PHP project and trying using the following:

$doc = new Java("com.aspose.words.Document","in.doc");

Also for testing you can try creating empty document.

$doc = new Java("com.aspose.words.Document");

I hope this could help.

Best regards.