Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » FORTRAN Program runs fine but java NullPointerException on debug(A LARGE Fortran code has been imported into eclipse. It runs fine, but gives a java NullPointerException on attempting to debug. This seems related to linked resources.)
FORTRAN Program runs fine but java NullPointerException on debug [message #1198998] Wed, 20 November 2013 16:26 Go to next message
James Furness is currently offline James FurnessFriend
Messages: 6
Registered: November 2013
Junior Member
Unable to post links so sorry for the poor formatting...

I have a question running on stack exchange regarding this, but so far there is little progress. The contents of this is below. I thought asking here might be wise.

I encounter the a problem as can be seen in the attached screenshot when I try to debug 'dalton.x'. We use Cmake to generate the Makefile and, following instructions, I imported this to eclipse using

cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ./


It seems to have imported fine, I can build the project within Eclipse and I can run dalton.x fine, again within Eclipse, but debugging throws the exception.

Following the advice on stack exchange it seems this is similar to https://bugs.eclipse.org/bugs/show_bug.cgi?id=288106.

So I have been trying to avoid using virtual folders in this project, to achieve this I followed a thread and switched the flag CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES to false within cmake. I have remade the eclipse project using the above cmake command (after rm the original .project and .cproject files.

This has changed the Eclipse view such that the exclamation mark in triangle in the bottom left of the project icon is now gone, but it did not solve the problem. I still have the NPE upon starting a debug build.

Any ideas on how to solve, or work around this problem?

Many thanks.


STACK EXCHANGE
--------------------------------------

I have begun working on a code (the DALTON quantum chemistry code) that is millions of lines of FORTRAN in size. I would like to debug this through Eclipse so have been working on getting it setup within the IDE.

All is running fine, the code seems to be imported correctly and Eclipse will build it fine (with debug settings) through the makefile that Cmake produces for it. The program will also run fine within Eclipse printing the expected results to the console. However when I come to try debugging it I am presented with a java.lang.NullPointerException error that I am at a loss on how to solve.

Some clue to things not being right can be seen in the project explorer. Eclipse does not seem to handle the "dalton.exe" executable in the same way it handles the executable produced by making (same compiler, gfortran) a simple helloworld program I made to test that Eclipse was debugging Fortran files as expected. It appears to be treating the executable as a text file.

I am unable to post images directly as a new user so I will have to provide a link to a hosted version. (I will loiter and answer any questions I find I can to change this Smile )

Any help is greatly appreciated.

SCREENSHOT : [NO LINKS ATTACHED INSTEAD]

EDIT:

I have looked at the .metadata/.log for the workspace, I can't make much of the errors I'm afraid. It logs the following:

!SESSION 2013-11-20 13:46:52.774 -----------------------------------------------
eclipse.buildId=4.3.0.M20130911-1000
java.version=1.7.0_45
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments: -product org.eclipse.epp.package.parallel.product
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.parallel.product

!ENTRY org.eclipse.core.net 1 0 2013-11-20 13:47:30.190
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences

!ENTRY org.eclipse.debug.ui 4 0 2013-11-20 13:48:54.496
!MESSAGE Tab group extension: org.eclipse.cdt.launch.applicationProfileLaunchTabGroup for type org.eclipse.cdt.launch.applicationLaunchType for the [profile] mode has been replaced by extension: org.eclipse.cdt.launch.applicationProfileLaunchTabGroup

!ENTRY org.eclipse.core.jobs 4 2 2013-11-20 13:49:02.238
!MESSAGE An internal error occurred during: "Launching DALTON-Debug_build Configuration".
!STACK 0
java.lang.NullPointerException
at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1889)
at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1910)
at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1910)
at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.setSourceLookupPath(CDebugTarget.java:1863)
at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.initializeSourceLookupPath(CDebugTarget.java:385)
at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.initialize(CDebugTarget.java:286)
at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.<init>(CDebugTarget.java:279)
at org.eclipse.cdt.debug.core.CDIDebugModel$1.run(CDIDebugModel.java:127)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327)
at org.eclipse.cdt.debug.core.CDIDebugModel.newDebugTarget(CDIDebugModel.java:132)
at org.eclipse.cdt.launch.internal.LocalCDILaunchDelegate.launchLocalDebugSession(LocalCDILaunchDelegate.java:162)
at org.eclipse.cdt.launch.internal.LocalCDILaunchDelegate.launchDebugger(LocalCDILaunchDelegate.java:113)
at org.eclipse.cdt.launch.internal.LocalCDILaunchDelegate.launch(LocalCDILaunchDelegate.java:74)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

END STACK EXCHANGE
---------------------------------------------------------


Re: FORTRAN Program runs fine but java NullPointerException on debug [message #1201153 is a reply to message #1198998] Thu, 21 November 2013 16:00 Go to previous messageGo to next message
Martin Heymann is currently offline Martin HeymannFriend
Messages: 2
Registered: November 2013
Junior Member
I can confirm this Problem. It even occurs when I try to import the simple exampe1 from http:##www.findthatzip-file.com/search-45227331-hZIP/winrar-winzip-download-cmake-examples-tgz.htm, but only on my Windows7 system. On Ubuntu everything works fine.

Used versions:

  • Eclipse 4.3.1
  • cmake 2.8.11.2
  • gfortran: 4.8.1 on linux and 4.8.2 on win7
  • gdb: 7.6.1-ubuntu and 7.6.50-cygwin




I tried the Eclipse import as following:
cmake -G"Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION="4.3.1" -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_BUILD_TYPE=Debug ../fortran
or 
cmake -G"Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION="4.3.1" -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES=FALSE -DCMAKE_BUILD_TYPE=Debug ../fortran
/


Both commands are bringing a java NullPointerException on debug. But only on the Win7 installation.

I really would be glad for a solution for this. Thanks!
Re: FORTRAN Program runs fine but java NullPointerException on debug [message #1201205 is a reply to message #1201153] Thu, 21 November 2013 16:30 Go to previous messageGo to next message
James Furness is currently offline James FurnessFriend
Messages: 6
Registered: November 2013
Junior Member
No Message Body
Re: FORTRAN Program runs fine but java NullPointerException on debug [message #1201223 is a reply to message #1201205] Thu, 21 November 2013 16:37 Go to previous messageGo to next message
James Furness is currently offline James FurnessFriend
Messages: 6
Registered: November 2013
Junior Member
I'd like to add some additional information about my setup:

OS: OSX Mavericks
java: 1.7.0_45
eclipse.buildId= 4.3.0.M20130911-1000
gfortran: 4.6.2
gcc: 4.6.2
GDB: 7.6

Re: FORTRAN Program runs fine but java NullPointerException on debug [message #1203083 is a reply to message #1201223] Fri, 22 November 2013 13:16 Go to previous messageGo to next message
James Furness is currently offline James FurnessFriend
Messages: 6
Registered: November 2013
Junior Member
I have made some progress:

I am now launching eclipse with sudo. I switched to the Debug window, and to the Executables tab in the console. There I right clicked in the table and imported dalton.x as an executable. It is of note that the source code was found successfully and the executable imported fine.

Running a debug build with this presents a new error:
Failed to set program arguments, environment or working directory.
Unable to set working directory: "/Users/james/QC_Codes/Dalton/build": No such file or directory.
Unable to set working directory: "/Users/james/QC_Codes/Dalton/build": No such file or directory.
Unable to set working directory: "/Users/james/QC_Codes/Dalton/build": No such file or directory.

I have double checked. These directories exist and should be accessible.

Again any advice is greatly appreciated.

I experiment onwards...
Re: FORTRAN Program runs fine but java NullPointerException on debug [message #1203158 is a reply to message #1203083] Fri, 22 November 2013 14:07 Go to previous messageGo to next message
Martin Heymann is currently offline Martin HeymannFriend
Messages: 2
Registered: November 2013
Junior Member
I found a workaround! It is related to the bug with the linked resources you mentioned above.

Creating my eclipse project with

cmake -G"Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION="4.3.1" -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_BUILD_TYPE=Debug ../fortran

or 

cmake -G"Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION="4.3.1" -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES=FALSE -DCMAKE_BUILD_TYPE=Debug ../fortran


gives the following in the .project file of the build directory. In the second case only the .project file in the source dir is without links. Both options are bringing a NullPointerException on debug.

<linkedResources>
	<link>
		<name>[Source directory]</name>
		<type>2</type>
		<location>E:/TRNSYS/cmake_examples/example1/fortran</location>
	</link>
	<link>
		<name>[Targets]</name>
		<type>2</type>
		<locationURI>virtual:/virtual</locationURI>
	</link>
	<link>
		<name>[Targets]/[exe] count_fortran</name>
		<type>2</type>
		<locationURI>virtual:/virtual</locationURI>
	</link>
</linkedResources>


To get things working I removed the last two <link>-tags from the .projekt file of the build drectory in the text editor:

<linkedResources>
	<link>
		<name>[Source directory]</name>
		<type>2</type>
		<location>E:/TRNSYS/cmake_examples/example1/fortran</location>
	</link>
</linkedResources>


Debugging now is possbile without errors! Does anybody have a better solution then the manual removing?

I think not the linkedResources in generall, but the virtual folders are the problem. It is possible just to delete this virtual folders in eclipse and debugging will be possible.

[Updated on: Fri, 22 November 2013 15:17]

Report message to a moderator

Re: FORTRAN Program runs fine but java NullPointerException on debug [message #1203403 is a reply to message #1203158] Fri, 22 November 2013 16:43 Go to previous messageGo to next message
James Furness is currently offline James FurnessFriend
Messages: 6
Registered: November 2013
Junior Member
Excellent, thanks for the update Martin. I'm glad you have got it working. I have followed your solution and removed all from the linked resources section and added a link to source directory pointing to my source folder.

The error persists for me sadly but there is some progress.

I still get the NPE error, though switching to the debug perspective shows a running debug process that will run fine. My problem comes with setting break points and stepping. Whenever The code crosses a break point it does not halt, but instead I am confronted with:

An internal error occurred during: "Label Job".
java.lang.NullPointerException

one for each break point and the code does not stop.

Any clues on this new error.
Re: FORTRAN Program runs fine but java NullPointerException on debug [message #1702671 is a reply to message #1203403] Fri, 24 July 2015 03:40 Go to previous message
Holger Wolff is currently offline Holger WolffFriend
Messages: 1
Registered: July 2015
Junior Member
Hey James

I had the same problem when I switched from the standard Mac gdb to one from Macports:
gdb complained about being "Unable to set working directory", because it claimed there was "No such file or directory" when clearly was rught there.

The problem went away when I changed the GDB command set from "Standard (MacOS)" to "Standard".

I found it in Properties for <Project> -> Run/Debug Settings -> (select launch configuration) -> edit -> Debugger

Just in case you or someone else still has the same problem.

Cheers
Previous Topic:HelloWorld/src
Next Topic:Please help with J2EE
Goto Forum:
  


Current Time: Thu Apr 25 11:01:54 GMT 2024

Powered by FUDForum. Page generated in 0.11101 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top