• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why oh why do I even Try??

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code works within the eclipse editor, but not outside... What is missing in the main method?

<** I'm posting this here because it's gotta be a newbie mistake which I am overlooking.... **>




***** Changed code to simpler example. still doesn't work. **********

Error from Console is still :


[ May 12, 2005: Message edited by: Sam Smoot ]
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error you get when you run outside eclipse ?
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"does not work" meaning? you get an exception?
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even more frustrating... This is what happens when I compile it outside of ANY IDE environment.




 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this class supposed to be in package jTesting?

The code itself is ok, so it is something else.
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
using command line:
and this post might help you
[ May 13, 2005: Message edited by: miguel lisboa ]
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as Timmy said, are you sure you java file does not declare any package declaration?
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, taking the package declarations out of the code did help, but Eclipse forces you to put those there.. Guess that's not an option now..

Thanks.
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as far as i know eclipse has a default package, and else you van create any packages you want, and then keep in there your files, with respective package declaration;

for bigger projects (with several packages and many classes) compiling and running from eclipse (or any other IDE) is ok, but to run a single file is faster doing it with command line - you dont have to create a project, and all that...
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
of course you can allways compile and run a file that is inside a package:
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, and it doesn't like for you to use that one, either. I am just trying to get (re)used to the environment due to not being allowed to code for about 2 years, so I'm a little rusty. I have a couple of "Q&D" tools to do individual files, but this one will need to be jar'ed for a small group to have access to it, so I was trying to put them together and keep them related.

Thanks.
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have the package declaration, then you have to have the same directory structure underneath your classpath. That is, if you class is:

jTesting.TestMain,

then your command should be:

C:\JavaCode\Testing>java jTesting.TestMain

You were using:

C:\JavaCode\Testing\jTesting>java TestMain

(Note the difference in directory location and class name specified at the command prompt!)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic