Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I've installed gnome desktop and window x on centos, the only problem I have now is opening .jar files on my desktop. How do I open them?
If you mean running by opening, just use the command
java -jar <jarfile>
If you want to extract the contents of a jar file, just use the command
tar -xvf <jarfile>
Open up a command line console, cd to the directory where the jar file resides, and use
tar -xvf <jarfile>
yup, even the graphical interface allows this with the same tool is uses for unzips. Name of it escapes me at the moment though.
I believe FileRoller is the name of the default GUI for archive files in GNOME. Extra libraries might be needed to make it work with jars by default, not sure.
tar works too from command line. But just in case you are interested in a gnome GUI option...
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to make my .jar file with the javafx stuff into an executable application, but when I try to do jpackage on the command line, I'm getting command not found. I've downloaded the latest jdk-15.0.1_osx-x64_bin.dmg from Oracle.
Although some Java commands are defined (eg java, javac) And are in the local /usr/bin directory, they only contain commands that were in the Java 6 release (including eg appletviewer).
Newer commands that were added in later Java releases like jmod, jlink etc aren’t available in the path. I’ve raised a radar (bug) at Apple a few years ago And the response was “so?” — don’t hold your breath.
To run these commands you will need to add the Home/bin directory of your install (under /Library/Java/JavaVirtual/Machines) to your PATH environment variable. You can also use /usr/libexec/java_home to find the path of the installed JVM automatically.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have had Intellij IDEA generate an executable jar for me and executing the jar using java -jar command works great.
But when I try to wrap this jar into an exe file using launch4j, various errors happen. First there was an error saying "Could not find or load main class".
After looking at this and this questions I thought the problem is about pathnames or classnames. However, that was not the case. Apparently, the main class was found, but couldn't be loaded because there was no pathnames to Java and JavaFX runtimes.
After adding rt.jar and jfxrt.jar to classpaths another error appeared:
"JavaFX runtime components are missing, and are required to run this application"
And now I really don't know what to do. I downloaded the latest jre (8.0.221) but nothing changed. jfxrt.jar is a JavaFX runtime to my knowledge, but it seems like the application doesn't recognize it as one.
Any recommendations for deploying, suggestions for my project or remarks are welcome and appreciated. Thanks!
I achieved what I wanted by using one of launch4j built-in functions. In section JRE there is an option for bundled jre path. And to create native app launcher with bundled jre you just have to specify the path of jre. This took me 5 days to find.
You can make .exe file using Inno tool set up.
I have used this there was no error, exe runs fine.
Link :- http://www.jrsoftware.org/ishelp/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Need to create a jar file of 3/4 .java files and then create an executable file which just need to be double clicked to run the main program in mac PC.
The first step is to compile your .java source files to .class files and potentially package them into a .jar file. One of your classes must have a main method so it can be run as a Java application.
I believe there are commercial products to create executable binaries but take a look at the GraalVM native-image tool. This tool can create an executable binary for Linux or Mac from a jar file.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am making an android application that aims to run a .jar file that's a java7 based console application. Could someone direct me on a way I can run this file with a shell command within my application's code?
You can't. Android doesn't come with a Java 7 VM. The Dalvik VM it uses is not compatible.
Do you mean just opening a console and running the jar? If yes, the command goes like:
java -jar <my jar file>
Can you please be more clear?
If what you are trying is to run the jar from the command line (terminal) then just use
java -jar <jarfile>
If you are trying to run a class that is inside the jar, then just make sure the jar is in the classpath and use the class directly.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I am trying to figure out to make a startup script for my java application, I tried making an installer for this in advanced installer. Over there I added the jvm arguments but it did not work, well that is a separate issue...
What I am asking is: Is there a script that I can place along with my JAR file in C Drive so that from the Desktop's Shortcut I run that script and that in turn opens the JAR with increased heap space?
I couldn't neither find how to make startup script on Google, Sorry I am not too familiar/aware of Bat file scripting
This question is somewhat sort of an extension to my last question
You could create a Batch script file ".bat" that runs a command like -
java JVM_Arguments -jar yourJarFile.jar
pause
pause is optional if you want to stop the command prompt from closing at the end of jar execution - to check for errors or just the output of the execution.
java -jar PATH_TO_YOUR_JAR in a batch file should do this. but the condition is your jar should be executable.
Typically a JAR has external dependencies which are not packaged as a part of it, but needs to be provided to the Java Virtual Machine when running the JAR (they need to be in the classpath)
If you want to run your class from the command line you have several solutions:
Create a batch script as suggested above or in Run class in Jar file . You will have to carefully provide with the -cp argument all the jars required
Create a "fat" jar that contains inside all the classes from external jars. This might generate a JAR of several megabytes if you need many libraries. In such a case writing the batch script will not require you to add all the jars, because they will be contained in the fat jar
Launch the application using a build system, capable of writing for you the call to the java executable with the right parameters
The general suggestion is that you get familiar with class loading in Java and just after with build systems, which are going to become your best friend whenever developing a non trivial application. I would probably suggest you start with Maven, even if today better tools such as Gradle or SBT are available