Java installation - doesn't run classes

I am starting java development. So, I have installed JRE and JDK on my computer.

Then I created a simple Example.java file and saved it to my desktop. At the invitation, I performed

javac Example.java

and it worked fine. A file was created on my desktop .class

.

Then I tried to start the class by doing the following:

java Example

and I got an error in the warning box:

Java Installation Not Completed
Unable to install Java
There are error in the command line switches: "Example";.
Check that the commands are valid and try again

      

Then, for testing, I ran both commands: javac -version

and java -version

. Both are installed on my computer.

What am I doing wrong?

I am running Windows 8 and have already set my environment variables.

Example.java:

public class Example {   
  public static void main(String args[]) {    
    System.out.println("Finally Java");  
  }
}

      

+3


source to share


1 answer


Try to uninstall the installation again, find any leftovers and manually remove them, if you change the directory where java is installed remove the environment variables and set them again. You should also do a registry cleanup: https://java.com/en/download/help/manual_regedit.xml Install via offline installer.



0


source







All Articles