简体   繁体   English

无法使用嵌入式jre加载Java Runtime Environment

[英]Unable to load Java Runtime Environment with embedded jre

I am trying to bundle a java application on windows for mac using appbundler-1.0.jar and Ant with an embedded jre 7. 我正在尝试使用appbundler-1.0.jar和带有嵌入式jre 7的Ant将Windows上的java应用程序捆绑在Mac上。

This is the build.xml: 这是build.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="AppName" default="default" basedir=".">
        <property environment="env" />
        <taskdef 
            name="bundleapp" 
            classname="com.oracle.appbundler.AppBundlerTask" 
            classpath="lib/appbundler-1.0.jar" />
        <target name="bundle-AppName">
            <bundleapp 
                outputdirectory="dist" 
                name="AppName" 
                displayname="AppName" 
                identifier="com.hmf.AppName" 
                icon="files\logo48.icns"
                shortversion="1.0"
                mainclassname="hmf.AppName.app">
                <classpath file="files/AppName.jar" />
                <librarypath dir="pathToLibraries" />
                <option value="-Dapple.laf.useScreenMenuBar=false"/>
                <option value="-XstartOnFirstThread=true"/>
                <option value="-Dcom.apple.macos.useScreenMenuBar=false"/>
                <option value="-Dcom.apple.smallTabs=true"/>
                <option value="-Dsun.java2d.d3d=false"/>
                <option value="-Derby.storage.pageSize=8192"/>
                <option value="-Djava.library.path=lib/swt.jar:lib"/>
                <option value="-Xmx1400M"/>
            </bundleapp>
        </target>
    </project>

I then copy jre 7 for mac to PlugIns directory under AppName.app. 然后,将Mac的jre 7复制到AppName.app下的PlugIns目录。 (I cant make it work with the runtiime tag) (我不能使其与runtiime标签一起使用)

But when I try to run the application I get: "Unable to load Java Runtime Environment". 但是,当我尝试运行该应用程序时,我得到:“无法加载Java Runtime Environment”。

When OS use system jre it works but I want to be able to use the embedded jre. 当OS使用系统jre时,它可以工作,但我希望能够使用嵌入式jre。

Also see: 另请参阅:
http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html
Application is using Java 6 from Apple instead of Java 7 from Oracle on Mac OS X? 应用程序使用的是Apple的Java 6,而不是Mac OS X上的Oracle的Java 7?

I've solved the issue with my "Unable to load Java Runtime Environment" by using an installed JDK as the jre to be embedded within my app. 通过使用已安装的JDK作为要嵌入到我的应用程序中的jre,我已经通过“无法加载Java运行时环境”解决了该问题。 I was until now using a jre unzipped within a user folder. 直到现在,我一直使用在用户文件夹中解压缩的jre。 with the JDK I set the environment variable at the command line 使用JDK我在命令行上设置了环境变量

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home

I then used the 然后我用了

<runtime dir="${env.JAVA_HOME}" />

and it worked as the jre gets installed under the Plugins directory as it should ie no need to manually copy jre 它可以将jre安装到Plugins目录下,因为它应该手动安装,即无需手动复制jre

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何重新编译Java运行时环境(JRE)? - How to recompile Java Runtime Environment (JRE)? 启动 SQLWorkbench/J 时“无法加载 Java 运行时环境” - "Unable to load Java Runtime Environment" when starting SQLWorkbench/J Java JDK 和 Java Runtime Environment (JRE) 分别是什么最新版本? - What is the latest version of Java JDK and Java Runtime Environment (JRE) respectively? java 9 eclipse氧版中选择JRE运行环境 - Choosing JRE runtime environment in java 9 in eclipse oxygen version 如何在JRE(Java运行时环境)中收集熵源? - How to collect entropy sources in JRE(Java Runtime Environment)? 我无法安装Java Runtime Environment(JRE)-错误 - I can't install Java Runtime Environment (JRE) - error 无法定位 Java 运行时环境 - Unable to locate Java Runtime Environment Java 8中的嵌入式JRE中的JDWP - JDWP in Embedded JRE in Java 8 launch4j 捆绑 JRE 错误。“此应用程序被配置为使用捆绑的 Java 运行时环境,但运行时丢失或损坏” - launch4j bundled JRE error .“This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted” Java运行时环境(JRE)或Java开发工具包(JDK)必须可用才能运行eclipse - Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM