JRE problem

Startbeitrag von Walt Brainerd am 04.02.2006 20:42

I am trying to get JAPI to work with g95 because
the next version of F will be based on g95 and I would
like to include JAPI in the free distribution. I am trying
it first on XP with Cygwin. When I first did a compile and
tried to run, I got

bash-3.00$ ./a
can't connect to server -> starting new kernel
No JRE found ... trying JAVA ...Segmentation fault (core dumped)

I had already installed the Sun JRE and something works
because it is needed by Eclipse/Photran, which works. So I
tried again a day later:

bash-3.00$ g95 filedialog.f90 -L. -ljapi -lwsock32
Info: resolving __impure_ptr by linking to __imp___impure_ptr (auto-import)

???What is this???

bash-3.00$ ./a
Commandsock 3
Actionsock 4
Magic Number = 1234
No Swapping

So now it seems to work (I have no idea what I did different).
I ran it and the debug and file dialog show up. I closed it
with the "X" in the debug dialog. Then I tried again.

bash-3.00$ ./a
can't connect to server -> starting new kernel
No JRE found ... trying JAVA ...Segmentation fault (core dumped)

Hints would be appreciated. Thanks.

BTW, I have a little script that will change japi.f into japi.f95,
a Fortran 95 module suitable for use with any Fortran 95 compiler,
such as g95.


One thing I forgot to mettion that might be important.

C:\jre doesn't do anything. There is no such file.

However, the filedialog program worked at least once!

von Walt Brainerd - am 04.02.2006 20:48
Dear Walt,

I tried JAPI with g95 on MinGW (Win2k) and Linux (SuSE 9.2) without any problems (almost all demo programs ran out of the box).

You mentioned you modified japi.f to use it with g95. AFAIK the japi.f work properly with F77 code only. Futhermore it is not necessary to modify japi.f. In the F distribution of JAPI there is a module, called japi.f90, which you can use for Fortran 9x as well. I downloaded japi.f90 and compiled it with g95 on both platforms and copied it in my module directory. Voila.

You find japi.f90 here:

Unfortunaletly even 'filedialog.f90' has some bugs!! The number of arguments in j_filedialog is wrong. The 'directory' argument is missing in line 32 und 37 and substring ''/S'' in line 37.

Add the missing arguments in these lines, like:

32 CALL j_filedialog(frame,"Open File",".",filename)
37 CALL j_filedialog(frame,"Save File/S",".",filename)

I hope this solves the problems.

Best regards,


von Hani - am 06.02.2006 14:05
Thank you for responding. I learned some things, but I
still have the same problems (with JRE, I think).

Just to clarify some of my points: by "modifying japi.f", I meant that I
converted it to Fortran 95 and compiled it with g95. Your link to that
file already converted for me would have been a little easier!

I want to use Cygwin for several reasons, including the fact that it is
needed to run Photran and other tools with the next F distribution.

I also changed the filedialog program in two places as you suggested.

It would be nice if all of those EXTERNAL statements in japi.f90 were
interface blocks so that errors of that kind could be caught at compile
time. Maybe someday ...

Anyway, I still have problems if anybody has more suggestions.

bash-3.00$ g95 file*.f90 -L. -ljapi -lwsock32
Info: resolving __impure_ptr by linking to __imp___impure_ptr (auto-import)
bash-3.00$ ./a
can't connect to server -> starting new kernel
No JRE found ... trying JAVA ... 13 [main] a 3176 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack)
Segmentation fault (core dumped)

von Walt Brainerd - am 06.02.2006 17:53
Hello Walt,

As you assumed, your problem has to relate to your Java installation and maybe with the interconnection of Java and Japi IMHO. Since I haven't used Cygwin so far, I can't reproduce your problem and therefore I can't help you in this issue.

But in your reply I noticed that you invoked Japi with 'wsock32'. IMHO this is not necessary and maybe this could cause that strange behavior. The wsock32-library has to be used for the MinGW distribution. To use the correct library is another issue. In your case (g95, Cygwin) I would use:

- g77(Cygwin) Japi distribution

- japi.f90

- Build the module japi.mod (g95 -c japi.f90)
- Build yout program, e.g.
g95 -o myprog.exe myprog.f90 -ljapi
(without -lwsock32, as described on the download page of g77/cygwin)

Anyway. Good luck Walt.

Best regards,


von Hani - am 07.02.2006 17:14
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.