Search code examples
javanetbeansjavac

Need to compile Java program with TWO packages and MANY classes from command line but can't get syntax right


I have only used Netbeans to compile to this point. Now I have a complex project and though I have gotten compilation with errors, I don't know how to include the gbl package (lack of which led to many errors). Here's what I tried, among quite a few others:

C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton>{COMMAND PROMPT}

javac -classpath src\masterwords;src\gbl src\masterwords\*.java

and

javac -classpath src\masterwords;src\gbl src\*\*.java

and

javac -classpath src\masterwords;src\gbl -sourcepath src\*\*.java

Here's the Netbeans directory structure:

enter image description here

Here's path to project:

C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton

It's only critical to include gbl and masterwords packages, but I need masterwords.res\dictionary, if possible. (Here's path to it:

C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\src\masterwords\res)

Can I get a command line from someone, please?


Solution

  • First go to your src folder, then you can do:

    javac -classpath masterwords\*.java gbl\*.java
    

    Since you kept adding "src" to your classpath declaration, javac was looking for classes in a package like this:

    src.masterwords.SomeClass