File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Splitting Source and Class Code

 
Tony Collins
Ranch Hand
Posts: 435
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 435
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just clear up the structure of my directories structure
src---->sampleproject---->db contains java source
classes->
 
Michael Morris
Ranch Hand
Posts: 3451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tony Collins
Ranch Hand
Posts: 435
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1873
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 435
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic