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.
Related
This question already has answers here:
How to run and compile java program?
(1 answer)
How to run Java Programs
(4 answers)
Closed 4 months ago.
I'm running a Java program on a Chromebook, and I'm trying to run the file in the Linux terminal. I ran the command javac Main.java, but it shows nothing, not an error, but just straight up nothing.
I have Java installed. The file I'm running has no bugs. I did not make a typo. Everything is perfectly right.
Is there something I'm missing?
user#penguin:~$ javac Main.java
user#penguin:~$
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
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.
This question already has answers here:
‘ant’ is not recognized as an internal or external command
(11 answers)
Closed 7 years ago.
I am trying to set up the apache ANT in Windows7 and executed below commands in cmd.
set ANT_HOME=c:\Softwares\apache-ant-1.9
set JAVA_HOME=c:\Softwares\jdk7x64
set PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin;
But, when i execute ant -version command it gives me below error. I cannot set the path from environment variables as i don't have admin rights to do so. How can i do it through command prompt only. What is wrong here ?
Error
'ant' is not recognized as an internal or external command,operable program or batch file.
If i give below command
echo %ANT_HOME%
i get the output as
c:\Softwares\apache-ant-1.9
Did you try setting the PATH variable as below?
set PATH=%PATH%;%ANT_HOME%\bin;%JAVA_HOME%\bin;
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
javac not recognized
I'm starting in the world of programming in java and I have run across a big problem: i cant compile my programs. when I type the javac command in cmd.exe(im using Windows 7) it displays this:
'javac' is not recognized as an internal or external command, operable program or batch file.
So I can't even test my first program.
I found in a book the following command:
set path=%path%;c:\java\jdk1.6.0\bin
but it doesnt work either.
I downloaded the newest version of the Jdk package just 2 weeks ago.
Look through your C drive for the c:\java folder and make sure you have version 1.6.0 of the jdk
c:\java\jdk1.6.0\bin
This will only work if you give it a path that actually exists. If you don't have 1.6.0, then type in:
set path=%path%;c:\java\<YOUR_ACTUAL_JAVA_VERSION_DIRECTORY>\bin