wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Why oh why do I even Try?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why oh why do I even Try??" Watch "Why oh why do I even Try??" New topic
Author

Why oh why do I even Try??

Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
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 ]

CNSS/NSA Infosec Professional,<br />Software Engineer
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
What error you get when you run outside eclipse ?


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Neeraj Dheer
Ranch Hand

Joined: Mar 30, 2005
Posts: 225
"does not work" meaning? you get an exception?
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
Even more frustrating... This is what happens when I compile it outside of ANY IDE environment.




Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
Is this class supposed to be in package jTesting?

The code itself is ok, so it is something else.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
using command line:
and this post might help you
[ May 13, 2005: Message edited by: miguel lisboa ]

java amateur
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
as Timmy said, are you sure you java file does not declare any package declaration?
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
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

Joined: Feb 08, 2004
Posts: 1281
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

Joined: Feb 08, 2004
Posts: 1281
of course you can allways compile and run a file that is inside a package:
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
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.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

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!)


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why oh why do I even Try??