Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiling with jar files.  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Store a class file in a jar file:

I can compile with the jar file:

However, if I include the path to the source in classpath, javac apparently skips the jar file and compiles the source:

Is there some way javac can be induced to favor archived class files over compilation?
 
r. clayton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply to my message. I expected the behavior given by the (default) -Xprefer:newer option; it took me a few minutes of language lawyering to figure out why I needed -implicit:none too.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem... I've never actually run in to a case where I've had to think about this (other than academically)--what's your usecase?

And welcome to JavaRanch!
 
r. clayton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

what's your usecase?



You got it in one: academics. I make some interface source files and a jar file full of classes available in a read-only public directory. I try to discourage copying files to avoid obsolete-file problems, but compilations were failing because javac was trying to write the class files into the public directory. I resisted describing -d, but I may have to give in.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!