This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libgcj.spec


Thanks Tom.That helped.

I have one more question.I am trying to run a very simple program(a minor
modification to the hello world that is there on the GCJ web site) to see
how strings are passed between C++ and Java and am having problems.

I am attaching my files with this mail.

It would be great if I can get some help as I have no clue what is going
wrong.

Thanks in advance
Rajesh






Tom Tromey wrote:

> >>>>> "Rajesh" == Rajesh Kadikar <rajeshk@nortelnetworks.com> writes:
>
> Rajesh> I am trying to compile and install gcc(I tried almost all the
> Rajesh> versions starting form 2.95.1 up).Everything goes fine except
> Rajesh> when I try to execute gcj it complains about libgcj.spec and I
> Rajesh> don't have this library anywhere in my directories.Can anyone
> Rajesh> help.
>
> For gcc 2.95.1, you had to get libgcj separately and build and install
> it using the same --prefix that you used for gcc.  Did you do this?
> libgcj.spec comes with libgcj.
>
> If you tried one of the gcc 3.0 snapshots then I'd be suprised.
>
> Tom
public class sample {

  public void getString() {
  }

  public String javaString;

  public sample(){
  javaString = new String("Java String");
  }

  public void setString(String s){
  javaString = s;
  } 

}
#include <gcj/cni.h>
#include "sample.h"
#include <stream.h>
#include <java/io/PrintStream.h>
#include <java/lang/System.h>
#include <java/lang/String.h>

int main()
{
 ::sample *sam = new ::sample();

 char *cstring = (char *) JvGetStringChars(sam->javaString); 

 // The problem is that when I try to print the cstring it only gives me the first character .
 cout<<"Initial String in sample is "<<cstring<<endl;

}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]