我正在尝试创建L2j服务器(插曲(服务器。但是,当我尝试编译服务器包文件时,我遇到了麻烦。
当我以 Ant 构建方式运行build.xml
时,我得到
编译失败;有关详细信息,请参阅编译器错误输出
错误日志
Buildfile: C:Userstautigitl2j_serverL2J_Serverbuild.xml
clean:
[delete] Deleting directory C:Userstautigitl2j_serverL2J_Serverbuild
init:
[mkdir] Created dir: C:Userstautigitl2j_serverL2J_Serverbuild
[mkdir] Created dir: C:Userstautigitl2j_serverL2J_Serverbuildclasses
[mkdir] Created dir: C:Userstautigitl2j_serverL2J_Serverbuilddist
[mkdir] Created dir: C:Userstautigitl2j_serverL2J_Serverbuilddistlogin
[mkdir] Created dir: C:Userstautigitl2j_serverL2J_Serverbuilddistgameserver
compile:
[javac] Compiling 1213 source files to C:Userstautigitl2j_serverL2J_Serverbuildclasses
[javac] An exception has occurred in the compiler (1.8.0_171). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
[javac] java.lang.NullPointerException
[javac] at com.sun.tools.javac.file.Locations.getPathEntries(Locations.java:149)
[javac] at com.sun.tools.javac.file.Locations.getPathEntries(Locations.java:134)
[javac] at com.sun.tools.javac.file.Locations.access$000(Locations.java:71)
[javac] at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.computePath(Locations.java:617)
[javac] at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.lazy(Locations.java:643)
[javac] at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.getLocation(Locations.java:577)
[javac] at com.sun.tools.javac.file.Locations.getLocation(Locations.java:678)
[javac] at com.sun.tools.javac.file.JavacFileManager.getLocation(JavacFileManager.java:803)
[javac] at com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:617)
[javac] at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2750)
[javac] at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2446)
[javac] at com.sun.tools.javac.jvm.ClassReader.access$000(ClassReader.java:76)
[javac] at com.sun.tools.javac.jvm.ClassReader$1.complete(ClassReader.java:240)
[javac] at com.sun.tools.javac.code.Symbol.complete(Symbol.java:574)
[javac] at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:300)
[javac] at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:518)
[javac] at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
[javac] at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
[javac] at com.sun.tools.javac.comp.Enter.complete(Enter.java:486)
[javac] at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
[javac] at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:857)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:523)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:381)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:370)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:361)
[javac] at com.sun.tools.javac.Main.compile(Main.java:56)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:58)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1395)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1121)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[javac] at org.apache.tools.ant.Task.perform(Task.java:348)
[javac] at org.apache.tools.ant.Target.execute(Target.java:435)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
[javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[javac] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
[javac] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:460)
[javac] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:142)
BUILD FAILED
C:Userstautigitl2j_serverL2J_Serverbuild.xml:51: Compile failed; see the compiler error output for details.
Total time: 29 seconds
构建.xml
</description>
<property name="src" location="java" />
<property name="lib" location="lib" />
<property name="build" location="build" />
<property name="build.classes" location="${build}/classes" />
<property name="build.dist" location="${build}/dist" />
<property name="build.dist.login" location="${build.dist}/login" />
<property name="build.dist.game" location="${build.dist}/gameserver" />
<path id="classpath">
<fileset dir="${lib}">
<include name="c3p0-0.9.2-pre1.jar" />
<include name="bsf.jar" />
<include name="bsh-2.0b4.jar" />
<include name="commons-logging-1.1.jar" />
<include name="jython.jar" />
<include name="javolution-5.5.1.jar" />
<include name="mchange-commons-0.2.jar" />
<include name="mysql-connector-java-5.1.18-bin.jar" />
<include name="mmocore.jar" />
</fileset>
</path>
<target name="init" depends="clean" description="Create the output directories.">
<mkdir dir="${build}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.dist}" />
<mkdir dir="${build.dist.login}" />
<mkdir dir="${build.dist.game}" />
</target>
<target name="compile" depends="init" description="Compile the source.">
<javac destdir="${build.classes}" optimize="on" debug="on" source="1.8" target="1.8" nowarn="off" includeantruntime="false" deprecation="yes">
<src path="${src}" />
<classpath refid="classpath" />
<compilerarg value="-Xlint" />
</javac>
</target>
<target name="jar" depends="compile" description="Create the jar file">
<jar destfile="${build}/l2jserver.jar">
<fileset dir="${build.classes}" />
<manifest>
<attribute name="Main-Class" value="net.sf.l2j.Server" />
<attribute name="Class-Path" value=". bsf.jar bsh-2.0b4.jar commons-logging-1.1.jar c3p0-0.9.2-pre1.jar jython.jar mysql-connector-java-5.1.18-bin.jar javolution-5.5.1.jar mchange-commons-0.2.jar mmocore.jar" />
</manifest>
</jar>
<copy todir="${build.dist.login}">
<fileset dir="${build}">
<include name="l2jserver.jar" />
</fileset>
</copy>
<copy todir="${build.dist.game}">
<fileset dir="${build}">
<include name="l2jserver.jar" />
</fileset>
</copy>
</target>
<target name="build" depends="jar">
<copy todir="${build.dist.login}">
<fileset dir="${src}">
<include name="log.cfg" />
<include name="banned_ip.cfg" />
<include name="console.cfg" />
</fileset>
</copy>
<copy todir="${build.dist.game}">
<fileset dir="${src}">
<include name="log.cfg" />
<include name="console.cfg" />
</fileset>
</copy>
<copy todir="${build.dist.login}">
<fileset dir="${src}/../lib">
<include name="c3p0-0.9.2-pre1.jar" />
<include name="mysql-connector-java-5.1.18-bin.jar" />
<include name="javolution-5.5.1.jar" />
<include name="mmocore.jar" />
<include name="mchange-commons-0.2.jar" />
</fileset>
</copy>
<copy todir="${build.dist.game}">
<fileset dir="${src}/../lib">
<include name="*.jar" />
</fileset>
</copy>
<copy todir="${build.dist}">
<fileset dir="${basedir}">
<include name="changes.txt" />
<include name="LICENSE.txt" />
<include name="README.txt" />
</fileset>
</copy>
<copy todir="${build.dist}">
<fileset dir="${src}/../lib">
<include name="*LICENSE*" />
</fileset>
</copy>
<copy todir="${build.dist.login}">
<fileset dir="dist">
<include name="startAccountManager.*" />
<include name="startSQLAccountManager.*" />
<include name="LoginServer_loop.sh" />
<include name="startLoginServer.*" />
<include name="RegisterGameServer.*" />
</fileset>
</copy>
<copy todir="${build.dist.game}">
<fileset dir="dist">
<include name="GameServer_loop.sh" />
<include name="startGameServer.*" />
<include name="hibernate.cfg.xml" />
</fileset>
</copy>
<fixcrlf srcdir="${build.dist.game}" eol="lf" eof="remove" includes="**/*.sh">
</fixcrlf>
<fixcrlf srcdir="${build.dist.login}" eol="lf" eof="remove" includes="**/*.sh">
</fixcrlf>
<fixcrlf srcdir="${build.dist.game}" eol="crlf" eof="remove" includes="**/*.bat">
</fixcrlf>
<fixcrlf srcdir="${build.dist.login}" eol="crlf" eof="remove" includes="**/*.bat">
</fixcrlf>
<mkdir dir="${build.dist.game}/log" />
<mkdir dir="${build.dist.login}/log" />
<mkdir dir="${build.dist.game}/hibernate-mapping" />
<mkdir dir="${build.dist.game}/config" />
<mkdir dir="${build.dist.login}/config" />
<copy todir="${build.dist.game}/config">
<fileset dir="java/config">
<include name="*.properties" />
<exclude name="loginserver.properties" />
</fileset>
</copy>
<copy todir="${build.dist.login}/config">
<fileset dir="java/config">
<include name="loginserver.properties" />
<include name="telnet.properties" />
</fileset>
</copy>
<mkdir dir="${build.dist.game}/data" />
<copy todir="${build.dist.game}/data">
<fileset dir="data">
<include name="*.csv" />
<include name="*.txt" />
</fileset>
</copy>
<mkdir dir="${build.dist.game}/data/geodata" />
<copy todir="${build.dist.game}/data/geodata">
<fileset dir="data/geodata">
<include name="*.txt" />
<include name="*.l2j" />
</fileset>
</copy>
<mkdir dir="${build.dist.game}/data/pathnode" />
<copy todir="${build.dist.game}/data/pathnode">
<fileset dir="data/pathnode">
<include name="*.txt" />
<include name="*.pn" />
</fileset>
</copy>
<zip destfile="${build}/L2J_Server.zip" basedir="${build.dist}" />
</target>
<target name="clean" description="Remove the output directories">
<delete dir="${build}" />
</target>
</project>
50-55 行将是:
<target name="compile" depends="init" description="Compile the source.">
<javac destdir="${build.classes}" optimize="on" debug="on" source="1.8" target="1.8" nowarn="off" includeantruntime="false" deprecation="yes">
<src path="${src}" />
<classpath refid="classpath" />
<compilerarg value="-Xlint" />
</javac>
如果我运行另一个(非常相似(build.xml
我得到几乎相同的错误,它会将我定向到不同的行 (89(,因为构建行 88-90 是:
<target name="compile" depends="init" description="Compile the source.">
<javac srcdir="${src}" classpathref="classpath" destdir="${build.classes}" compiler="javac1.8" debug="false" debuglevel="lines,vars,source" includeantruntime="false" source="1.8" target="1.8" />
</target>
我使用的是JDK 1.8.0_171,因为较新的没有工具.jar并且我遇到了无法解决的不同错误(使用此JDK,我能够运行另一个构建(L2j服务器数据包(。
请指教。
以下解决方案对我有用,希望对其他人有所帮助
日食 -> Ant 选项卡 -> 右键单击build.xml
->运行方式 ->外部工具配置... -> JRE 选项卡 ->运行时 JRE: -> 选择"在与工作区相同的JRE中运行" -> 应用并运行