Error while Debugging

publicstaticvoid main(String[] args)throws java.io.FileNotFoundException,

java.io.IOException,

java.lang.InterruptedException{

fileName =new String(args[args.length-1]);

// set up the parser and scanner with the appropriate file

// name

FileReader aslFile =new FileReader(fileName);

NolifeScanner scanner =new NolifeScanner(aslFile);

NolifeParser parser =new NolifeParser(scanner);

hi all,

I am debugging a java program in Eclipse 3.2.1 in debug perspective.

When I'm just running the program it's fine. But when I'm launching the debugger, and trying to step into the NoLifeParser() it stops and shows me the error message like this:

ClassLoader.class

Source not found

The source attachment does not contain the source for the ClassLoader.class

You can change the source attachment by clicking Change Attached Source below:

BUTTON

and then the source code for ClassLoader class.

Please help, I'm struggling =(

Thanks in advance,....!!

[1420 byte] By [Sandesha] at [2007-11-26 18:38:07]
# 1
looking at the piece of code that you have given, it is not clear.It would be nice if you could give the full code if it is not confidential
SHLa at 2007-7-9 6:12:12 > top of Java-index,Core,Monitoring & Management...
# 2

package frontend;

import java.io.FileReader;

import frontend.ast.*;

import frontend.parser.*;

/**

* This class contains the main routine for the Nolife compiler. It

* the scanner and parser and then processes the input file.

*/

public class Nolife {

public static String fileName=null ; // the name of the input file

public static boolean generateInterpreterCode = false;

/**

* @return the input file name

*/

static String getFileName() {

return fileName;

}

/**

* The main routine for compiling and Nolife program

*

* @param args the command-line arguments

*/

/**

* @param args

* @throws java.io.FileNotFoundException

* @throws java.io.IOException

* @throws java.lang.InterruptedException

*/

public static void main(String[] args) throws java.io.FileNotFoundException,

java.io.IOException,

java.lang.InterruptedException {

fileName = new String(args[args.length-1]);

// set up the parser and scanner with the appropriate file

// name

FileReader aslFile = new FileReader(fileName);

NolifeScanner scanner = new NolifeScanner(aslFile);

NolifeParser parser = new NolifeParser(scanner);

boolean error = false;

//

// parse the input file and return the intermediate

//

ProgramNode prog = null;

try {

prog = parser.program();

}

catch (antlr.SemanticException e) {

System.err.println("Semantic Error: " + e);

error = true;

}

catch (antlr.RecognitionException e) {

System.err.println("Syntax Error: " + e);

error = true;

}

catch (antlr.TokenStreamException e) {

System.err.println("Syntax Error: " + e);

error = true;

}

if (error) {

System.exit( -1);

}

AbstractSyntaxTree ast = new AbstractSyntaxTree(prog);

ast.typeCheck();

if (AbstractSyntaxTree.error)

System.exit(-1);

}

}

Sandesha at 2007-7-9 6:12:12 > top of Java-index,Core,Monitoring & Management...
# 3

About the ClassLoader

The class ClassLoader is in the package "java.lang.Object" .

This class loader is an object that is responsible for loading classes. Given the name of a class, it should attempt to locate or generate data that constitutes a definition for the class. A typical strategy is to transform the name into a file name and then read a "class file" of that name from a file system.

Why the Message?

When you are debugging the program, the source for these API's are not attached.If you want to attach, then when the error occured saying "Source not foundThe source attachment does not ...." click the button . and in that you have button called external files ( i think it is the second button ). Click that and go to the directory where your JDK has been installed in your PC ( Normally in the path C:\Program Files\Java\jdk<version>"). And there you will find "src.zip" .Do Select that .

This i think will remove the message you are getting when your debuging.

Conclusion

Even if you did the above procedures, it will not allow you to debug the "ClassLoader" file. So I don't understand why do you want to see the ClassLoader file. :-))

VISHAL

SHLa at 2007-7-9 6:12:12 > top of Java-index,Core,Monitoring & Management...
# 4

Hey thanks for the help....

I did not wanted to step into class loader but it is was automatically displaying the message when i clicked step into on NolifeParser.

But I figured out to avoid that message ....

If anyone wants to step through his or her own code excluding the system class files code then they can set the filter by selecting the main thread in debug mode (top left console) and right clicking and then edit step filters......

then select use step filter option and then select all the packages .....

then click apply ....

that way u can just step through ur own code and not stepping into system's code.....

thanks :)

sandesh

Sandesha at 2007-7-9 6:12:12 > top of Java-index,Core,Monitoring & Management...