I am trying to incorporate Apple's script engine in my java app developed for macOs. I use eclipse to develop and when I run a debug build from eclipse all the Apple Script functions work.
As soon as I export it to an external jar and run that on the same machine they do no longer work.
I've searched and found some issues which I all tried, here is a summary:
using getEngineByName("AppleScriptEngine") now.
Adding the META-INF file javax.script.ScriptEngineFactory with the contents: apple.applescript.AppleScriptEngineFactory
cleaning and rebuilding several times
I opened the jar to see if the META-INF file is present and it is.
searched in /System/Library/Java/Extensions/ for a applescript jar file but it was not there.
I also searched for the /Library/Java/JavaVirtualMachines to see if it is there but also not the case
It is still not working. So I do not know what the difference is exactly between eclipse debug run and running a jar in macOs but there has to be something I am missing.
As far as I can figure out it seems that the apple scripting class is not installed but then how does eclipse use it?
As I understand there is a difference between java JRE versions so I am in need of a solution for all of them because I do not know what systems are running my app.
Any help is appreciated!
Related
I am attempting to build an application in NetBeans that can be deployed to and end user. I am still pretty new to deploying projects and this is by far the most complicated one I have done so please bear with me. I currently have a working application in NetBeans which utilizes JDK 15 and JavaFX 15. As long as I run things inside of NetBeans everything works as intended. I have reached a point where I want to make sure I can distribute this application outside of NetBeans. To this end I did some searching and found the following tutorial.
https://netbeans.org/kb/articles/javase-deploy.html
I was able to follow the tutorial and build the example. The build works in NetBeans, I am able to run the executable jar file in the dist folder from the command line, and I am able to run the jar file by executing it from the file explorer. Now when I attempt to do the same process with my own project I run into the following errors.
When I attempt to run the jar file in the dist folder absolutely nothing happens.
When I attempt to run the jar file from the command line using the command
java -jar "C:\Workspace\HandyAndyVersion1_2\dist\HandyAndyVersion1_2.jar"
I receive the following error,
Error: JavaFX runtime components are missing, and are required to run this application.
I am currently under the assumption that the first problem is a by product of the second. If anybody has a solution to this problem or any ideas on what I could have configured wrong please let me know and thank you all in advance.
To package a Java desktop application these days, you should be using the jpackage tool and optionally the jlink tool. These will generate a JRE image that is packaged with the application and contains the modules you need.
I suspect the issue you are running into is that the native libraries for JavaFX are not present. Most distributions of JDK 15 do not contain the JavaFX modules, though some do. (See the Full and FX bundles of the JDK from Azul and Bellsoft). I find it is easier to use a JDK with JavaFX bundled rather than have to manage a separate module path during development for the jmod files of JavaFX, but that is another option. Either method can be used with jlink to create a suitable JRE for your application that includes the JavaFX modules.
I was having jdk_1.6 in my machine and I removed it and installed jdk_1.7. So after installing jdk_1.7 I am not able to run my jar file with double click. I could run the same file using command prompt.
After installing jdk_1.7 I run the program from eclipse using java 7 and I exported jar using the same.
I am using following command for running jar:
>>java -jar csv_generator_1.jar
And this works fine and jar get executed.
But when I right click and open with javaw.exe in jad/bin folder or jdk/jre/bin/ folder it's not working.
I found same question here link1 and link2, but I am not understating what to do.
Can someone help me to resolve this?
Go there and download newest verson of java RE and install it and it should work. But if it does not work you should get some kind of error message and try to google it. It is possible that your java(s) are broken.
If you install JDK, you may think it contains JRE but it's private. At least that was stated during installation process. Therefore, you had to install Public JRE.
JDK installer provides an option to do so but if you didn't check it, you might experience the problem you described.
I have a problem with getting the Application to run on other People's machines.
I have tested a self contained and the normal .jar file.
When i pass them to a friend of mine who has java installed, when he opens the .jar file, there is an Error: "Java Exception has occured".
When i run both the .jar and the .exe off the self contained one, both do work on my PC.
So the actual question is:
Why isn't it working just like that?
Can't i just run JavaFX applications without installing the whole JDK?
Thanks for your help :)
Since Java 7 there exists the "javafxpackager", renamed to "javapackager" on Java 8 which uses some xml-configuration for generating your wanted "Installer"/distribution-package.
As this does not fit some peoples need, there exists a way to use maven:
the javafx-maven-plugin, you can find some examples about the usage of that plugin as linked.
Disclaimer: I'm the maintainer of the javafx-maven-plugin.
I made java application's setup file through install4j and it is well known that netbeans application does not run without jre. so my question is that is there any way to install jre automatically if it is not installed previously before installing application.I heard that there is way to create .dll or .bat file for that but i dont know exact about that.So please help me as soon as possible.
Thanks and Regards,
Mahesh
http://www.ikvm.net/
This might be a good route to go, i'm looking into it now. In short it pushes your jar to run on a .net build
Let me start by saying I've recently inherited a Java application written using Eclipse. I'm new to this language/IDE, but I have a lot of experience with C# and Visual Studio. So, my problem may be something very silly, but I have a foundation so I'm not a total programming newb.
I'm exporting this project as a runnable JAR, using a launch configuration provided by the original developer. I have tried this with both "Extract required libraries into generated JAR" and "Package required libraries into generated JAR". Either way, I get the following error when I launch the application:
java.lang.NoClassDefFoundError: javax/media/jai/PlanarImage
I launch the application using this command, where appName.properties is a properties file that's required for running the app:
java -jar appName.jar appName.properties
This occurs multiple times from separate stack traces. I'm not seeing any other runtime errors or compile errors. My JRE system library is jre1.5.0_05. I installed JAI by downloading jai-1_1_3-lib-windows-i586-jre.exe from http://download.java.net/media/jai/builds/release/1_1_3/ and installing it into the jre5 directory. My project did not compile until I got this specific version of java, and installed the JAI jre into that version's folder, so I am fairly certain I have that part together correctly.
Finally, here is my classpath:
C:\Program Files (x86)\Java\jre1.5.0_05\lib\ext\jai_codec.jar;C:\Program Files (x86)\Java\jre1.5.0_05\lib\ext\jai_core.jar;C:\Program Files (x86)\junit4.10\junit-4.10.jar;.
Is there anything obvious I'm doing wrong here? Is there any other information that would be helpful in figuring out why I'm getting this error?
Make sure the jar is in your classpath. Are you running from an IDE or from command line?