This question already has answers here:
Self-Contained Applications, built in Java
(3 answers)
Closed 2 years ago.
I have a java code that makes input and saves data as a text file. To problem is that I want the user to double-click an icon that contain an .exe file with the java code inside. In order words, the double click on that item replaces the run command on java. I want to wrap the java code somehow. Thank you!
A workaround approach is to pack the java as jar.
It will execute on double click applied java jdk installed and environment variables set.
But still in this approach we don't create a exe file.
Rather run the java jar.
Should work with both windows and ubuntu...
https://askubuntu.com/questions/192914/how-run-a-jar-file-with-a-double-click
Related
This question already has answers here:
javac : Compiling a .java file which uses other classes in it
(2 answers)
How to compile a single Java file
(2 answers)
Closed 5 years ago.
Note: I'm only a student and don't have too much experience with programming, so please be patient with me.
I'm trying to modify the code of an existing program written in Java, so that the program runs exactly as normal except for my couple changes.
I found and unzipped the appropriate jar file and put the .class I want through a decompiler. But, after modifying the code, I can't re-compile it. The javac compiler just gives me a bunch of errors, mostly because it doesn't recognize the references to variables and methods that are defined in different classes of the program.
How can I change a couple lines of code in a Java program? Am I on the right track with my current approach (decompile→edit→recompile)?
SOLUTION: I had to include the classpath of the jar. javac -cp "[PATH TO JAR]:lib/*" [PATH TO JAVA FILE]
This question already has answers here:
Compiling a java program into an executable [duplicate]
(7 answers)
Closed 7 years ago.
In C/C++, the .exe file is automatically generated by the compiler when we run the code.
My question is how do you generate the .exe file in Java instead of just hitting run every time when we open up the .java file.
To do that, you'd need to create an Executable .jar file. Here's the instructions on how to do it.
This question already has answers here:
executing .jar file with an argument by mouse right-click on Windows?
(3 answers)
Closed 8 years ago.
I read this article and wanted to do same thing using Java (.jar) file instead of .exe
And suppose my program just prints the path of the selected file which right clicked to my content menu.
Please see below Image. I want like this the option(Copy File Path) in MS Windows Context Menu using a Java Application:
Sorry for my weird language, i hope somebody fix that.
Best regards
Open with then select java under JDK_HOME.
then you are free to run it after clicking...
You only have to double-click on the .jar file.
This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 8 years ago.
I have one library, one txt file for import some things with it and one output file to show the result. Only have one java file without any interface. With eclipse all is running well - I am writing into the input file and then it shows the result into the output file. Now I want to make this all independent program (without need to run with eclipse).
How to make it?
An easier way is to make a runnable JAR file.
Go into eclipse choose file > export > runnable JAR.
It will then ask you to choose a class for a launch configuration. Choose the class that has the main method for the desired program. After that you will have a file that will run (like a .exe but just a different format).
If can't get it to work with your input and output files, thats because eclipse has this weird thing that sometimes occurs regarding the location of external sources when exporting to JAR. To fix it, just put the files instead of the src (source) folder, one folder up in the directory. For example, if this is your current directory: C:\workspace\myprogram\src put it in C:\workspace\myprogram
Hope this helps.
The only thing that eclipse is is a software that facilitates progtammi g. But what find the programs is the jvm-java virtual machine. To get to the point eclipse does have a option to convert it to a .jar file which the extension a java program uses to be "independent" from eclipse and open up by double clicking. The way you do this is you right click on the class you want to make independent and I think there should an option that says export to .jar and that should do the trick! Hope this was helpful
This question already has answers here:
How to make Java program installable?
(6 answers)
Closed 9 years ago.
I made some programs in java but I don't know what I should do afterwards finalizing it for the end user. all I have is a bunch of .class and .java files in a directory and I have no idea how to distribute it to the user. Isn't java supposed to work like a normal program where I install it through a self-extracting file or InstallShield like how pc games install their programs? Thank you.
I've read on deployment but mostly I saw was how to package it into a .jar file. I'm not sure how that works but the user would most likely not be able to know what to do with a package file unless I include detailed instructions on how to operate it. I was hoping there would be a way that I install the entire java program with a .exe file like a normal program does and it will load up into a specified directory and create start menu/desktop shortcuts for the user to use.
Thank you in advance.
.jar Files are runnable on each Plattform. That's the advantage of java. So you can roll out the .jar or you can run it into an Java-applet. Or you build an .exe launcher...
Like this:
https://stackoverflow.com/a/15409917/2617699
Export it into an executable jar using eclipse. The you can create an exe using Launch4j or any similar software.