How to make a shortcut for javafx application - java

I thought I could find an answer for this question because as i think it is popular problem.But unfortunately I did not find the answer
I have an application written with Java and JavaFX
and i built it using eclipse and it worked perfectly there
but when I export the project as a .jar(executable jar file) file so it runs when it is double clicked it doesn't work
I tried a lot of things and I could approve that their is no exceptions or errors in the jar file by running it from the cmd and it worked perfectly but i still need it to be run by clicking a shortcut like an .exe file or any kind of such a thing and it should run when it is sent to another computer
this image proves it is working in the cmd
Image

Related

How to deploy a Java command line application?

I started to write code in Java few weeks ago. I use IntelliJ Idea (the latest version) on Win10x64.
I realized a little hangman game (as a Windows command line app) that uses a text file with the words and I have put this text file in a folder called 'assets' inside the project folder (at the same level of 'src' folder). The game works great in the IDE environment but I still don't know how to realize a standalone app and running it outside IntelliJ.
I tried also to compile from command line using javac.exe and it seems that compilation works well but when I try to execute the program from command line using java.exe I get an error that says that the text file I use as vocabulary is not found (java.nio.file.NoSuchFileException).
I have also followed the instructions on Jet Brains site about How to create a JAR file but with no results. Is there a simple way to deploy a Java desktop application so that people (who obviously have JRE) have just to make a double click on an icon and use it?

Java .jar file Run Differently from Command Line and File Explorer

I recently wrote an application that is packaged as a .jar file. When I run the application from the command line via "java -jar MyProject.jar" everything looks perfect, just as it does when run from within eclipse. However when I go to the file location in the file explorer and double clock the file, it doesn't quite work. All of the functionality is there, but the GUI is not quite right. All text is much larger, despite the application not changing size, when run like this, to the point where much of it is cut off.
Anyone know whats going on? Thanks!
The cause of this issue was that when being run from the command line, the program was being run with JRE 1.8.0_172, however when being run from the file explorer, the program was using JDK 10.0.1

Images and animations used in my project are not getting displayed while running the JAR file of my project

I have made a project in JAVA using Eclipse. I have to send this project to someone such as he just double clicks and my project starts executing. For this I have created a Runnable JAR file of it but the problem is that the images are not getting displayed when I execute the JAR file. Sometimes, JAR file doesn't execute.
Please help regarding this.
What exceptions are we dealing with? Without that information it's pretty hard to know what you're dealing with and to get an answer. Have you already run the app on cmd with the command 'java -jar App name.jar' ?

Terminal edited files cannot be run by eclipse

I am using eclipse on linux, and I have mostly been writing java files by editing the raw text file. My reasoning behind this is that I am in a comp sci course, and we have to write code by hand, so this will prepare me for writing code unaided. However, my actual problem arose when I tried to edit a file I had created using eclipse 3.8.1. When I tried to open the folder, which has the same structure as files created by eclipse if it matters, it opens, but I cannot run it. When I click run, it asks what to run it as, and the only 2 options are Ant Builds. I don't know what this means, but I am not able to run the file either way. Any help is appreciated, and if it is important, I am using java 8.

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.

Categories