File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Command line runs it, Eclipse does not :-( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Command line runs it, Eclipse does not :-(" Watch "Command line runs it, Eclipse does not :-(" New topic
Author

Command line runs it, Eclipse does not :-(

Prosenjit Banerjee
Ranch Hand

Joined: Dec 18, 2002
Posts: 102
Happy New Year JavaRanchars,
I am not new in Java, but very new in Eclipse.

I am facing a problem that seems to be very simple and common. But for last 3 days it driving me nuts. Kindly get me off the bottle neck.

I have a directory structure as follows

Under PbandPackage I put one file called Tools.java having code as follows:


Now I have anther file named Test.java under path c:\JavaProgs havng code as follows:-


By the way, eclipse underlines the word Tools with red.

I have added the following build path to my project in eclipse: c:\abcd\efgh

But even doing so I cannot run the Test.java from eclipse. The following error occurs:


But I can run the file from writing the following commands:


But surprisingly enough the fact is that, just after succesfully run from command if I hit the run button from eclipse the folloing error comes:


If proceed now then I get the correct output.

Kindly tell me just where I am going wrong. Please.


Always say the TRUTH only
Manoj Agnihotri
Greenhorn

Joined: Nov 14, 2006
Posts: 11
This errors is just because your class path is not configured correctly.


This code means PbandPackage must be at same level as Test Class.
Means :
-Test.class
-PbandPackage-Tools.class

or you can include class files in Project Class path :
Project Properties -> Build Path -> Libraries -> Add Class Folder
and Select Folder where you PbandPackage contains class file.

and now run your Tools.java file.



..........



But in case of Eclipse its very easy to create a Java Project.
1. Create a new Java Project
2. Create src folder for your project.
3. Create packages.
4. Import required classes by Pressing Ctrl + O
5. run your programs.
Prosenjit Banerjee
Ranch Hand

Joined: Dec 18, 2002
Posts: 102
Originally posted by Prosenjit Banerjee:

I have added the following build path to my project in eclipse: c:\abcd\efgh

But even doing so I cannot run the Test.java from eclipse.


So, as I told, I added the path in the Build path. Still it does not run. Please tell me where am I going wrong.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Command line runs it, Eclipse does not :-(
 
Similar Threads
Using DLL in Java
Related to protected method
how to complie/run a java prog with 2 or more classes
Package Statement
Using reflection for button listeners, throwing ClassNotFound exception