aspose file tools
The moose likes Java in General and the fly likes JBuilder versus command line output (char array) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "JBuilder versus command line output (char array)" Watch "JBuilder versus command line output (char array)" New topic
Author

JBuilder versus command line output (char array)

Juan Tanamera
Greenhorn

Joined: May 05, 2005
Posts: 4
Hi,

I am trying to understand why code runs differently in JBuilder 1.4 (jdk 1.3.0) as opposed to from the command line using the same jdk, when running the following code:

char ar = {'a', 'b'}
//JBuilder
System.out.println("an"+ar); // output an[C@3fbdb0
System.out.println("an"+ar+"an"); // anaban

//Command line
System.out.println("an"+ar); // an[C@3fbdb0
System.out.println("an"+ar+"an"); // an[C@3fbdb0an

Any ideas?

Thanks,
Juan
Frank Ertl
Ranch Hand

Joined: Apr 25, 2005
Posts: 59
Are you sure that you don't use the Borland make to compile when you try your code with JBuilder? I had a similar problem and found out that the compiler of the Borland make-tool works a little bit different from the commandline javac. Even if the same jdk is used.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24041
    
  13

If that's really the output you get when you run under JBuilder, then the explanation is that, once again, JBuilder is wrong, dead wrong. Their compiler is simply generating incorrect code.


[Jess in Action][AskingGoodQuestions]
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
in fact, it shouldn't even compile...

And of course there is no "JBuilder 1.4"...

When correcting the code to JBuilder 2005 will output...

an[C@10b62c9
an[C@10b62c9an


as expected.


42
Juan Tanamera
Greenhorn

Joined: May 05, 2005
Posts: 4
Sorry for my mistake... The array was declared correctly and it was JBuilder 4, not 1.4, but it does produce the output I showed within JBuilder but different output from the command line

Within JBuilder the message window shows C:\JBuilder4\jdk1.3\bin\javaw
From the command line I use c:\JBuilder4\jdk1.3\bin\java to run the program

Yes, I am using JBuilder's own Make (button) and javac from the command line

Following this up now I see that JBuilder's compiler is called bcj and that if I compile the code from the command line using bcj and run using java I get the same behaviour from the command line as I saw in JBuilder, so it does seem to be compiler related.

Does this make JBuilder's compiler wrong?

Juan

[ May 23, 2005: Message edited by: Juan Tanamera ]
[ May 23, 2005: Message edited by: Juan Tanamera ]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JBuilder versus command line output (char array)
 
Similar Threads
Problem with SimpleDateFormat (CommandLine vs WebApp)
silly one
prog of multiple inputs
char variable
Thread.sleep alters the output!