The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by adam]

Hi, i just recently bought your book Instant messagaing in Java and am trying
to work through chapter 3 in the book, but i get alot of errors when i try to
build the code using ant and the build file. I have used java a bit before but
it has been awhile so i think i may be forgetting to do something in the build
process, like maybe setting some kind of environment variable or something
like that. Anyways, here is the output i get:


E:J2SDK1~1.1_0BINJABBERCHP3>ant
Buildfile: build.xml

compile:
[javac] Compiling 27 source files to E:J2SDK1~1.1_0BINJABBERCHP3classes
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:1:
'class' or 'interface' expected

[javac] <head>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:4:
'class' or 'interface' expected

[javac] <PRE>package com.metamech.jabber;</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:6:
'class' or 'interface' expected

[javac] import java.net.Socket;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:7:
'class' or 'interface' expected

[javac] import java.util.LinkedList;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:8:
'class' or 'interface' expected

[javac] import java.util.ListIterator;</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:8:
'class' or 'interface' expected

[javac] import java.util.ListIterator;</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:9:
'class' or 'interface' expected

[javac] <PRE>import com.metamech.io.*;</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:22:
illegal start of type
[javac] public class Session{</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:25:
<identifier> expected
[javac] <PRE> int priority;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:27:
illegal start of type
[javac] public void setPriority(int level) { priority = level; }</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:28:
<identifier> expected
[javac] <PRE> Presence presence = new Presence();
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:29:
illegal start of type
[javac] public Presence getPresence(){return presence;}</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:30:
<identifier> expected
[javac] <PRE> JabberID jid;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:32:
illegal start of type
[javac] public void setJID(JabberID newID) { jid = newID; }</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:33:
<identifier> expected
[javac] <PRE> String sid;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:35:
illegal start of type
[javac] public void setStreamID(String streamID) { sid = streamID;
}</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:36:
<identifier> expected
[javac] <PRE> Socket sock;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:43:
illegal start of type
[javac] }</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:44:
<identifier> expected
[javac] <PRE> LinkedList statusListeners = new LinkedList();
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:50:
illegal start of type
[javac] }</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:51:
<identifier> expected
[javac] <PRE> public static final int DISCONNECTED = 1;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:54:
illegal start of type
[javac] public static final int AUTHENTICATED = 4;</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:55:
<identifier> expected
[javac] <PRE> int status;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:56:
illegal start of type
[javac] public int getStatus() { return status; }</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:74:
<identifier> expected
[javac] <PRE> Writer out;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:80:
illegal start of type
[javac] }</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:81:
<identifier> expected
[javac] <PRE> Reader in;
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:87:
illegal start of type
[javac] }</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:91:
<identifier> expected
[javac] }
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:92:
'class' or 'interface' expecte
d
[javac] }</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java:22:
duplicate class: Session
[javac] public class Session{</PRE>
[javac] ^
[javac]
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberxmlPacket.java:14:
cannot access com.metamech.
jabber.Session
[javac] bad class file:
E:J2SDK1~1.1_0BINJABBERCHP3srccommetamechjabberSession.java
[javac] file does not contain class com.metamech.jabber.Session
[javac] Please remove or make sure it appears in the correct subdirectory
of the classpath.
[javac] import com.metamech.jabber.Session;
[javac] ^
[javac] 32 errors

BUILD FAILED
file:E:/J2SDK1~1.1_0/BIN/JABBER/CHP3/build.xml:34: Compile failed; see the
compiler error output for details.

Total time: 6 seconds
import-bot (20211) [Avatar] Offline
#2
Re: Errors when trying to build chp3 code
[Originally posted by iain.shigeoka]

Hi,

Looks like the forum corrupted your stack trace. Could you email it to me
(iain dot shigeoka at messaginglogic dot com)?

Thanks.

-iain
import-bot (20211) [Avatar] Offline
#3
Re: Errors when trying to build chp3 code
[Originally posted by adam]

Hey Iain, did you get my email with the error output in it?
import-bot (20211) [Avatar] Offline
#4
Re: Errors when trying to build chp3 code
[Originally posted by iain.shigeoka]

Yeah, I sent you a reply Jan 4. I can resend it if you didn't get it (send me
another email to keep the forums free).

-iain