File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Splitting Source and Class Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Splitting Source and Class Code" Watch "Splitting Source and Class Code" New topic
Author

Splitting Source and Class Code

Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
Just wondering id someone could help me with sourcepaths
I have the directory structure
classes
src
sampleproject
db
and am trying to split the source and class files
If I use
javac -d classes src/sampleproject/db/*.java
the files are compiled to the classes directory but under src.
I tried
javac -d classes -sourcepath src sampleproject/db/*.java
which I expected to work but my java files could not be found.
Also tried some varations with classpath but got lost.
Any ideas
Could anyone point out a fundemental error I'm making
Cheers Tony
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
Just clear up the structure of my directories structure
src---->sampleproject---->db contains java source
classes->
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Try this:
javac -sourcepath src/sampleproject/db/ -d classes *.java
Make sure that the directory classes exists and that both source and class directories are on the same mounted root.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
No Luck with that. Still get error: cannot read *.java
The files are there and I'm calling javac from the directory above classes and src.
Does javac work in some strange way or am I missing something?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
I'm having the same problem. If I use a sourcepath javac doesn't seem to be able to locate the source files. Maybe someone else knows something about this?
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Tony,
i tried following,
i have a dir hierarchy as,
HOME/test1/test2/test.java
HOME/test3
i write following command,
javac -d test3 test1/test2/*.java
and it creats test.class in test3 directory...
thats what u want right?
also, u r not using any Packages right? because if u have package src for each .java file then it WILL create the src directory in the classes and then put all class files there...
regards
maulin
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
Cheers my packaging is the problem
My package was src.sampleproject.db
hence the confusion
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Splitting Source and Class Code
 
Similar Threads
Error "Class sampleproject.remote.DvdDatabaseImpl not found "
Sample Project
Question on javadoc
Habibi book--HELP-I have a problem compiling the source as outlined on pages 319-320
about compilation and JVM version