在Windows下同时运行的多个Java版本 [英] Multiple Java versions running concurrently under Windows

查看:432
本文介绍了在Windows下同时运行的多个Java版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Java 5上运行了几个应用程序,现在想要引入基于Java 6的应用程序。这两个java版本可以在Windows下共存吗?

We have a couple of applications running on Java 5 and would like now to bring in an application based on Java 6. Can both java versions live together under Windows?

是否有任何控制面板可以为不同的应用程序或任何其他设置方式设置适当的Java版本,将使用哪个版本的Java来运行该特定应用程序?

Is there any control panel to set the appropriate Java version for different applications, or any other way to set up, what version of Java will be used to run that particular application?

推荐答案

当然,您可以在Windows下使用多个版本的Java。不同的应用程序可以使用不同的Java版本。你的申请是如何开始的?通常你会有一个批处理文件,其中有类似

Of course you can use multiple versions of Java under Windows. And different applications can use different Java versions. How is your application started? Usually you will have a batch file where there is something like

java ...

这将使用PATH变量搜索Java可执行文件。因此,如果Java 5首先出现在PATH上,那么运行Java 6应用程序时会遇到问题。然后,您应该修改批处理文件以使用某个Java版本,例如通过定义环境变量 JAVA6HOME ,其值为 C:\ _java \ java6 (如果安装了Java 6)此目录)并更改批处理文件调用

This will search the Java executable using the PATH variable. So if Java 5 is first on the PATH, you will have problems running a Java 6 application. You should then modify the batch file to use a certain Java version e.g. by defining a environment variable JAVA6HOME with the value C:\java\java6 (if Java 6 is installed in this directory) and change the batch file calling

%JAVA6HOME%\bin\java ...

这篇关于在Windows下同时运行的多个Java版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆