harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karan malhi <karan.ma...@gmail.com>
Subject Re: error when using sun compiler
Date Tue, 14 Feb 2006 20:28:10 GMT
Thanks Alexey,

This works now. Actually I had to also specify the version of the 
source. When I only specify the -target this is what I get:
[karan@j2ee bin]$ ~/jdk1.5.0_06/bin/javac -target 1.4 Test.java
javac: target release 1.4 conflicts with default source release 1.5

However, when i specify both -source and -target, it works fine.
[karan@j2ee bin]$ ~/jdk1.5.0_06/bin/javac -target 1.4 -source 1.4 Test.java
[karan@j2ee bin]$ ./java Test
Hello World


Alexey Petrenko wrote:

>>-------Suns JDK --------------------------------
>>[karan@j2ee bin]$ ~/jdk1.5.0_06/bin/javac -version
>>javac 1.5.0_06
>>
>>[karan@j2ee bin]$ ~/jdk1.5.0_06/bin/javac Test.java
>>
>>[karan@j2ee bin]$ ./java Test
>>Exception in thread "main" java.lang.UnsupportedClassVersionError:
>>(Test) bad major version at offset=6
>>    
>>
>It easy :)
>You've compiled a class with 1.5 compiler and then run it on 1.4 VM.
>You can fix this issue by two ways:
>1. Complile the class with -target 1.4 javac option
>(~/jdk1.5.0_06/bin/javac -target 1.4 Test.java) and run as ./java Test
>2. Compile without target option as you did it before and run on 1.5
>VM (~/jdk1.5.0_06/bin/java Test)
>
>This should help.
>
>--
>Alexey A. Petrenko
>Intel Middleware Products Division
>  
>

-- 
Karan Singh


Mime
View raw message