javac -classpath . (Debian 10 Buster)

Asked

Viewed 18 times

-1

I’m using the Geany to do so. However, I was unable to compile the simple Hello World!. With some researches I found two reference links, being them:

https://www.guj.com.br/t/ola-mundo/51431/13

Javac does not compile. java .

With the first link, I was able to find the solution to the build error by adding -classpath . between the javac and Helloworld.java. However, searching on this, I bumped into the second link, however, I am using the Debian 10, and I couldn’t connect the points very well. If it’s not uncomfortable, I can clarify my (maybe) silly doubt, here?

See on the island of Geany: inserir a descrição da imagem aqui

The error presented:

philip@debian:~/Documents/java/java1$ javac Mundo.java 

Mundo.java:4: error: cannot find symbol
        System.out.printfln("Hello World!");
                  ^
  symbol:   method printfln(String)
  location: variable out of type PrintStream
1 error

Already in the tab of Compiler, he shows this error:

inserir a descrição da imagem aqui

After I used the remote javac -classpath . World.java, in the current folder of my file .java it starts to compile normally, as if there were no mistake. Whenever I go to compile a file .java, should I do this procedure or is it some bad setup?

  • And what error occurs? And why are you using the --classpath if it’s just a simple helloworld?. It’s important [Edit] and add a [mcve] of the problem, with a step by step of what you have already done and explain clearly and objectively where you failed. Do not delete and do not repeat the question, just edit and wait for the reopening process. To take better advantage of the site, understand and avoid closures is worth reading the Stack Overflow Survival Guide in English.

  • Ready Guilerme. I added new information, I hope it’s clear now.

  • Hello Philip. Do not use images to show codes and logs as images. Thank you for understanding.

  • Just for the record, There is no System.out.printfln if you will not pass values with the parameters. It is a typo in your code. Just for the record, there’s no need to specify the -classpath if you’re not going to point to anything that’s going to be loaded.

  • Yes, I’m sorry. I was testing printf and the println, ai in this example I ended up mixing the two kkkk. But even correcting, presented the same error.

  • Ah, I got it wrong again... it doesn’t exist at all, it was a "popular" site that had the wrong information. Well, to use printf only use if you need: https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax / if you do not use System.out.println("Hello World!");

  • Okay, thank you. But could you tell me what this is for classpath. ?

  • To find external classes, the shortcut is -cp. I will lock the comments because this session is not to take extra doubts, it is to specify or request specific details of the question. To participate in the site I recommend you to understand the environment first: https://answall.com/tour / https://answall.com/help - . To better enjoy the site, understand and avoid closures is worth reading the Stack Overflow Survival Guide in English.

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.