java - import com.sun.xml.internal.fastinfoset.util.StringArray 无法在 javac 上解析

标签 java ant

我正在尝试为我的项目编写 ant 脚本,但在 javac 中我面临这个问题:

80: package com.sun.xml.internal.fastinfoset.util does not exist
[javac] import com.sun.xml.internal.fastinfoset.util.StringArray;
[javac]                                        ^

JAVA_HOME设置为jdk1.6 ANT_HOME 设置为 apache-ant-1.8.4

构建文件是

<?xml version="1.0" ?>
<project name="project" default="war">
<property name="location" location="D:\Project"></property>
<property name="project-location" location="${location}\project"></property>
<path id="Web App Libraries.libraryclasspath">
 <fileset dir="${project-location}/web/WEB-INF/lib"/>
 </path>
    <path id="EAR Libraries.libraryclasspath"/>
    <path id="compile.classpath">
        <pathelement location="${project-location}/web/WEB-INF/classes"/>
        <path refid="Web App Libraries.libraryclasspath"/>
        <path refid="EAR Libraries.libraryclasspath"/>
</path>
<path id="Server Library [JBoss v4.2] (unbound).libraryclasspath"/>

<target name="init" >
    <mkdir dir="D:/JBOSSHOME/build/classes"/>
    <mkdir dir="D:/JBOSSHOME/dist" />
</target>

<target name="compile" depends="init" >
    <javac destdir="D:/JBOSSHOME/build/classes" debug="true"       srcdir="${project-location}/src">
        <classpath refid="compile.classpath"/>
    </javac>
</target>


<target name="war" depends="compile">
    <war destfile="D:/JBOSSHOME/project.war" webxml="${project-location}/web/WEB-INF/web.xml">
        <fileset dir="${project-location}/web"/>
        <lib dir="${project-location}/web/WEB-INF/lib"/>
        <classes dir="D:/JBOSSHOME/build/classes"/>
    </war>
</target>

任何帮助或指示将不胜感激!

最佳答案

不建议使用com.sun.internal包,因为

  • 不保证它们可以跨环境使用
  • 也不保证对这些类的支持

关于java - import com.sun.xml.internal.fastinfoset.util.StringArray 无法在 javac 上解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14580841/

相关文章:

JAVA 7 监视服务

java - 如何使用 Maven 创建具有依赖项的可执行/可运行 JAR?

Ant exec 任务 : How can I read input from console stdin?

scripting - ANT 如何使用 Ant 1.8 中的词法作用域属性?

android - Android/Ant 的自动化单元测试

spring - 在Spring 3中编译classfile问题

java - 如何为 JavaFX 舞台创建调整大小动画?

bubble-sort - 冒泡排序输出不正确

ant - 如何使用 Ant 重命名文件和文件夹

java - 如何在 JAX-RS ExceptionMapper 中获取响应的内容类型