首页 / 操作系统 / Linux / 在 NetBeans 中开发一般 Java 应用程序时配置 Allatori 进行代码混淆
要在 NetBeans 中开发一般 Java 应用程序时利用 Allatori 进行代码混淆,设置比 IntelliJ IDEA 稍微简单一点,首先在 NetBeans 项目所在硬盘目录内创建一个名为 allatori 的子目录,将 Allatori 自己的 jar 文件都复制到这个子目录下。然后在项目所在目录内创建一个名为 config-allatori.xml 的文件,即 Allatori 自己的混淆配置文件,其内容可参考如下,作为模板也可以:<?xml version="1.0" encoding="UTF-8"?>
<config>
<jars>
<jar in="dist/test.jar" out="dist/test-obfuscated.jar"/>
</jars> <classpath>
<jar name="lib/third-lib.jar"/>
</classpath> <keep-names>
<class template="class MainJFrame">
<method template="public main(**)"/>
</class>
</keep-names> <property name="log-file" value="log.xml"/>
</config>这里注意,第 4 行的 test.jar 是你的项目最终编译生成的 jar,我这里假定你的项目名为 test,所以生成的 jar 肯定是 test.jar,而我们指定混淆后的 jar 名为 test-obfuscated.jar。所以要根据你的实际情况来确定。然后修改项目的 build.xml 文件,这个文件也在项目所在目录内,在 build.xml 的“</project>”上一行添加如下内容:1 <target name="-post-jar">
2 <taskdef name="allatori" classname="com.allatori.ant.ObfuscatorTask" classpath="allatori/allatori.jar"/>
3 <allatori config="${basedir}/config-allatori.xml"/>
4 </target>注意,第 3 行必须要有 ${basedir},如果没有总是报找不到 config-allatori.xml 文件错误。现在,你可以在 NetBeans 中对项目进行编译构建,然后在 dist 目录下就可以看到带有“-obfuscated”字样的项目 jar 文件,那就是混淆过的版本。Ubuntu 12.10 下Netbeans安装配置详解 http://www.linuxidc.com/Linux/2013-01/78357.htmUbuntu 使用教程: Ubuntu 中安装 NetBeans IDE 8.0 http://www.linuxidc.com/Linux/2014-05/101311.htmUbuntu Netbeans Xdebug 调试环境【真实环境测试】 http://www.linuxidc.com/Linux/2012-08/69079.htmNetBeans 的详细介绍:请点这里
NetBeans 的下载地址:请点这里本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-12/126095.htm