This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble compiling simple website crawler

 
Frank Metzger
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 7319
45
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The package statement needs to be before any import statements
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic