Running JAR file on Windows 10 [duplicate] - java

This question already has answers here:
How to run .jar file by double click on Windows 7 64-bit?
(18 answers)
Closed 5 years ago.
I have made a Jar file, but I cant make it to run by double clicking.
It works fine using java -jar name.jar or by making a batch file.
I have already reinstalled jdk1.8.0_102, set the JAVA_HOME variable and javaw.exe in the jre folder is already the default program to run it.
so how do I make it to run by double clicking?

How do I run an executable JAR file?
If you have a jar file called Example.jar, follow these rules:
Open a notepad.exe.
Write : java -jar Example.jar.
Save it with the extension .bat.
Copy it to the directory which has the .jar file.
Double click it to run your .jar file.

Related

I am having trouble using command prompt for java program execution [duplicate]

This question already has answers here:
I could not understand why "javac: file not found: HelloWorld.java"
(2 answers)
Closed 2 years ago.
Can anyone tell me that why when I'm providing the whole path after typing like "javac C:\Java\MyFirstApp.java" then it is compiling. But when I directly go for "javac MyFirstApp.java" it is showing me file not found.
Because you are not in same directory where .java is placed. Change directory to app folder using cd command and type only javac MyfirstApp.java
From what I remember, to execute the program you don't need to inform the extension.
Go to your project's folder and try:
javac Main.java
java Main

How to run .jar file by double click on Windows 7 [duplicate]

This question already has answers here:
Running JAR file on Windows
(26 answers)
Closed 2 years ago.
Running a .jar file in a command line works fine, but i am not able to run any .jar file by double clicking on my Windows 7 (64). It seems nothing happens after the double click
I set the path JRE path in my regedit HKEY_CLASSES_ROOT with JRE path but still its not running.
Any Solutions for this?
If you have a .jar file called Example.jar, follow these steps:
Open a notepad.exe
Write : java -jar Example.jar
Save it with the extension .bat
Copy it to the directory which has the .jar file
Double click the .bat file which will run your .jar file
See this article for a more detailed explanation of the above steps.

Java Program not running in cmd [duplicate]

This question already has answers here:
Java path..Error of jvm.cfg
(23 answers)
Closed 2 years ago.
I am able to compile the java program but not able to run it.
The problem is that java cannot open the .cfg file which is part of JRE 8.
Firstly check if you have permission for running jar.
Then check it your runtime is same as JDK.
Check if you are typing command correctly:
java -jar file.jar
Edit:
It seems like your .cfg file doesn’t exist or it’s corrupted.
Check it and try rebuild it. If it didn’t work you have syntax error somewhere int cfg file.

how to run a.jar file [duplicate]

This question already has answers here:
How to run a JAR file
(12 answers)
Closed 6 years ago.
i have downloaded a school management system v1.0 it was a zip file and when i extracted the file it has some lib file and .jar file so how can i run it i don't know should i install jre to run that file or will it run in wamp server or some other software i am completely lost and haven't found any solution so far if you want the link to the file i can give that but please help me with this software i want to seriously run this application https://sourceforge.net/projects/schoolmanagements/?source=directory
this is the link to file which i am trying to please help me to run this
First, check if you have Java/JRE installed.
Open your command line/terminal tool and input:
java -version
If you don't see version (but see standard for your OS message like "program is not found") - install JRE (select your platform, download and install).
When Java is ready, open your command line/terminal tool again, and navigate to your un-archived School Management System folder (it is the folder, there SchoolMV0.1.jar resides). And run this:
java -jar SchoolMV0.1.jar
Good luck!

Load desktop application on Windows startup [duplicate]

This question already has answers here:
Run Java application at Windows startup
(8 answers)
Closed 6 years ago.
I have Java desktop application, which runs fine. I can double click on exe or run jar file and runs properly.
I want to load this application whenever system starts. How can I achieve this programmatically?
Or is there any tool available to create exe in such a manner, that once we install it creates shortcut in system startup folder.
I want it be system or code driven rather than individually placing exe in startup folder.
You can set up the exe as a windows service with these steps:
open command prompt as administrator
type this:
sc.exe create <service_name> binPath= "<path to your exe> --service" DisplayName= "<somename>" start= "auto"

Categories

Resources