Skip to content
Advertisement

java package does not exist -> Java Error

I have a file named “BibliotecaMusicalControle.java”, that contains my main function, and when I try to compile it, I receive a message:

javac BibliotecaMusicalControle.java

Errors when trying to compile the code

I also have the folders “modelo” and “visao”, which contains some files that I imported on the class I tried to compile

Folder modelo:

Folder modelo

Imports I made on BibliotecaMusical.java

So I wanted to know how I can compile the BibliotecaMusicalControle.java with the imports that I made.

Advertisement

Answer

If you have a directory structure like this:

mySrc
   controle
   modelo
   visao

You need to compile from the “top” of the directory structure, and you need to specify a full path to the file. You also need the files in modelo and visao compiled so the .class files are available.

myScr> javac controleBibliotecaMusicalControle.java

is a file separator on Windows. On Mac and Unix it’s /.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement