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

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.

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 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!

Running JAR file on Windows 10 [duplicate]

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.

Running java programs from the command line on Windows 10 [duplicate]

This question already has answers here:
javac is not recognized as an internal or external command, operable program or batch file [closed]
(6 answers)
Closed 6 years ago.
I'm trying to run a basic "Hello World" app from the command line on windows 10 using
javac MyFirstProgram.java
but i receive
'javac' is not recognised as an internal or external command, operable program or batch
naturally, the first thing i did was google the problem and many solutions were presented, tried a few but nothing worked, has anybody else experienced this?
Steps to fix this error in windows 10/8/7
1.Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1.7.0_02\bin and copy the address.
2.Go to Control Panel. Environment Variables and Insert the address at the beginning of var. Path followed by semicolon. i.e C:\Program Files\Java\jdk1.7.0_02\bin; . Do not delete the path existent, just click in and go to the left end and paste the line above. Do not try anything else, because you just need to link your code to "javac.exe" and you just need to locate it.
3.Close your command prompt and reopen it,and write the code for compile and execution.
You need to add the location of your JDK to your PATH variable, if you wish to call javac.exe without the path.
set PATH=%PATH%;C:\path\to\your\JDK\bin\dir
Then...
javac.exe MyFirstProgram.java
OR, you can simply call it via the full path to javac.exe from your JDK installation e.g.
C:\path\to\your\JDK\bin\javac.exe MyFirstProgram.java

Run eclipse project in cmd [duplicate]

This question already has answers here:
Eclipse open console apps in separate window
(4 answers)
Closed 7 years ago.
I have a console project in Eclipse.
I want to configure Eclipse to open a Windows Command Prompt window instead of its own console. The cmd window must run the project and do all input and output instead of the Eclipse console window.
This is very easy in C#.
How do I do this?
If this is a console-based application, then merely opening the executable JAR file should make it run in a Command Prompt. This can be done by typing
java -jar "<drive>:\path\to\JAR.jar"
into a CMD window. The program will now run as if it were in the Eclipse console, except in CMD. Using a batch file, you can alter the CMD with
COLOR 0A
as an example.
If you are looking for more of a user-friendly console-based application, you can get the name of the executable JAR and have it run in a ProcessBuilder inside the source code itself. This allows the JAR to open up itself in a CMD.
If I have not specified correctly, do let me know.

Categories

Resources