Home > Archive > Java Help > March 2004 > Use of sourcepath option
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Use of sourcepath option
|
|
| Robert Mark Bram 2004-03-28, 12:01 am |
| Howdy All!
I am trying to use -sourcepath and am becoming a little frustrated as to why
this doesn't work:
F:\java\tests\wtk\bin>javac -sourcepath ..\src -d ..\classes Command1.java
error: cannot read: Command1.java
1 error
F:\java\tests\wtk\bin>dir ..\src
Volume in drive F is BARRACUDA1
Volume Serial Number is 9CE5-75F0
Directory of F:\java\tests\wtk\src
27/03/2004 09:15 AM <DIR> .
27/03/2004 09:15 AM <DIR> ..
27/03/2004 09:15 AM 1,492 Command1.java
1 File(s) 1,492 bytes
2 Dir(s) 9,938,026,496 bytes free
F:\java\tests\wtk\bin>
Any ideas would be most appreciated!
Rob
:)
| |
| Roedy Green 2004-03-28, 12:01 am |
| On Sat, 27 Mar 2004 16:35:26 +1100, "Robert Mark Bram" <none> wrote or
quoted :
>F:\java\tests\wtk\bin>javac -sourcepath ..\src -d ..\classes Command1.java
What happens if you use quotes e.g. "\src" ?
or an absolute path e.g. "f:\java\tests\wtk\src" ?
or / in filenames e.g. "../src".
I have never used -sourcepath. It is easier to just do a CD to the
source files.
If you figure it out , please report back so I can add a note to
http://mindprod.com/jgloss/javac.html
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
| |
| Tony Morris 2004-03-28, 12:01 am |
|
> F:\java\tests\wtk\bin>javac -sourcepath ..\src -d ..\classes Command1.java
> error: cannot read: Command1.java
> 1 error
>
javac -sourcepath ..\src -d ..\classes ..\src\Command1.java
You might also want to look at http://ant.apache.org
--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)
| |
| Robert Mark Bram 2004-03-28, 12:01 am |
| Hi Tony!
Command1.java[color=darkred]
>
> javac -sourcepath ..\src -d ..\classes ..\src\Command1.java
Maybe I misunderstood, but I do not think this is the solution. The compile
command will work with or without -sourcepath if I include the path as part
of the last argument:
F:\java\tests\wtk\bin>javac -d ..\classes ..\src\test\HelloWorld.java
F:\java\tests\wtk\bin>java -cp ..\classes test.HelloWorld
Hello World!
F:\java\tests\wtk\bin>javac -sourcepath ..\src -d ..\classes
...\src\test\HelloWorld.java
F:\java\tests\wtk\bin>java -cp ..\classes test.HelloWorld
Hello World!
F:\java\tests\wtk\bin>
Rob
:)
| |
| Roedy Green 2004-03-28, 12:02 am |
| On Sat, 27 Mar 2004 18:59:56 +1100, "Robert Mark Bram" <none> wrote or
quoted :
>Maybe I misunderstood, but I do not think this is the solution. The compile
>command will work with or without -sourcepath if I include the path as part
>of the last argument:
A gather than -sourcepath is just an additional set of directories to
look in for source code referenced in the *.java files you mention on
the command line. It does not change the default directory.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
| |
| Squanderette 2004-03-28, 12:02 am |
|
"Tony Morris" <@dibblegoATbigpond.com@> wrote in message
news:xB99c.126149$Wa.14855@news-server.bigpond.net.au...
>
Command1.java[color=darkred]
>
> javac -sourcepath ..\src -d ..\classes ..\src\Command1.java
>
> You might also want to look at http://ant.apache.org
>
Hummm..
Looks like sourcepath will be used to find other classes (or *.java) but the
actually file to be compiled must be named explicitly.
Given (say) c:\a\X.java and c:\a\b\Y.java -
if Y.java references X.java then from c:\a\b you can compile Y.java thus:
javac -sourcepath .. Y.java
If X.java and Y.java are both in C:\a and you compile from c:a\b you need:
javac -sourcepath .. ..\Y.java
If Y.java does not reference X.java then, from c:\a\b
javac ..\Y.java
X.java will also be compiled if required.
Sorry - badly explained - can someone do it properly please?
The manuals really don't make this clear.
Julia
--
Squanderette
"What is this life, if full of care,
We have no time to stand and stare ..."
|
|
|
|
|