简体   繁体   English

在Ubuntu 13.10和OpenJDK上使用Ant

[英]Using Ant on Ubuntu 13.10 with OpenJDK

So, I'm trying really hard to get Thinking In Java source code to work on Ubuntu 13.10 with OpenJDK, but I've run into a problem I've not been able to solve. 因此,我非常努力地使《 Thinking In Java》源代码能够在具有OpenJDK的Ubuntu 13.10上运行,但是遇到了一个我无法解决的问题。 So, I followed all the steps shown here: 因此,我遵循了此处显示的所有步骤:

http://www.mindviewinc.com/TIJ4/CodeInstructions.html http://www.mindviewinc.com/TIJ4/CodeInstructions.html

But when I try to compile everything using ant, when I type in the terminal ant build I get the following: 但是,当我尝试使用ant编译所有内容时,当我输入终端ant build ,会得到以下信息:

Buildfile: /home/juan/Documents/TIJ4-code/build.xml

build:

BUILD FAILED
/home/juan/Documents/TIJ4-code/build.xml:59: J2SE5 required

So first I reset my environment variables to make sure they were pointing at my JDK, by typing: 所以首先我通过键入以下内容来重置我的环境变量,以确保它们指向我的JDK:

$ export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
$ export PATH=$PATH:$JAVA_HOME/bin

Tried again, so luck. 再试一次,好运。 So I decided to check what the line causing the problem (59 in build.xml) which read <fail message="J2SE5 required" unless="version1.5"/> . 因此,我决定检查导致该问题的行(build.xml中的59)读取<fail message="J2SE5 required" unless="version1.5"/> Running java -version returns the following: 运行java -version将返回以下内容:

java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

So, I replaced the xml line with <fail message="J2SE5 rEEEEquired" unless="version1.7.0_51"/> and got the exact same thing after running ant build , except for the text I changed: 因此,我用<fail message="J2SE5 rEEEEquired" unless="version1.7.0_51"/>替换xml行, <fail message="J2SE5 rEEEEquired" unless="version1.7.0_51"/>并在运行ant build之后得到了完全一样的东西,除了我更改的文本:

Buildfile: /home/juan/Documents/TIJ4-code/build.xml

build:

BUILD FAILED
/home/juan/Documents/TIJ4-code/build.xml:59: J2SE5 rEEEEquired

I tried with 1.7.0, 1.7, with no luck. 我尝试了1.7.0、1.7,没有运气。 I even tried deleting the line but I get this: 我什至尝试删除该行,但是我得到了:

Buildfile: /home/juan/Documents/TIJ4-code/build.xml

build:

build:

BUILD FAILED
/home/juan/Documents/TIJ4-code/build.xml:60: The following error occurred while executing this line:
/home/juan/Documents/TIJ4-code/object/build.xml:29: J2SE5 required

So yeah. 是的。 I really don't want to install Oracle's JDK because it seems too much of a hassle and I'm not even sure it would work. 我真的不想安装Oracle的JDK,因为这似乎太麻烦了,我甚至不确定它是否可以工作。 I'm fairly new to java and ant and even linux so this stuff really puzzles me. 我对java和ant甚至Linux还是很陌生,所以这些东西真的使我感到困惑。 I can compile files alright and everything works as expected with the JDK, it's ant and that line that's giving me problems. 我可以编译文件,并且一切都可以像预期的那样与JDK一起使用,它是ant,这行给我带来了问题。 Thanks in advance, any help is appreciated. 在此先感谢您的帮助。

You are almost there! 你快到了! You also need to delete line 29 in: 您还需要删除以下内容中的第29行:

/home/juan/Documents/TIJ4-code/object/build.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM