Free Support Forum - aspose.com

Aspose.Words for Java not working under Java Runtime 1.7



Hi,

We have been using Aspose.Words for Java three years now to great satisfaction of our users.
It is being used as an external Java library in our ARIS business process modeller tool, which is used by more than 100 users.

Thanks to the Aspose library we can make report output, which are created with custom made Javascript programs within the ARIS environment, much more sophisticated.
In fact it was so successful that the latest ARIS versions are shipped with a stripped version of the library, which can be used with new script methods within ARIS.
However we intend to keep using the external Java library, as it is much more comprehensive.

Recently, owing to an upgrade of Java Runtime to 1.7, we had to upgrade the ARIS system.
As a result Aspose.Words for Java does not work anymore in our ARIS environment
.
Each time the “new Document()” command is invoked, this error is displayed:

“TypeError: [Java package com.aspose.words.Document] is not a function, it is object.”

Following are the relevant lines from the Javascript script:

var ASP = JavaImporter(Packages.com.aspose.words);
var Document = Packages.com.aspose.words.Document;
var DocumentBuilder = Packages.com.aspose.words.DocumentBuilder;
var HeaderFooterType = Packages.com.aspose.words.HeaderFooterType;
var Underline = Packages.com.aspose.words.Underline;
var license = new ASP.License();
license.setLicense(“Aspose.Words.lic”);
var doc = new Document();

The script stops at the last line “new Document()” and displays the above error.

I’ve downloaded the most recent version of Aspose.Words for Java and used both Aspose.Words.jdk15.jar and Aspose.Words.jdk16.jar files.
Neither one works correctly in our upgraded system. Both have the above issue.

Since you stated on the website Aspose.Words for Java is compatibel with Java Runtime 1.7, I expected a Aspose.Words.jdk17.jar file. However the download only contains jar files named jdk14, jdk15 and jdk16.

My questions:
1. Do you have a workaround for the above problem?
2. Is the most recent version of Aspose.Words for Java indeed compatibel with Java Runtime 1.7 ?
3. How soon will Aspose.Words for Java be upgraded and will the new version include a Aspose.Words.jdk17.jar file?


Carl

Hi Carl,


Thanks for your inquiry.

If I am to guess, may be you should insitialize Document object as follows:
var doc = new ASP.Document();

Currently, we don’t ship a separate library specifically written for Java 7; however, Aspose.Words supports J2SE 7.0 (1.7); so, please use 1.6 libraries . For more information, please read the following article:
http://www.aspose.com/docs/display/wordsjava/System+Requirements

Please let me know if I can be of any further assistance.

Best regards,

Thanks for your reply, Awais.

I’ve tried your suggestion, but unfortunately still the same “typeError” error.

As I’ve already stated, we have been using Aspose.Words for Java three years with Java 1.5 and Java 1.6 with the same program code without any problem.

Now, for the first time, since we upgraded to JRE 1.7, we use a different jdk Apose version (jdk16), we’re not able to use it.

If Apose will not ship a separate library for Java 1.7 in the very near future, I think it will lose many customers.

We were planning to upgrade our Aspose license in May, but if the situation doesn’t change, we will have to cancel it.

Best regards,
Carl

Hi Carl,


Thanks for your inquiry.

First of all, please note that we exercise Unit Testing and all of our unit tests are properly structured. Some time ago, we had launched all of our 10k+ test units under jre7 environment using Aspose.Words jdk1.5 and jdk1.6 JARs and all worked just fine. Therefore, upgrading to the latest version of Aspose.Words for Java and usage of jdk1.6 libraries are safe and they should cause no undesired behaviour. Since all Aspose.Words functionality is unit tested so everything in the previous versions shall still be working in the newer versions and of-course under Java 7 runtime as well.

Unfortunately, we do not have any plans to ship a separate library (jdk.1.7) i.e. specifically written for Java 7 runtime and hence, I am afraid, it leaves you with the only option i.e. using jdk1.6 jar. In rare cases like yours, we apologize that the functionality is broken.

Since I don’t have the ARIS environment configured on my side, I’m afraid I can’t reproduce this issue on my side. But, could you please try creating a new ‘Hello World’ type custom made JavaScript project under your ARIS environment, import jdk1.6 library in it and see if the issue disappears? Thanks for your cooperation.

Best regards,

Hi,
I’m afraid it’s not JDK 1.7 which causes the problem but the Aspose.Words version shipped with the latest Version of ARIS. Maybe your Aspose.Words license file does not cover the latest version 11.9.0 which is shipped with the latest ARIS version 7.2 SR4.

BR,
Torsten

Hi Torsten,


Thanks for your inquiry.

In my previous post, by using/importing jdk1.6 library/jar, I meant you should add a reference to Aspose.Words’ API in your project by navigating to the ‘lib’ folder (where Aspose.Words for Java’s JAR files are located) and selecting the ‘Aspose.Words.jdk16.jar’ file.

Secondly, you can check the expiration date of your license by opening the license file in notepad. There, you will see the following tag:

20110218

It means that you can free upgrade to version of Aspose.Words released before 02/18/2011.

Best regards,

Hi Awais,

I do not have any issues regarding this topic. I developed the environmet the requestor (sagan) is working with and I wanted to help him :slight_smile:

He works in an embedded JavaScript environment in our product, which uses Aspose.Words internally. We locked the Aspose.words API from being accessed from JavaScript to fulfil your license terms, so he needs an own license to work with you API. Our latest product version (ARIS 7.2 SR4) uses Aspose.words 11.9.0, so he needs a new license from you which covers this version.

BR,
Torsten

Awais,

In order to test with an updated license, I’ve tried several times to obtain a new temporary license via the “Get a temporary license” procedure on this website. Although each time the end result looks successful (a message that states that the license will be sent appears), nothing has been sent to my account.
I’ve sent you several private messages about this, but I haven’t received a reaction.
What is the problem, why this silence?

Btw, the license I´m working with is still valid, it expires June 18, 2013.

Carl

Hi Carl,

Thanks for your inquiry.
Carl:
In order to test with an updated license, I've tried several times to obtain a new temporary license via the "Get a temporary license" procedure on this website. Although each time the end result looks successful (a message that states that the license will be sent appears), nothing has been sent to my account.
You do not need to request a temporary license multiple times; our sales team will review your request and forward you the temporary license shortly. You can also post your query directly in Aspose.Purchase forum here where you will be guided appropriately.
Carl:
I've sent you several private messages about this, but I haven't received a reaction.
What is the problem, why this silence?
I did receive a couple of your private messages which I replied in a timely manner. You can find those private messages below:

<a href="</a></div><div><br></div><div>It could be that you did not find my replies because my replies were delivered to junk folder. Please check your junk/spam email folders. Moreover, we will further look into this if there is something wrong with the private message notifications.</div><div><br></div><div>Best regards,</div></div></div>

Awais,

Thanks for your answer.
I’ve checked my junk/spam email folders: I can’t find any aspose related emails.

I have again, for the fourth time this month, submitted an application for a temporary license. This time directly in the Aspose.Purchase, via the links you have supplied.
And again, complete silence.
I’m a patient guy, but this is very frustrating. We need the license in order to establish we can get our application working under JRE 1.7.

Again I ask you and your colleagues: what is the problem?
Why is it not possible to obtain a temporary license anymore?

Also, the private message notification on the web site definitely does not work or is not available for customers like me. Please fix this.

Carl

Hi Carl,


Thanks for your inquiry. We apologise for any trouble getting a new temporary license, I have released one to you which should arrive in your mail box shortly.

Regarding your other issues, the support developers will help you with these.

Thanks,

Hi Adam,

Thanks for sending the new license, but unfortunately I haven’t received it.
Would you please resend it?

I recently changed my email address on this website, but I made a mistake in the domain name.
I have fixed it to the correct name.

Thanks in advance,
Carl.

Hi Carl,


Thanks for this additional information.

I have resent the license to you manually, please let me know if it doesn’t arrive.

Thanks,

After having applied the new temporary license, results were still the same.
I’ll wait for a new aspose version. If that doesn’t work either, it’s the end here for the aspose package.
We will not renew the license, which will expire in June.

Carl.

Hi Carl,


Thanks for your inquiry.

Did you try upgrading to the latest version of Aspose.Words for Java i.e. 13.4.0?
Could you please provide a little more information about the Aspose.Words’ version number for which there were no problems on your side previously?

Rest assured, the latest version of Aspose.Words for Java is compatible with Java runtime 1.7. Moreover, I think, you should contact Torsten who developed the latest ARIS environment, maybe he will be able to guide you as to how you should instantiate Document instance.

If we can help you with anything else, please feel free to ask.

Best regards,

Awais,

Yes, I tried the latest version 13.4.0. Results were the same as above.

Here’s info for the version which is working fine:
File “Aspose.Words.jdk15.jar” dated 3-Nov-2009
Developer OEM/Enterprise
License expiry: 20130618, version 2.2

@Torsten, if you have any suggestions or new insights, please let me know.

Best regards,
Carl

Hi Carl,

“TypeError: [Java package x.y.z] is not a function, it is object.” is JavaScript error that states that it can’t find referenced class (in our case:)).

Please call ‘Alert(com.aspose.words.Document);’. It should return ‘JavaClass’ if JS found your class.

You don’t need in any License in this stage. Without license Aspose.Words will be launched in demo mode.

Regards,

Hi Konstantin,

Thanks for the suggestion. Unfortunately this doesn’t work.

This is the error after “Alert(com.aspose.words.Document)”:
ReferencError: “Alert” is not defined

And this is the error after “java.Alert(com.aspose.words.Document)”:
TypeError: Cannot call property Alert in object [JavaPackage java]. It is not a function, it is “object”.

“test = com.aspose.words.Document.alert” works but yields test as an object.

Is there any other way to call the Alert class?

Regards,
Carl

Alert() is JavaScript built-in function. You wrote that you launch Aspose.Words from JavaScript environment, isn’t it?

Yes, that’s correct.

This is the way it’s launched:

var ASP = JavaImporter(Packages.com.aspose.words);
var Document = ASP.Document;
var doc = new Document();

The error occurs on the last line.

Carl