2013-03-30 1 views
1

편집 : 위의 모든 문제는 내장 jvm 인수가있는 실행 가능 jar를 작성하면 피할 수 있습니다. 일단 생성되면 appbundler를 사용하여 .app로 묶을 수 있습니다. VM 인수를 실행 파일 .jar에 어떻게 통합 할 수 있습니까?Eclipse Ant : appbundler를 사용하여 .app로 번들 .jar 번들


내가 오라클 appbundler를 사용하여 .APP으로 묶을 수있어 실행 항아리있어 (이 OS X에서 작동하도록). 내 항아리는 java -XstartOnFirstThread -jar PhotoSelector.jar을 사용하여 터미널에서 실행하면 OS X에서 완벽하게 작동합니다. SWT (실행 가능한 jar에 패키지되어 있음)와 코코아 제한으로 인해 -XstartOnFirstThread을 자바 인수로 설정해야합니다. 문제는 내가 올바르게 구성하는 방법을 모르겠다. (개미!) 두 번 누르기를 설정하려면 .app은 -XstartOnFirstThread 인수를 사용하여 내 응용 프로그램을 실행합니다. 그래서, 내 질문은 build.xml 파일

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
    <!-- WARNING: Eclipse auto-generated file. 
       Any modifications will be overwritten. 
       To include a user specific buildfile here, simply create one in the same 
       directory with the processing instruction <?eclipse.ant.import?> 
       as the first entry and export the buildfile again. --> 
    <project basedir="." default="build" name="PhotoSelector"> 
    <property environment="env"/> 
    <property name="ECLIPSE_HOME" value="../../../eclipse Java"/> 
    <property name="debuglevel" value="source,lines,vars"/> 
    <property name="target" value="1.7"/> 
    <property name="source" value="1.7"/> 
    <import file="buildMac.xml"/> 
    <path id="PhotoSelector.classpath"> 
     <pathelement location="bin"/> 
     <pathelement location="lib/swt_64_OsX.jar"/> 
    </path> 
    <target name="init"> 
     <mkdir dir="bin"/> 
     <copy includeemptydirs="false" todir="bin"> 
      <fileset dir="src"> 
       <exclude name="**/*.java"/> 
      </fileset> 
     </copy> 
    </target> 
    <target name="clean"> 
     <delete dir="bin"/> 
    </target> 
    <target depends="clean" name="cleanall"/> 
    <target depends="build-subprojects,build-project" name="build"/> 
    <target name="build-subprojects"/> 
    <target depends="init" name="build-project"> 
     <echo message="${ant.project.name}: ${ant.file}"/> 
     <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}"> 
      <src path="src"/> 
      <classpath refid="PhotoSelector.classpath"/> 
     </javac> 
    </target> 
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/> 
    <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler"> 
     <copy todir="${ant.library.dir}"> 
      <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> 
     </copy> 
     <unzip dest="${ant.library.dir}"> 
      <patternset includes="jdtCompilerAdapter.jar"/> 
      <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> 
     </unzip> 
    </target> 
    <target description="compile project with Eclipse compiler" name="build-eclipse-compiler"> 
     <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> 
     <antcall target="build"/> 
    </target> 
    <target name="Main"> 
     <java classname="com.selector.Main" failonerror="true" fork="yes"> 
      <classpath refid="PhotoSelector.classpath"/> 
     </java> 
    </target> 
</project> 

BuildMac.xml

<?eclipse.ant.import?> 
<project name="PhotoSelectorBundler"> 
<taskdef 
name="bundleapp" 
classname="com.oracle.appbundler.AppBundlerTask" 
classpath="lib/appbundler-1.0.jar" /> 

<target name="bundle"> 
<bundleapp 
    outputdirectory="dist" 
    name="PhotoSelector" 
    displayname="Photo Selector" 
    identifier="com.selector.Main" 
    mainclassname="Main" 
    icon="src/com/selector/256.icns"> 
    <classpath file="dist/PhotoSelector.jar" /> 
</bundleapp> 
</target> 
</project> 

:이 내 XML 파일입니다

  1. 어떻게 전달 - XstartOnFirstThread를 .app로 두 번 클릭하면 기본적으로?
  2. 타겟. 내가 .app을 올바르게 내보내려면 개미 도구에서 선택해야합니다.

지금 내 .APP가 생성되지만 즉시 닫습니다. Jar Bundler는 Java 1.7 (내 프로젝트에서 널리 사용됨)을 지원하지 않기 때문에 appbundler를 사용합니다. 고맙습니다!

답변

3

-XstartOnFirstThread를 .app에 두 번 클릭 할 때 기본적으로 전달하는 방법은 무엇입니까? 내가 제대로 내 .APP 수출 개미 도구 Eclipse에서 선택할 수있어

<option value="-XstartOnFirstThread"/> 

느릅 나무 대상 :

은 당신의 <bundleapp> 태그 안에 다음을 추가?

난 당신이 여기에 물어 정확히 모르겠어요. 아마도 그것은 bundleapp 표적 일 것입니다. 단계별 가이드는 Jar Bundler documentation을 참조하십시오.

Mac 응용 프로그램은 확장명이 ".app"인 디렉토리입니다. 해당 디렉토리 안에 Contents/Info.plist 파일이 있습니다. 여기에는 JVM 인수 및 기타 Java 관련 정보가 포함됩니다. 문제가 계속 발생하면 조사를 시작할 수있는 좋은 장소가 될 수 있습니다. 또한 다른 사람들이 귀하의 질문에 답변하는 데 도움이됩니다.

+0

완벽하게 작동했습니다! .app을 작동 시키려면''(swt 라이브러리의 경로)라는 또 다른 행을 추가했습니다. 라이브러리가 실행 가능한 jar 파일로 패키징 된 경우에도 .app에도 추가해야합니다. JVM 인수를 명령 줄의 런타임 옵션으로 JVM에 전달할 수 없다는 것을 발견했습니다. 고맙습니다! – Angelo