Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Why won't the program run?

 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know it's something simple and I'll kick myself but...

I have a folder located here: D:\program\

Within that folder are 4 txt files: combined, domain, test, url

1 java file: proxy.java

1 class file: proxy.class


For whatever reason the program won't run and the error is: Exception in thread "main" java.lang.NoClassDefFoundError: proxy

Yet as you can see the proxy.class file is there. I've tried java D:\program\proxy as well as adding the extention too. Oh and I've tried running the program from the folder as well. I have not tried running it from where java is located on my machine. If it will help I've pasted the code below:

 
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Reader,
Well, I guess you should check your CLASSPATH environment variable. It MUST include atleast this


.;



Apart from that it may include other information.

Yet, I suggest that you try this first:



Give that command from within the program folder.

[ May 09, 2006: Message edited by: Shyam Prasad Murarka ]
[ May 09, 2006: Message edited by: Shyam Prasad Murarka ]
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've set the environment variable CLASSPATH, but you haven't set it to include "." (dot), representing the current directory.

Either add "." to your CLASSPATH, or (my personal recommendation) unset this environment variable altogether. The best setting for people new to Java is no setting at all -- the default would have worked fine for you here.

Note that CLASSPATH and PATH are distinct and unrelated. PATH is used by the OS to find programs to run (like java.exe). CLASSPATH is used by Java to find *.class files to run. The OS knows nothing about CLASSPATH, and Java knows nothing about PATH.
 
Matt Kidd
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shyam Prasad Murarka:
Dear Reader,
Well, I guess you should check your CLASSPATH environment variable. It MUST include atleast this



Give that command from within the program folder.

[ May 09, 2006: Message edited by: Shyam Prasad Murarka ]

[ May 09, 2006: Message edited by: Shyam Prasad Murarka ]



neither worked.
 
Matt Kidd
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
You've set the environment variable CLASSPATH, but you haven't set it to include "." (dot), representing the current directory.

Either add "." to your CLASSPATH, or (my personal recommendation) unset this environment variable altogether. The best setting for people new to Java is no setting at all -- the default would have worked fine for you here.

Note that CLASSPATH and PATH are distinct and unrelated. PATH is used by the OS to find programs to run (like java.exe). CLASSPATH is used by Java to find *.class files to run. The OS knows nothing about CLASSPATH, and Java knows nothing about PATH.




check that...it did...neglected to restart the command window. thank you.
[ May 09, 2006: Message edited by: Matt Kidd ]
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We're assuming in the above that d:\program is your current working directory , but perhaps that's not the case?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic