Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with running my class inside ANT

 
Amir Pourteymour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a simple class, which shows JDK and java related versions. I got three different behavior in different situations. I found out when I run my class separately it gives me a different JDK version than when I call my class inside an ANT file.

It clearly shows that in my system, ANT uses JDK 1.4 inside my code. I checked my ant, and there is no place that I point to a specific JDK. I guess it uses that by default.

Does anybody have any idea about this?

When I compile my class like this :
javac -source 1.4 -target 1.5 JVMVersion.java
it gives me error of "java.lang.UnsupportedClassVersionError: JVMVersion (Unsupported major.minor version 49.0)"

------------------------------------
if I compile them like this javac -source 1.3 -target 1.4 JVMVersion.java
it works very well and gives me JDK versions it is using:
Java Version : 1.6.0_03
Java vendor : Sun Microsystems Inc.
Java home : C:\Program Files\Java\jre1.6.0_03
*************
JVM specification version : 1.0
JVM Version : 1.6.0_03-b05
*************
JRE specification version : 1.6
--------------------------------------
If I again compile them like javac -source 1.3 -target 1.4 JVMVersion.java
and call them from an ant file to run. It returns different JDK version:
[java] Java Version : 1.4.2_05
[java] Java vendor : Sun Microsystems Inc.
[java] Java home : C:\Borland\BDP\jdk\jdk1.4.2\jre
[java] *************
[java] JVM specification version : 1.0
[java] JVM Version : 1.4.2_05-b04
[java] *************
[java] JRE specification version : 1.4
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic