Problem with classpath [duplicated]

1

I have a problem when running my program, or I think that's because my program (geany) compiles the program but at the time of executing the error that will happen in the photo.

I think it's classpath because if I do javac HelloMundo.java compiles me, but then with java HolaMundo does not run it, however, if I put: java -cp. Hello World does. I would like you to tell me the reason, I leave here the problem on the screen and the routes of my variables:

  

path:% SystemRoot% \ system32;% SystemRoot%;% SystemRoot% \ System32 \ Wbem; C: \ Program   Files \ Java \ jdk1.8.0_111 \ bin   classpath:% SystemRoot% \ system32;% SystemRoot%;% SystemRoot% \ System32 \ Wbem; C: \ Program   Files \ Java \ jdk1.8.0_111 \ bin

(I also always have to put desktop to compile, I guess it will be to save the programs there)

problem:

    
asked by jose 17.11.2016 в 17:30
source

1 answer

1

In windows you must include the current directory where the class is located ( .class ) that you want to execute, such as "." , as shown below in the image:

for example: . ; C: \ xmlbeans-2.5.0 \ lib \ xbean.jar; C: \ xmlbeans-2.5.0 \ lib \ jsr173_1.0_api.jar .... ...

Or otherwise like this:

On Unix

java -cp utilities.jar :. mypackage.MyClass

On Windows

java -cp utilities.jar ;. mypackage.MyClass

    
answered by 17.11.2016 в 20:22