I can not run a Java class from the Windows 10 cmd

0

I have created a classe that I need to execute from the Windows cmd, but there is no way to execute it. I have updated java, I have tried a thousand different commands, but whatever happens, the error is always the same:

  

Error: the main class "name of the classe" was not found or loaded

Basically what I have to do is put java nameclass parameter (in the case of my code the name of a file). In case it helps I put the beginning of the code below:

package dam_m06b0_eac1;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 *
 * @author theda
 */
public class VeureInfo {

public static File nomDirectoriFitxer = null;

public static void main(String[] args) {

The complete path where the class is located is the following:

  

C: \ Users \ theda \ OneDrive \ Documents \ NetBeansProjects \ DAM_M06B0_EAC1 \ src \ dam_m06b0_eac1 \ VeureInfo.java

I put an image of various commands that I have been testing (of so many others). I have tried both with -classpath and without:

I have even tried to try to run another different class and it jumps the same error, so I guess I'm doing something wrong when using the command.

    
asked by MarcusF 17.09.2017 в 21:42
source

3 answers

1

Set the path variable c: \ Program Files \ Java \ jdk1.8.0_121

Example of how to configure the environment variable: link

Once configured executables from the cmd java - jar c: \ path

    
answered by 20.09.2017 / 23:59
source
1

You can not find the javac in the system path. You can launch it by placing the direct route in cmd.

c:\java\javac.exe 
    
answered by 20.09.2017 в 12:02
0

You must install the jdk on your computer once you have entered the folder where it was installed, by default in Program Files go to the bin folder "/ java / jdk 1.8 ... / bin" and copy that path in the environment variables of the system which you will find in system, advanced configuration of the system, environment variables

    
answered by 19.09.2017 в 23:50