因工作需要一个系统上安装了多个Java版本,现在我用Java1.6编译了我的桌面程序,结果在运行的时候Java1.3被启动了,造成版本错误,现在想要在不改变环境变量的情况下(会影响其他程序)可以启动正确的Jre,通过启动脚本实现,那位大虾帮忙作一下

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【yanmings】截止到2008-07-11 21:59:31的历史汇总数据(不包括此帖):
    发帖的总数量:1                        发帖的总分数:0                        每贴平均分数:0                        
    回帖的总数量:6                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:0                        结贴的总分数:0                        
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:1                        未结的总分数:0                        
    结贴的百分比:0.00  %               结分的百分比:---------------------
    无满意结贴率:---------------------无满意结分率:---------------------
    如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
      

  2.   

    把path和注册表中的运行环境都修改一下
      

  3.   

    补充:我的程序可能在任何不熟悉的客户端被安装,客户端的安装路径也是变化的,而且客户端可能安装多个版本的Jre,所以启动的路径不能写死,我想应该用cmd 的for做
      

  4.   

    那就只能把你编译用的jre一起打包到你发布的程序里了
      

  5.   

    建议楼主去注册表里找JDK1.6的安装路径, 如果没有, 只能全盘搜索了
      

  6.   

    C:\>java
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java [-options] -jar jarfile [args...]
               (to execute a jar file)where options include:
        -client       to select the "client" VM
        -server       to select the "server" VM
        -hotspot      is a synonym for the "client" VM  [deprecated]
                      The default VM is client.    -cp <class search path of directories and zip/jar files>
        -classpath <class search path of directories and zip/jar files>
                      A ; separated list of directories, JAR archives,
                      and ZIP archives to search for class files.
        -D<name>=<value>
                      set a system property
        -verbose[:class|gc|jni]
                      enable verbose output
        -version      print product version and exit
        -version:<value>
                      require the specified version to run

        -showversion  print product version and continue
        -jre-restrict-search | -jre-no-restrict-search
                      include/exclude user private JREs in the version search
        -? -help      print this help message
        -X            print help on non-standard options
        -ea[:<packagename>...|:<classname>]
        -enableassertions[:<packagename>...|:<classname>]
                      enable assertions
        -da[:<packagename>...|:<classname>]
        -disableassertions[:<packagename>...|:<classname>]
                      disable assertions
        -esa | -enablesystemassertions
                      enable system assertions
        -dsa | -disablesystemassertions
                      disable system assertions
        -agentlib:<libname>[=<options>]
                      load native agent library <libname>, e.g. -agentlib:hprof
                        see also, -agentlib:jdwp=help and -agentlib:hprof=help
        -agentpath:<pathname>[=<options>]
                      load native agent library by full pathname
        -javaagent:<jarpath>[=<options>]
                      load Java programming language agent, see java.lang.instrument    -splash:<imagepath>
                      show splash screen with specified image
      

  7.   

    自己搞定了,如果你的系统安装有多个 Java版本,你有只想用java1.4启动你的程序,那么命令行:java -version:1.4 xxxxxx