2

I'm trying to run a .jar that runs fine on my own computer but gives the following exception on someone else's.

Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Character.isAlphabetic(I)Z
    at chatai.Word.shrinkEndPunct(Word.java:91)
    at chatai.Word.createWord(Word.java:36)
    at chatai.ChatAI.addSentence(ChatAI.java:54)
    at shared.Initializer.main(Initializer.java:130)

I have never seen the (I)Z part before, does anyone know what this means? I already tried updating Java.

2 Answers 2

7

I have never seen the (I)Z part before, does anyone know what this means?

The (I)Z part describes the argument and return type part of the method signature.

In this case it says that the method takes as argument an int, and returns a boolean.

Here's the complete list of such type notation:

V           void
Z           boolean
C           char
B           byte
S           short
I           int
F           float
J           long
D           double

L<class>;   Reference type, for example Ljava/lang/String;

It's hard to tell why the program runs fine on your computer. There is no method called isAlphabetic in the standard Java API.

The Character.isAlphabetic method was introduced in Java 7. It seems like you're running Java 7, and your friend has only Java 6 (or some lower version) installed.

Sign up to request clarification or add additional context in comments.

3 Comments

Looks like a new method in Java 7. download.oracle.com/javase/7/docs/api/java/lang/…
@Mathew, ah, thanks. You taught me something today ;-) Answer updated.
Oh, thank you so much. I could have sworn that method was always there.
0

User aioobe gave a nice explanation how to interpret this error message. It seems the referenced method was only introduced in java7.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.