为Apertium翻译对构建Jar文件报错求助:文件存在却提示找不到
Hey there! As an Apertium newbie, it’s super frustrating when you know the file exists but the tool insists it doesn’t—let’s sort this out step by step.
First, let’s recap the confusing error you’re hitting:
cp: cannot stat ''''/home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/ca-it.automorf.bin'''': No such file or directory
zip warning: name not matched: data/ca-it.automorf.bin
Notice those weird ''\'' characters wrapped around the file path? That’s a big clue—something’s messing up how the command parses the path to your .bin file. Here’s what to check and fix:
1. Inspect your .mode file for path formatting issues
Open ca-it.mode in a text editor and look for lines that reference ca-it.automorf.bin. Chances are, the path in the mode file has extra quotes or escape characters that are breaking the apertium-pack-j tool. For example, if it’s written like "/home/.../ca-it.automorf.bin" (with quotes), that might cause the tool to misread the path as a string with extra garbage characters.
Fix it by stripping any unnecessary quotes around the file paths in the mode file, leaving just the raw absolute path (like /home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/ca-it.automorf.bin).
2. Verify the file path manually
Double-check that the file really is where you think it is by running this in your terminal:
ls /home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/ca-it.automorf.bin
If this command outputs the filename, you know the path is correct. If not, you might have a typo (check for missing directories, misspelled filenames, or case sensitivity—Linux paths are case-sensitive!).
3. Clean up your command input
Sometimes when copying commands from other sources, you might accidentally pick up smart quotes or hidden formatting that adds those stray ''\'' characters. Try typing the apertium-pack-j command manually instead of pasting it:
./apertium-pack-j /home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/modes/ca-it.mode
This avoids any weird formatting that could be corrupting the path.
4. Check file permissions
Make sure your apertium user has read access to the .bin file. Run this to check:
ls -l /home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/ca-it.automorf.bin
Look at the permission string (the first column, like -rw-r--r--). If the third group (other users) has a r (read) permission, you’re good. If not, fix it with:
chmod o+r /home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/ca-it.automorf.bin
5. Try packing files directly (bypass the mode file)
If the mode file is still causing issues, you can pass the required .bin files directly to apertium-pack-j along with the mode file. For example:
./apertium-pack-j /home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/ca-it.automorf.bin /home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/ca-it.autobil.bin /home/apertium/apertium-trunk/apertium-svn/apertium-ca-it1/modes/ca-it.mode
Just add all the necessary .bin files your language pair uses before the mode file path.
Most likely, the issue is extra quotes or escape characters in your mode file—fixing that should get the pack tool working correctly.
内容的提问来源于stack exchange,提问作者Praveen

