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

Building, compiling, or debugging issues

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

Postby rmccullough » Thu Jan 03, 2008 6:42 pm

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.
User avatar
rmccullough
Newbie
 
Posts: 8
Joined: Mon Jan 17, 2005 12:00 am

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

Postby Mofi » Sat Jan 05, 2008 4:51 pm

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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

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

Postby rmccullough » Sat Jan 05, 2008 8:38 pm

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.
User avatar
rmccullough
Newbie
 
Posts: 8
Joined: Mon Jan 17, 2005 12:00 am

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

Postby rtree » Fri Feb 01, 2008 8:08 pm

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!
User avatar
rtree
Newbie
 
Posts: 1
Joined: Fri Feb 01, 2008 12:00 am

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

Postby bwyte » Mon Aug 02, 2010 10:04 am

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.
bwyte
Newbie
 
Posts: 1
Joined: Mon Aug 02, 2010 9:10 am


Return to Build / Compile / Debug