JavaFX bundle exe没有显示TableView内容

时间:2013-01-16 10:07:14

标签: java tableview javafx native proguard

我们创建了一个JavaFX应用程序,其中包含许多 TableView 来显示数据。 我们使用 Ant 构建了本机包,我们模糊 jar Proguard-4.8 ,我们可以使用混淆创建本机包exe jar成功了。当我们运行exe时,它成功启动应用程序,一切正常,数据存在于tableView中,但是我们无法在TableView中看到数据。在附加于TableView的屏幕截图下面附上 -

注意:我们能够在没有模糊处理的情况下使用jar和exe创建TableView中的数据。

TableView

在build.xml中混淆jar的步骤

<target name="ObfuscatingProject" depends="apidocs">

            <taskdef resource="proguard/ant/task.properties" classpath="${WorkingFolder}/proguard.jar" />
            <proguard>
                -dontusemixedcaseclassnames
                -printmapping Project_Proguard.map
                -dontshrink
                -dontoptimize
                -dontskipnonpubliclibraryclasses
                -dontskipnonpubliclibraryclassmembers

                -libraryjars "${java.home}/lib/rt.jar"
                -libraryjars "${java.home}/lib/javaws.jar"
                -libraryjars "${env.JAVA_HOME}/lib/ant-javafx.jar"
                -libraryjars "${env.JAVA_HOME}/jre/lib/jfxrt.jar"           
                -libraryjars ${WorkingFolder}/libs/BareBonesBrowserLaunch.jar
                -libraryjars ${WorkingFolder}/libs/activation.jar
                -libraryjars ${WorkingFolder}/libs/log4j-1.2.16.jar
                -libraryjars ${WorkingFolder}/libs/commons-codec-1.5.jar
                -libraryjars ${WorkingFolder}/libs/commons-httpclient-3.1.jar
                -libraryjars ${WorkingFolder}/libs/commons-logging-1.1.1.jar
                -libraryjars ${WorkingFolder}/libs/commons-io-2.0.1.jar
                -libraryjars ${WorkingFolder}/libs/xercesImpl-2.9.1.jar
                -libraryjars ${WorkingFolder}/libs/javax.mail.jar
                -libraryjars ${WorkingFolder}/libs/balloontip-1.2.1.jar
                -libraryjars ${WorkingFolder}/libs/httpclient-4.1.1.jar
                -libraryjars ${WorkingFolder}/libs/httpcore-4.1.3.jar
                -libraryjars ${WorkingFolder}/libs/jcifs-1.3.16.jar         
                -libraryjars ${WorkingFolder}/libs/proguard-4.8.jar
                -libraryjars ${WorkingFolder}/libs/xml-apis-1.3.04.jar
                -libraryjars ${WorkingFolder}/libs/swingx-1.6.jar
                -libraryjars ${WorkingFolder}/libs/derby.jar


                -injars ${WorkingFolder}/${app.name}.jar
                -injars ${WorkingFolder}/CustomJars/LicVerifier.jar(!META-INF/MANIFEST.MF)
                -injars ${WorkingFolder}/CustomJars/LicUtility.jar(!META-INF/MANIFEST.MF)


                -outjars ${WorkingFolder}/ObfuscatedProjectJar/ProjectObfuscated.jar

                -ignorewarnings

                -keepattributes 

                Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod
                -adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF,images/*.jar,Project.version

                -keepclassmembernames class * {
                    @javafx.fxml.FXML *;
                } 

                -keepclassmembernames class com.javafx.main.Main {
                    public static void main(java.lang.String[]);
                } 


                -keep class com.javafx.main.*

                -keepclasseswithmembers public class com.javafx.main.Main{
                    public static void main(java.lang.String[]);
                }

                -keepclasseswithmembers public class com.project.main.ProjectEntryFX{
                    public static void main(java.lang.String[]);
                 }

                -keepclasseswithmembers public class net.project.license.LicEntryPoint{
                     public *;
                 }


                -keep class * extends org.xml.sax.helpers.DefaultHandler

                -keepclassmembers class * extends org.xml.sax.helpers.DefaultHandler {
                    private *;
                        public *;
                }

            </proguard>
    </target> 

有人可以建议我在JavaFX TableView中查看数据需要改进吗?

感谢您的帮助!!

1 个答案:

答案 0 :(得分:4)

javaFx必须考虑其名称来访问类的某些方法。

例如:如果你有一个人类名字,姓名,surName,......你可能写道:

public Class Person {

private StringProperty name, surname,....

public StringProperty nameProperty() {
        return name;
    }

public StringProperty surnameProperty() {
        return surname;
}

...

}

像nameProperty,surnNameProperty这样的方法可能会在您的应用程序中通过以下代码访问:

new PropertyValueFactory<Person, String>("name")
new PropertyValueFactory<Person, String>("surName")

混淆器不得重命名此类方法(nameProperty,surnameProperty ...)。您可以通过以下配置告诉它:

-keepclassmembers public class yourpackage.** {
    public javafx.beans.property.StringProperty *Property();
}