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.
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 9 years ago.
Improve this question
There is a project called javachallenge that contains four folders inside it: bin, ee, server ,src.
this projects need server/server.jar for external library and it's main method is inside src/javachallenge/client/Connector.java
how can i run this project using terminal?
You have to make sure the JDK binaries are on your PATH, and then you call javac (The java compiler).
Please see http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html for information on how to use the java compiler.
After you compiled all classes, you call java -cp /path/to/compiled/classes:server/server.jar javachallenge.client.Connector (assuming the class is in the javachallenge.client package. The -cp option tells the Java virtual machine where to look for classes, so you have to include both the directory with classes you compiled before, and the external library these classes depend on.
You can call both java and javac with no arguments to get a list of available options if you get stuck.
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...