|
|
От: |
Волк-Призрак
|
http://ghostwolf.newmail.ru |
| Дата: | 18.12.04 07:57 | ||
| Оценка: | |||
по поводуI suspect it is a JBuilder — java 1.5 compatibility issue. I created a simple java bean using JBuilder6 and the 1.5 SDK. When I try to run the packager for the ActiveX bean bridge, I get a
"java.lang.VerifyError Incompatible object argument for function call".
I wonder if the problem lies in the new AutoBoxing/UnBoxing feature. I am suspicious since I always get this error when trying to run the packager if I have this line somewhere in my code:
System.out.println("text" + Integer.toString(1) + "text");
However, this is OK:
System.out.println("text" + Integer.toString(1));
And this is OK:
System.out.println(Integer.toString(1) + "text");
And then I tried compiling the bean using the NetBeans IDE, then running the packager, and everythng worked fine!
иYour program
public class Tester {
public Tester() {
String ONE = "abc";
String TWO = "def";
System.out.println(ONE + " " + TWO);
}
public static void main(String[] args) {
Tester tester1 = new Tester();
}
}
runs fine for me on Debian GNU/Linux
|> javac Tester.java
|> java Tester
abc def
|> java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
|>
Такие вот пироги. Правда поиск в гугле вёлся по поводу "using jdk 1.5.0 with jbuilder7" и "another compiler with jbuilder7".It's been a month and a half since I used the -noverify option in the VM parameters to get by this error and I ran into it again in a different project. So after some time I narrowed the problem down into a very simple program, and I found a way around it. Here is the program with the error:
public class Tester {
public Tester() {
String ONE = "abc";
String TWO = "def";
System.out.println(ONE + " " + TWO);
}
public static void main(String[] args) {
Tester tester1 = new Tester();
}
}
This code generates the java.lang.VerifyError at runtime. Now, instead of using the "+" operator inside the catch block, break it up into separate print statements as follows:
public class Tester {
public Tester() {
String ONE = "abc";
String TWO = "def";
System.out.print(ONE);
System.out.print(" ");
System.out.println(TWO);
}
public static void main(String[] args) {
Tester tester1 = new Tester();
}
}
The error disappears (at least it did for me). Interestingly, the first class runs fine if you exclude the " " literal. The class also runs fine if you include the " " literal, but exclude either the ONE or TWO variable. But again, the error only occurs when you include all three in the same println() statement using the "+" operator. I have no idea why. Does anyone know?