Carol Manso
Carol Manso

Reputation: 3

java package <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.

Upvotes: 0

Views: 1617

Answers (1)

markspace
markspace

Reputation: 11030

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 controle\BibliotecaMusicalControle.java

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

Upvotes: 1

Related Questions