简体   繁体   中英

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

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?

将 -source 1.1 添加到命令行

javac -source 1.1 -target 1.1 Hello.java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM