aspose file tools*
The moose likes Beginning Java and the fly likes Trouble compiling simple website crawler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Trouble compiling simple website crawler" Watch "Trouble compiling simple website crawler" New topic
Author

Trouble compiling simple website crawler

Frank Metzger
Greenhorn

Joined: Aug 04, 2011
Posts: 6
I am trying to get this simple webcrawler to work. I think it prints the HTML source line by line. Currently, it doesn't print any of the statements. I hope you can help.

Here is the code:


I get pre-compile errors for the following statements: import java.io.BufferedReader; "Incorrect Package" and package grabHTML; "class, interface or enum expected"

I get the following errors after compiling:
java.lang.NoClassDefFoundError: grabhtml/GrabHTML
Caused by: java.lang.ClassNotFoundException: grabhtml.GrabHTML
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: grabhtml.GrabHTML. Program will exit.
Exception in thread "main" Java Result: 1






Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

The package statement needs to be before any import statements


Junilu - [How to Ask Questions] [How to Answer Questions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Trouble compiling simple website crawler
 
Similar Threads
Gives me error when included in the same folder but works when outside folder
File path issues while reading an xsl file in java
Exception in thread "main" java.lang.NoClassDefFoundError: kolos/Main
NoClassDefFoundError: wrong name
FileNotFoundException