Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Mark Alderson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class you should be trying to compile and run is LRMP.impDownload, not LRMP.iDownload.
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be compiling and executing the class impDownload not just compiling the interface iDownload and then trying to execute it!
 
Mark Alderson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the input fellas!

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



 
sai rama krishna
Ranch Hand
Posts: 432
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
symbol: class iDownload


It is interface. I wonder why it is saying as class.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Mark Alderson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad I could help! And welcome to the Ranch!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic