I am trying to run the following
javac -Xlint:unchecked -classpath C:/Users/a b/workspace/ #C:/Users/a b/workspace/files_to_compile
but I'm getting a
javac: invalid flag C:/users/a
I've also tried to surround both paths with double quotes but it doesn't seem to help a bit:
javac -Xlint:unchecked -classpath "C:/Users/a b/workspace/" #"C:/Users/a b/workspace/files_to_compile"
What am I doing wrong? This same code worked correctly in other computers (probably because they didn't have any white space in their paths..).
Thanks
I've finally come up with the solution to the issue, and I guess no one here could have guessed it.
The cue to the answer lies with the fact that the contents of the files list (signaled as # in the args) generally will have each one of its strings with the initial substring equal to what one passes as both the class path and the # file.
so..
The trouble was never the command line parameters, as suggested, but with the contents of the # file.
Each line of the file must be put in its own line, surrounded by quotes, and having into consideration that if you're in windows, you have to put the file names in the form of C:\\a\\b\\c.txt!!!
Your second try is right
javac -Xlint:unchecked -classpath "C:/Users/a b/workspace/" #"C:/Users/a b/workspace/files_to_compile"
But to be complete, you have to escape the spaces into the text file "files_to_compile" by using:
the same syntax as properties file : \
or
double quote each line
I suggest the second but I'm not sure.
I have to admit this was more difficult than I had imagined.
After some trial and error I came up with the following:
C:\lol>"C:\Program Files\Java\jdk1.7.0_07\bin\javac" -cp "c:\lol\a b;c:\lol\foo bar" Lol.java
where the folder structure is like:
./foo bar
./foo bar/Moo.java
./Lol.java
./a b
./a b/AB.java
I made an archive with the folders and the java files, which you can grab at:
http://www.pvv.ntnu.no/~rakhmato/tmp/lol.tar
You should ignore the # option because it is enough to give the compiler one file and a proper class path, it can figure out where everything is on its own. Just give the compiler your Main.java and it will figure out what that file depends on.
I would also recommend you to write a .bat script of sorts to make things simpler. Nothing fancy, something like this:
compile.bat:
"C:\Program Files\Java\jdk1.7.0_07\bin\javac" -classpath "c:\lol\a b;c:\lol\foo bar" Main.java
..put that in your project folder and run compile.bat from CMD
First using the cd command in shell shift your directory to the one where your file is saved.
cd /home/sayantani/PERSONAL\ FILES/sem\ 4\ courses/PLC/code/
Note that I've used "\" whenever there is space involved. "PERSONAL FILES" becomes "PERSONAL\ FILES".
Then use "javac filename.java"
javac hello1.java
This should fix your problem.
Note that doing "javac" on the entire path from the default directory isn't working.(for me)
You need to escape spaces.
Put a \ in front of each space and try that.
Its taking only the 1st part of the Source String remove the space between a b from the path and it should work fine C:/Users/a_b/workspace/" #"C:/Users/a_b/workspace/files_to_compile" . Never you should have spaces in the path else the latter part will be ignored by the compiler or else you can put a '\' between a\ b
Bit of a hack, but if you're on Windows 7 you can get around this using the mklink utility to create another folder pointing to the same place, but without spaces.
Edit: perhaps a better solution:
cd "C:/Users/a b/"
javac ... -classpath "Workspace" ...
From usage info for "java /?"
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cd "C:\Program Files (x86)\Java\jre6\bin"
C:\Program Files (x86)\Java\jre6\bin>java.exe
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-classpath indicates that you need to use a semi-colon (";") for multiple paths.
I can't test it but I'd suggest the following (as dmcgil suggested semicolon should be classpath separator on windows):
javac -Xlint:unchecked -classpath C:\Users\a^ b\workspace\;C:\Users\a^ b\workspace\files_to_compile
It seems that the escape charachter for win shell is caret.
That is also suggested here.
EDIT:
Also, in your question, I noticed usage of slashes (/) in paths, doesn't all versions of windows use backslashes(\) as file separators? I saw your comment somewhere on this thread stating just that, so I'll suppose you typoed in question.
Related
I am following the foma tutorial on https://fomafst.github.io/morphtut.html, and everything has worked for me except flookup. I have added C:\Program Files\foma to my PATH system variable and compiled the lexc, foma, and bin files, but when I try
C:\Program Files\foma>echo "begging" | flookup english.bin
I get
"begging" +?
And when I try
C:\Program Files\foma>echo "beg+V+PresPart" | flookup -i english.bin
I get
"beg+V+PresPart" +?
The correct output should be
begging beg+V+PresPart
and
beg+V+PresPart begging
respectively.
My best guess is that this is a compatibility issue between Linux and Windows. What should I do to make this work?
This is an old question, but in case someone still needs the answer: it's the trailing space after the word to analyze. This works in Windows 10 cmd:
$ echo city| flookup.exe english.bin
city city+N+Sg
Note how the pipe has to come right after the end of the word, otherwise it will look up "city "
I'm trying to install a grunt template on my computer but I'm having issues. I realized that perhaps something different is happening because of the path given by the Grunt docs, which is
%USERPROFILE%\.grunt-init\
What does that . mean before grunt-init?
I've tried to do the whole import manually but it also isn't working
git clone https://github.com/gruntjs/grunt-init-gruntfile.git "C:\Users\Imray\AppData\Roaming\npm\gru
nt-init\"
I get a message:
fatal: could not create work tree dir 'C:\Users\Imray\AppData\Roaming\npm\.grunt-init"'.: Invalid argument
Does it have to do with this /.? What does it mean?
The \ (that's a backslash, not a slash) is a directory delimiter. The . is simply part of the directory name.
.grunt-init and grunt-init are two distinct names, both perfectly valid.
On Unix-like systems, file and directory names starting with . are hidden by default, which is why you'll often see such names for things like configuration files.
The . is part of a directory name. Filenames can contain . . The \ is a separator between directory names.
Typically, files or directories starting with . are considered "hidden" and/or used for storing metadata. In particular, shell wildcard expansion skips over files that start with ..
For example if you wrote ls -d * then it would not show any files or directories beginning with . (including . and .., the current and parent directories).
Linux hides files and directories whose names begin with dot, unless you use the a (for "all") option when listing directory contents. If this convention is not followed on Windows, your example is probably just a carryover.
It may well be something behind the scenes (later) expects that name to match exactly. While I like things, installers, for example, to just do what I said, I realize that keeping default value is the most tested path.
Directories starting with a dot are invisible by default on xNIX systems. Typically used for configurations files and similar in a users home directory.
\ before " has a special meaning on windows, the error is because windows won't let you create a file containing " as part of its name.
So I am trying to compile Pascal programs and everything is find; however, I would like to put the generated files after each compilation is a separated folder. I am looking of something like this: fpc "Destination Folder" "program.pas".
Thanks
From Alphabetical listing of command line options
-FE<x> Set exe/unit output path to <x>
-FU<x> Set unit output path to <x>, overrides -FE
So something like fpc program.pas -FEc:\output should work. I don't have fpc installed so I cannot verify. If you try it and get errors that you can't work through post them.
This one works for me:
fpc hello.pas -o"Web/hello.cgi"
I was using ubuntu, notice there is no space between the argument -o and the beginning of the path "Web/..."
I have added a include directory in my home directory. I can run "ls -l ~/include" from the build directory.
I have added that directory in both "Header Seach Path" and in "User Header Search Path". In both places I have tried with both non-recursive and recursive.
But xcode 4.5.1 can not in any situation find the first stated header file.
It is stated in source code calls.m as:
#include <directory/file.h>
I get a "Lexical or Preprocessor issue 'directory/file.h' file not found."
But when running xcodebuild from cli it has no problems what so ever to build the source.
I have tried many of the suggestions found on internet
Putting a include in /usr/ om my drive
Adding a index to the project, adding files with no copy and no "Add to target" marked.
Restart xcode.
Specifying all specific paths.
But still no go.
What is the problem. BugĀ“s in xcode?
I just had a similar issue, and it was because there were spaces in the path which I defined for the Header Search Path. For example, I was defining the following as a search path:
$(SRCROOT)/Frameworks/Headers
which was being expanded out to the following:
/Users/skoota/Documents/Xcode Projects/My App/Frameworks/Headers
as you can see, there are spaces within the path (which are not immediately evident, as you are using the $(SRCROOT) variable) and the compiler doesn't particularly appreciate the spaces. I solved this problem by changing the search path to this:
"$(SRCROOT)"/Frameworks/Headers
(note the quote marks around $(SRCROOT) which escapes the spaces). This now expanded out to:
"/Users/skoota/Documents/Xcode Projects/My App"/Frameworks/Headers
which works perfectly, although looks a bit odd with the embedded " marks. This took me a while to figure out, so hopefully it helps!
This usually happens if there are spaces in your directory's path. To overcome this problem, use double quotes around the path.
Suppose you want to use your project directory, then you should use: $PROJECT_DIR. Enable recursive if you want to search within the folders as well. Alternatively, you can use $(SRCROOT)
I'm just learning Ruby and making a simple Hello World program, put for some reason the command prompt can not find the directory (which is C:\Documents and Settings\Matt\My Documents\Ruby Testing Zone\hello.rb). With the directory set to C:\Ruby193\bin, I tried to type this command to run my program:
ruby C:\Documents and Settings\Matt\My Documents\Ruby Testing Zone\hello.rb
And I end up with this error:
ruby: No such file or directory -- C:\Documents <LoadError>
I have checked many times to make sure I'm not misspelling any part of the file name. What is going on?
Put double-quotes around the whole filename. Windows won't treat it as a single parameter otherwise.
In your open command, make sure that the spaces between Documents, and, and Settings are proceded with a backslash. In other words, here's what the path should be:
C:\\Documents\ and\ Settings\\Matt\\My\ Documents\\Ruby\ Testing\ Zone\\hello.rb
Or, replace the double-backslashes with slashes:
C:/Documents\ and\ Settings/Matt/My\ Documents/Ruby\ Testing\ Zone/hello.rb