• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

DaysOld and classpath

 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I can compile fine using the provided zip file and javac and classpath settings. I can't seem to convince java.exe to behave similarly.
Any advice?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error I get is the old NoClassDefFoundError
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also known as GoJumpInALakeError
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I know what I did wrong.
The classpath setting for javac doesn't need to include the location of the class that I'm about to create. So, not specifying the current working directory (the one where the class file I'm creating will be) is no problem. java does need to know the location of all class files I want to use - including the location of the class I am executing (which for some asinine reason it can't find all by itself if it's in the current working directory). The solution then becomes:
java -classpath ".;.\whatever" SomeClass [someArguement(s)]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll leave this monologue for future perusers (me in a month).
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dirk Schreckmann:
The error I get is the old NoClassDefFoundError


Yeah, it's the one I call java.lang.Nope
 
whippersnapper
Posts: 1843
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, one of the best tricks I learned is
java -classpath . SomeClass
My machine at work is locked down and I can't change the path or classpath, so I wind up having all sorts of path and classpath adventures when I get the urge to do some Java on the sly. (My work doesn't involve Java programming, as you could probably guess.)
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Matola:
Yep, one of the best tricks I learned is
java -classpath . SomeClass
My machine at work is locked down and I can't change the path or classpath, so I wind up having all sorts of path and classpath adventures when I get the urge to do some Java on the sly. (My work doesn't involve Java programming, as you could probably guess.)


Thomas Paul introduced me to an even better trick . . . Ant.
 
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Someone not knowing about what Ant means:
A sort of makefile using XML (extended markup language) and Java.
Ant is available from jakarta.apache.org
Worthwhile!
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thomas Paul also wrote about ant in the JavaRanch Newsletter in March.
 
This is my favorite show. And this is my favorite tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic