Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile a class in to Jdk 1.1 version which was in Jdk 1.6?

Tags:

java

I have a .class file which is in jdk 1.1 version. When i tried to compile in Jdk 1.5 and 1.6, it shows BadClassVersionError.

So I tried for jdk 1.1 version. I am unable to get it from anywhere. Except from sun's java site. but when I try to install, its not installing.

As I searched google, I came to know that there is an other option so that we can compile our class in 1.1 version.

Hello.java is my java file. and my current version is jdk 1.6

When I use the below command:

javap -verbose Hello

It shows minor version : 0 and major version : 50

Now I used the below command :

javac -target 1.5 Hello.java

It works correctly. Now it shows major version as 49.

But the problem is when I try the same command with target 1.1.

javac -target 1.1 Hello.java

It's not working, it shows the below error:

javac: target release 1.1 conflicts with default source release 1.5

Is the command usage wrong?

like image 240
LazyGuy Avatar asked Dec 09 '11 04:12

LazyGuy


1 Answers

Add -source 1.1 to your commandline

javac -source 1.1 -target 1.1 Hello.java
like image 84
Neil Essy Avatar answered Oct 02 '22 13:10

Neil Essy