This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes compiling with the -source flag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compiling with the -source flag" Watch "compiling with the -source flag" New topic
Author

compiling with the -source flag

Joe Lemmer
Ranch Hand

Joined: Oct 24, 2008
Posts: 171
Hi there

My web server runs Java 1.5, so I'm getting an exception because I am using JDK 1.6 to compile my classes. Running two different versions of the JDK is just confusing me. I can't work out if it's even possible. I read that I can compile using the following:



Can anyone confirm for me that this will produce the same class file as if I had been compiling with the JDK 1.5? I just want to make sure that I have everything right before I try to put things up on the web again.

Thank you guys

Joe


OCPJP 85%
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
Make sure not to use any "since 6" classes or methods. I suspect you actually want the -target flag. The -source flag might be useful for avoiding any "since 6" material, however.
Joe Lemmer
Ranch Hand

Joined: Oct 24, 2008
Posts: 171
Great. Thanks very much Campbell.

I've had a look on this page about compiling and you're right, I do want to use -target. Cheers for pointing that out.



Joe
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
You're welcome
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: compiling with the -source flag
 
Similar Threads
Can't run Axis2 1.5.1 under Tomcat 5.5 using JDK 1.5?
How to specify jdk version in build.xml
Error compiling program in NetBeans
Has the Tiger been released?
Error in deploying EJB-