aspose file tools*
The moose likes Beginning Java and the fly likes Mystery error: probably an Eclipse project configuration issue. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Mystery error: probably an Eclipse project configuration issue." Watch "Mystery error: probably an Eclipse project configuration issue." New topic
Author

Mystery error: probably an Eclipse project configuration issue.

Jonathan Sachs
Greenhorn

Joined: May 21, 2013
Posts: 15
Background: I have a lot of experience with Java but I haven't used it for about ten years. I'm just learning to use Eclipse. I'm using Eclipse 4.2.2 with JRE 7.

My first project contains four source files, all in the default package. I've fixed all of the compile time warnings and errors. I'm now trying to debug it.

I'm getting a run-time error when I step into the program's first executable statement (constructing an instance of the "do everything" class in main). Here is the entire relevant source file:

   public class Main {

   public static void main( String[] args ) {
      Wsdl2html wsdl2html = new Wsdl2html();
      wsdl2html.exec(args);
   }

}

The debugger lists about a dozen nested errors. The first one is "Launcher $AppClassLoader(ClassLoader).loadClass(String) line: not available." I interpret this to mean that the RTS can't find the Wsdl2html class, even though the compiler finds it and knows that the call to the constructor is correct. (I can prove this by adding an argument to the call, which makes the compiler issue a "The constructor is undefined" error, then removing it again, which makes the error go away.)

At this point the Eclipse project architecture is so complex that it bewilders me, and I don't know how to even think about what's wrong. Can anyone make a suggestion?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Just because the compiler can find class files, that doesn't mean that the java files are available. And without the Java source files to debug into, there isn't any code for Eclipse to show in debug mode. Check if Wsdl2html.java is available. If so, what is the path/jar? The instructions for how to tell Eclipse about it vary based on your answer.

Also, you should get in the habit of not using the default package. It will cause you troubles at some point.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jonathan Sachs
Greenhorn

Joined: May 21, 2013
Posts: 15
I'm trying to understand your question but I'm not having success. What do you mean by "available"? The source for Wsdl2html is in the same directory as Main. From my naive (about Eclipse) perspective, that's as available as it can get.

I think the "not available" message refers to the source code for the JRE class that was called when the error happened. (I know that class's source is not available, because I haven't installed the JRE source.) But I might be wrong about that.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Oh, so Wsdl2html is a class you wrote (or copied from somewhere and put in the directory. I thought it was a third party library.
Jonathan Sachs
Greenhorn

Joined: May 21, 2013
Posts: 15
That's correct. (There are four classes in this project, counting Main, and I wrote all of them.)

Can you help me understand the cause of the difficulty I'm having?
Maxim Karvonen
Ranch Hand

Joined: Jun 14, 2013
Posts: 103
    
  11
It's not a bug. It's a feature. And "line: not available" in not an error, it is perhaps just an information in a call stack window.

JVM performs following steps during a first (and only) code execution:
1. Load target class (Wsdl2html) because it is not loaded yet.
2. Invoke a constructor.

Eclipse likes to step into some internal stuff like classloaders, etc... And it provides it's own classloader for launchers. So, you ends up somewhere in an infrastructure code instead of your class. Try to continue program from a debugger. It should run correctly (at least, it should invoke a constructor). You may perform several "step return" actions untill execution is in a required stack frame and then perform "step into" action. You should be in a constructor code at this point. Also you may use step filters (Preferences > Java > Debug > Step filters) to skip such infrastructure calls automatically.
Jonathan Sachs
Greenhorn

Joined: May 21, 2013
Posts: 15
I revisited the problem. It occurred to me that I might learn more (!) by running the program without the debugger. And indeed I did. The program went right through the constructor, called the exec method, and died a few lines into that for reasons that were entirely understandable.

I then tried the debugger again, and the original problem did not recur. I'm now neck deep in debugging.

Thanks to everyone for trying to help me solve this problem. I don't think I'll ever know what went wrong, but the problem went away, and I can't ask for more than that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mystery error: probably an Eclipse project configuration issue.