aspose file tools*
The moose likes Beginning Java and the fly likes Problem running 3rd party provided Java code, main method not found in class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem running 3rd party provided Java code, main method not found in class" Watch "Problem running 3rd party provided Java code, main method not found in class" New topic
Author

Problem running 3rd party provided Java code, main method not found in class

Mark Alderson
Greenhorn

Joined: Oct 26, 2012
Posts: 3
Hi,

Firstly, I'm a total noob to Java, spent some time with Java and Oracle back at Uni over 10 years ago, however my profession these days keeps me well and truly planted in the Microsoft world (I'm a SQL DBA by rights).. so you may be asking what am I doing messing around with Java..

Long story short, I need to download a file from a web server from a 3rd party vendor, and build this into a nightly package which after downloading the file will extract it, import the data into various tables in a DB etc. The 3rd party has provided me with the following files/code as a method of automating the download of the files, however I'm having problems compiling/running them, and I imagine it's probably just because I don't really have any idea what I'm doing with Java. I have spent several hours on Google, and quite a lot of searches have brought me to your site, but I haven't quite managed to find a resolution to my specific problem, so here goes

First, here are the 2 java files that I was given

iDownload.java


impDownload.java


Please note I have blanked out alot of the variables for security measures

Next I have created a .bat file and am calling this from command prompt

run.bat


When I run this, I get the following 'errors'



I've tried various different things, but I've got a feeling I'm simply not doing this the correct way.

For further information I'm running JDK 1.7.0_09, althought you've probably gather that from the paths in the code above.

Let me know if there's any further information you require. Any help will be much appreciated!

Many thanks
Mark
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
The class you should be trying to compile and run is LRMP.impDownload, not LRMP.iDownload.
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

You should be compiling and executing the class impDownload not just compiling the interface iDownload and then trying to execute it!
Mark Alderson
Greenhorn

Joined: Oct 26, 2012
Posts: 3
thanks for the input fellas!

OK, if I now try to compile the impDownload.java, I get the following



sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 269
symbol: class iDownload


It is interface. I wonder why it is saying as class.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

sai rama krishna wrote: symbol: class iDownload

It is interface. I wonder why it is saying as class.


Because that's the error message compiler produces in when interface, class or method cannot be found.

@OP:
Did you try to compile from the root directory of your source? Since both interface and class implementing it are in LRPM package, navigate to src directory and try:


The quieter you are, the more you are able to hear.
Mark Alderson
Greenhorn

Joined: Oct 26, 2012
Posts: 3
Sweet! Thanks Kemal, your advice was correct, by compiling the entire source folder and then executing the package I was successful.

Muchos gracias
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Glad I could help! And welcome to the Ranch!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem running 3rd party provided Java code, main method not found in class