Free Support Forum - aspose.com

Can Aspose.Cells for Javascript via Java run in Electron?


#1

Hello,

I’m trying to utilize the trial version to see if it can be used in Electron for client side processing of excel files. Does anyone have any experience with that, know if it’s possible, or have an example?

When trying to require the aspose.cells index.js in my Electron main it errors out saying that it cannot find module ‘java’.

I’ve tried to do npm install java, but it fails with java.obj : error LNK2001: unresolved external symbol __imp_JNI_CreateJavaVM… - I’ve tried installing both the 32 and 64 bit versions of the JDK without success.

I realize this is an issue with the node-java package and not aspose, but figured I’d ask.

Any help would be appreciated. Thanks!


#2

I was able to finally get past the issue of installing node-java. Apparently needed the 64 bit JDK AND a restart…

Ultimately was able to utilize this in a debug electron build, but couldn’t get a packaged electron exe to work with creating the classes. Since I ran into this issue I never truly proved out if the code could actually execute and process an excel file.


#3

@traviss

Thanks for your query.

See the document with example code for your reference:

https://docs.aspose.com/display/cellsjava/Setup+Environment+and+Installation+Guidelines

Hope, this helps a bit.


#4

Thanks!

That documentation helped me get it functioning when running debug, which is essentially the same as running a nodejs server.

But once I build my production executable for electron, then it failed to load the .jar files. Looking around more it appears that other than attempting to execute a child java process through electron there isn’t support for it supporting import of those files.


#5

@traviss,

We have understood the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix (if applicable). Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJSJAVA-12 - Aspose.Cells for JavaScript via Java executable not working in Electron

#6

I appreciate you looking into it.

My initial assumption is that it’s a limitation of electron and not being able to access the .jar files in production builds (or at least in the same manner). But it would be very neat if you’re able figure out a way to get it working.


#7

@traviss,

Thanks for the additional information. We have logged this information with the ticket for our later reference while working on this issue. We will write back here after analyzing the issue in detail.


#8

@traviss,

We have installed Electron and made a simple test but could not find any issue. And we cannot find any guide for running “debug electron build” either. Would you please provide more details about the difference of “a debug electron build” and common “electron exe”, such as how to get and run a debug build? Then we will do further test and investigation.


#9

@ahsaniqbalsidiqui,

We’re just in our proof of concept phase, trying to figure out where we’ll be heading, but I do have source that I can share to you that you can use to see what I’m meaning. What’s the best way to get that to you?

We started with the angular-electron bootstrapping solution which has electron-builder built in for generating an installer.

What I mean by running a debug electron build, in our source it’s when we run npm start. This builds our angular code, hosts it at localhost, and then creates and runs the electron exe that points to localhost. It’s done this way to support hot reload of the source and in this case I believe it’s able to utilize the JRE installed on the machine and properly import the Aspose.Cells.

For running a production build, in our source it’s when we get an installer generated via npm run electron:windows. Upon completion there will be a release folder created with a pokedex-installer.exe installer file created. When you run that, after going through the Smart Screen filter since it’s not signed at this point, it will install the application and then run the exe. When it runs it will blow up trying to import the Aspose.Cells.

Hopefully that helps your testing and investigation. Just let me know how you want me to get you the source.


#10

@traviss,

Thank you for the feedback. We have logged this information for our reference and will write back here after analyzing it in detail.


#11

@traviss,

We have tested the scenario and found the issue as you mentioned. It looks more like an issue of electron to look for resources in the generated asar archive. We are afraid, currently we cannot find the solution for it either.


#12

@Amjad_Sahi

Thank you for investigating and makes sense.


#13

@traviss,
You are welcome and feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.