Java: .*.class : no such file or directory

Java: .*.class : no such file or directory

8

    Jan 03, 2008#1

    I have created a project from existing source files. These source files are in a directory structure that mimics the package (namespace in C#) of the source files. So if a file called Util.java has a package of api.company.com, the source file is located in a directory of api\company\com\Util.java. When the file is compiled it is compiled into api\company\com\Util.class under the release directory.

    The compile appears to work fine, but building the jar file is having a problem. Here is the output:

    Code: Select all

    --------------------Configuration: my-project - Release--------------------
    javac -target 1.5 -d .\ -classpath ..\lib\axis.jar;..\lib\jaxrpc.jar;..\lib\saaj.jar;..\lib\wsdl4j-1.5.1.jar; -g:none @my-project.object
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    jar cvfm my-project.jar my-project.man @my-project.resource -C .\ *.class
    .\*.class : no such file or directory
    added manifest
    my-project.jar - 0 error(s), 0 warning(s)
    The problem is that once the files are compiled into class files they are in a directory structure under my release directory. Since they are in sub-directories, its not able to find .\*.class. When the jar file is built, it should add the directories that were created with javac and that contain the class files.

    6,680583
    Grand MasterGrand Master
    6,680583

      Jan 05, 2008#2

      Adapt the configuration to your needs at Build - Select Compiler - button Edit Configuration. You have the full control over the configuration and which files and directories are included and where they are build. At Build - Set Compiler Options you can specify also into which directory the files should be build. For example for my DJGPP project I don't have a "Release" subdirectory.
      Best regards from an UC/UE/UES for Windows user from Austria

      8

        Jan 06, 2008#3

        I did go through the compiler options. If the option exists, it is unclear how to set the directory to put the class files into.

        Besides, its not important about the location of the class files (compiled java code). The problem is that when it tries to make the jar file, it is uses this command:
        jar cvfm my-project.jar my-project.man @my-project.resource -C .\ *.class

        Notice the .\*.class, no class files exist in the directory so the jar file does not include them. It should jar the directories created by the compile.

        The "Release" directory is set in the "Set Compiler Options" dialog at the bottom. There is a debug field and release field. In the release field it has the value "Release". This is the directory that the code gets compiled into and then the jar file created.

        1
        NewbieNewbie
        1

          Feb 02, 2008#4

          I have solved the same problem starting from the previous poor explanation.

          Under Build - Select Compiler you need to edit the Build section of the configuration by adding additional compilation commands.
          For example I added the following to get the class files in two subdirectories into my project jar file:
          Cmd2 = jar uvf $T $Pn.man @$Pn.resource card\*.class exceptions\*.class

          Just add the jar commands that are appropriate for your project and then save the settings locally so that they only apply to that one project.

          If there is a recursive jar command argument that would be perfect!

          1
          NewbieNewbie
          1

            Aug 02, 2010#5

            Cmd2 = jar uvf $T $Pn.man @$Pn.resource card\*.class exceptions\*.class
            To extrapolate to the package path, if your class d.class in package a.b.c is on the path a\b\c\d.class, then the command you add is:
            Cmd2 = jar uvf $T $Pn.man @$Pn.resource .\a\b\c\*.class
            The compiler as otherwise configured will create Debug\a\b\c and Release\a\b\c paths and the "." in the ".\a\b\c\*.class" above refers to the Debug or Release directory.

            Hope this helps.