Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Jar绑定器无法从Jar文件自动获取主类。你能描述一下整个过程吗?_Java_Macos_.app - Fatal编程技术网

Java Jar绑定器无法从Jar文件自动获取主类。你能描述一下整个过程吗?

Java Jar绑定器无法从Jar文件自动获取主类。你能描述一下整个过程吗?,java,macos,.app,Java,Macos,.app,我需要通过mac os x中的jar bundler将jar文件包装到.app文件中,但无论何时我要这样做,jar bundler都可以从jar文件中获取主类,但这个jar在windows或Linux平台上运行良好,请给我将jar文件包装到mac os可执行文件.app的链接或适当的分步说明。提前感谢。只需将ant builder与custom build.xml文件一起使用即可 使用ant的命令是 点击命令后,通过终端转到build.xml文件的位置 $ant yourTargetName

我需要通过mac os x中的jar bundler将jar文件包装到.app文件中,但无论何时我要这样做,jar bundler都可以从jar文件中获取主类,但这个jar在windows或Linux平台上运行良好,请给我将jar文件包装到mac os可执行文件.app的链接或适当的分步说明。提前感谢。

只需将ant builder与custom build.xml文件一起使用即可

使用ant的命令是

点击命令后,通过终端转到build.xml文件的位置

 $ant yourTargetName
在build.xml文件中声明目标名称的位置

<?xml version="1.0"?>
  <project name="Project Name" default="default" basedir=".">


    <taskdef name="bundleapp"
     classname="com.oracle.appbundler.AppBundlerTask"
     classpath="lib/appbundler-1.0.jar" />



     <target name="bundle-Target Name">
       <bundleapp outputdirectory="."
           name="Your Project Name"
           displayname="yourProjectDisplayName"
           identifier="yourMainClassName"
           shortversion="1.0"
           applicationCategory="public.app-category.developer-tools"
           mainclassname="yourMainClassName">

           <classpath file="/yourJarFileLocation"/>
           <option value="-Dapple.laf.useScreenMenuBar=true"/>
       </bundleapp>
     </target>
  </project>

您是否有不使用JWS的重要原因?它1更便携2更易于维护3功能齐全。如果您出于某种原因决定必须将程序捆绑为.app,那么肯定不推荐使用-JarBundler。现在我按照您的建议使用app bundler,但这次它导致了一个错误taskdef class com.oracle.appbundler.appbundler任务无法使用classloader AntClassLoader[]ppst99-您是否为taskdef指定了正确的类路径?lib/appbundler-1.0.jar此处我的appbundler jar文件是通过注释定位的,如果有用的话,很少使用注释。通过在线调查,诚实地解决问题,如果遇到具体问题,将其作为单独的问题发布。
 $productbuild --component filename.pkg /your app file location