Java Exelsior error when using on other computers - java

I am using Excelsior to make my jar executable into a .exe and I'm getting errors when putting the exe and folder contents on another computer. The program packs what looks like the java run time into a folder called 'rt'. The .exe runs fine on my own computer but when I try on others I get this error:
Invalid Excelsior JRE directory "C:\ programFolder\rt": path canonicalization failded
Anyone know what could cause this error or if you have used Excelsior could you help me out with this? I have posted on their forums but with no luck.

Are you sure you are copying the EXE file that was processed by the packager (JetPackII), not the EXE emitted by the compiler?
Also make sure to install the latest updates (for Excelsior JET 9 it is Maintenance Pack 2 as of today.)

Related

The jar files IntelliJ creates do not work on computers without jdk

I think this stackoverflow question already has my answer: IntelliJ runnable jar doesn`t work on other computers
The answer on this question states that most IDEs can autoinclude the needed java libraries to make the jar runnable on pc's without jdk. My question is, where in IntelliJ can I make sure that these libraries are included?
In my project java 15 jdk already shows as external library: link to screenshot
This is what my artifact settings look like: link maybe I need to change something here?
Edit: My question is this: The jar file IntelliJ produces works fine on my computer. On my friends computer excecuting the file gives an JNI error. He only has JRE on his computer and not JDK. I am assuming the problem has something to do with this. How can I make sure the jar file runs on computers without JDK and with JRE?
Your program can run without the jdk but it will need a jre -- the Java Virtual Machine is needed.
You can create this on Java 11 and above using jlink which creates a custom cut-down Java runtime, along with your code, that can be executed on a different computer. However, it will have to be the same architecture/operating system; you can't run the Windows JVM on macOS or vice-versa, for example. Your application code, in the .jar, will be the same on both though.

Running Windows-Compatible .jar files on Linux?

Our CE project includes a .jar file which is written for Windows only for some reason. Unfortunately, I do all my coding related projects on Ubuntu and I'm really not willing to install VS on windows and start over on a new environment and lose a lot of efficiency.
The jar file requires some other files to work but the directory formats differ in Linux so I'm getting errors of it not finding the files when I try to open it from Linux.
I've already asked for the source code or a more compatible version but the TA's aren't really cooperative in my case.
Is there any way I could circumvent this problem and fix the incompatible directory formats issue(For example by running through wine)?
Edit: I tried decompiling the jar, but it wasn't fully successful and some of the files came out corrupted.
Because the original maintainers didn't think that this JAR would be run on other OSes, you're stuck placating their arbitrary requirement. You're going to want to use a VM (Wine isn't an emulator and you're going to run into significant pain using it and Java to run a JAR) to set this up and execute their JAR.
Once you get a hold of the source, you can build a new JAR which asks the OS which file separator to use instead of allowing the code to assume Windows. Or use NIO.

How to run a java executable file on other computer

I made a small application using Java Swings and then created a jar file of the project using 'clean and build' option in Netbeans. Then, I converted that .jar file in a .exe file using the software 'Launch4j' and it was perfectly running on my laptop. However when I tried running that exe file on other laptop. It displayed the error: Class NewJframe.firstfile couldnot be found.
( I made the database on the other laptop also with MySql Connection).
Please help me clarify why I am getting this error.
Also, I would like to know what all are the requirements to run an .exe file on other computer which I made from a .jar file?
I would pretty much expect something like Launch4j to take care of all your packaging requirements; did it give you options to "include all dependencies" that you didn't click "YES" to...?
It sounds like it's packaged your app, but possibly not the Java runtime envt it needs to run your app.
Try giving him the JAR file and see if he can run that. If he can, It's a problem with Launch4j, if he can't it's a problem with Java.
Alternatively try something like Excelsior JET instead.
Class NewJframe.firstfile couldnot be found
Launch4J only bundles your application's main JAR file inside the .exe (or not even that if you select "don't wrap JAR") - any other JARs that the main one depends on must be present in the same relative locations, you can't necessarily copy just the .exe.

Netbeans app runs very slowly

I'm currently working on a assignment for school and I'm finished programming but I got a major issue.
When I run the program in the netbeans IDE everything works the way it should and its very smooth.
But when I try to run the Jar file it lags and my timer takes 3-5 seconds per second.
Is there something I should check before exporting the Jar file or am I running it the wrong way?
It does the same thing on my Windows 7 64 bit system, Ubuntu 12 64 bit, Ubuntu 11 64 bit and on a windows 7 32 bit. So its not a OS problem. And I do have the new java runtime
My first thought is that maybe Netbeans runs the jvm for your program with more memory. Try to run your jar with increased jvm memory settings. You know it's one of those java options like -Xmx512m when you run the java -jar -Xmx512m yourjar.jar at the command line.
Another guess here, Netbeans is probably executing your pure .class files instead of one packaged jar file. If you can printout the classpath, you can try executing it the same way netbeans does. It may end up where you have to deploy multiple jar files to avoid this issue. Are you using many other jar files in your code?
This is based on my experience using eclipse and having it execute things differently in the IDE versus an exported jar file.
The JAR is probably built with compression by default. Built your JAR manually and specify the 0 option (no ZIP compression). It's worth a try.
See here for more details about the options available when creating a JAR.
If u have eclipse INDIGO version just right click the project node and click on export, then select "Runnable JAR file" under java section click next then finish and its done!!! :)

Simple swing application. The jar file runs on my computer, but not others

This is my first question, so apologies for any mistakes. I'll try and give all the info I can. Basically I've written a simple swing application which just loads in image into a JPanel and displays it. I'm using Netbeans 7.1 and I have the latest version of the Java SDK.
Anyway, I've used the "Build" feature in NetBeans 7.1 to deploy my application into a Jar file. When I double click the Jar File on my PC, it runs without a problem. However when I put it on other computers (Tested on 2 others so far, both with the most current JRE) it fails to open, citing the following error:
could not find the main class: swong.Startup. Program will exit
swong is my package name, and Startup is the location of my main method. I have checked the manifest file which is created with Netbeans' build, and it[the manifest] does indeed contain the location of my main method class.
From searching, I've come across similar issues in which the classpath is set wrongly, but I don't understand how this could cause my particular error.
If someone could help me, I would be over the moon. I've been studying java for a year or so, and I've got a good handle down, but I've NEVER been able to make a Jar that runs on a computer which wasn't my own. So, 10 points and thanks in advance.
xo.
EDIT: Thank you for the responses. I'm doing shift work and swamped, but I will test and poke with these responses tomorrow and provide more information. Thanks again. xo
I had d same problem while distributing my app. There is 1 solution that you create a batch file with 'java -jar AppName.jar' and asking user to double click on this batch file to execute your app. What i did was to provide a JRE installation exe(eg: jre_1.7.0) with your app.
Now create a Batch file (install.bat) in which write following commands
jre_1.7.0 -> this will install jre on user's pc
set path="C\Program Files\Java\jre_1.7.0\bin"
java -jar yourAppName.jar
Why i installed JRE because different people have different JRE versions installed. So this makes it difficult to set path to the installed JRE's bin folder & calling the 'java -jar' command. Hence as you know which folders your JRE installation will create hence it is easy to set path and execute your jar file with 'java-jar' command.
Check that your jar file has the following structure (at least)
jarfile.jar
|---------- swong
|---------- Startup.class
|---------- META-INF
|---------- MANIFEST.MF
It seems like the class "Startup" is missing. Maybe your jar only contains the .java files, not the compiled classes.
This error message can be a mistakable java7 error, when you try to start java7 compiled classes with a different Java Runtime Environment then java7. Have you validated, that your .jar is started within a Java7 environment on those other test machines? Sometimes it happens, that you have installed different versions of JREs and you might not be sure which one is actually started.
To check which enviroment is used, you can check in your registry for the following value:
HKEY_CLASSES_ROOT\jarfile\shell\open\command
this should point to your latest JRE. Or if you'd like to stay compatible to java6 as well, define the appropiate compile level in your build environment.

Categories