Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 06-27-2013, 02:28 PM   #1
Sothh
Shaman of Time
Sothh began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2011
Device: Kindle Paperwhite First Gen
Kindlet gives "Unable to find class Main"

Hi all. Been a long time lurker on here, but now that I have my PW (got it yesterday!) I am needing some help.

I am working on a "Hello World" kindlet and I can't seem to get it to run. I have signed the app with proper dev keys, setup the manifest file correctly (I believe), and yet when I try to open the kindlet on my PW, I get an error something like "Error: Unable to find class Main."

I have triple checked everything, and I can't find a problem with my code. I have attached the source if anyone could help.

A couple notes about the source:

Because this is on a PW, it uses the Kindlet-2.2.jar, which is the 2.0 version of the KDK (I believe.)

I am not using an IDE, just Notepad++ and some batch files to do the compiling. (In windows.) This is my usual way of coding, but I hardly ever mess with Java, so I may be doing something wrong.

Thanks!
Attached Files
File Type: zip Hello World.zip (3.0 KB, 77 views)
Sothh is offline   Reply With Quote
Old 06-27-2013, 04:22 PM   #2
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,907
Karma: 6727464
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by Sothh View Post
Hi all. Been a long time lurker on here, but now that I have my PW (got it yesterday!) I am needing some help.

I am working on a "Hello World" kindlet and I can't seem to get it to run. I have signed the app with proper dev keys, setup the manifest file correctly (I believe), and yet when I try to open the kindlet on my PW, I get an error something like "Error: Unable to find class Main."

I have triple checked everything, and I can't find a problem with my code. I have attached the source if anyone could help.

A couple notes about the source:

Because this is on a PW, it uses the Kindlet-2.2.jar, which is the 2.0 version of the KDK (I believe.)

I am not using an IDE, just Notepad++ and some batch files to do the compiling. (In windows.) This is my usual way of coding, but I hardly ever mess with Java, so I may be doing something wrong.

Thanks!
I don't see anything really wrong either. However, if the error message you're citing is exactly what you see, then the implementation is looking for a class called "Main", while you are providing one called "main". Java is case-sensitive, and classes should always start with an upper-case letter. (It would be the first time that I see something being so picky about it, but it's always a good idea to follow conventions).

As a side note: of course, I'm not going to force anything onto you, but experience shows that programming with a real IDE is much less error-prone, and much more comfortable and efficient.
ixtab is offline   Reply With Quote
Advert
Old 06-27-2013, 04:33 PM   #3
Sothh
Shaman of Time
Sothh began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2011
Device: Kindle Paperwhite First Gen
Quote:
Originally Posted by ixtab View Post
I don't see anything really wrong either. However, if the error message you're citing is exactly what you see, then the implementation is looking for a class called "Main", while you are providing one called "main". Java is case-sensitive, and classes should always start with an upper-case letter. (It would be the first time that I see something being so picky about it, but it's always a good idea to follow conventions).

As a side note: of course, I'm not going to force anything onto you, but experience shows that programming with a real IDE is much less error-prone, and much more comfortable and efficient.
After a TON of searching, I found the problem. It was not with the naming, but because the Kindle uses Java 1.4, and I was using the latest (1.7) to compile with.

The solution is to compile using
Code:
-target 1.4 -source 1.4
After doing this, the kindlet no longer gives the main class not found error, though the code still does not work. (I believe its because I don't actually have 1.4 to compile against using
Code:
-Xbootclasspath:/usr/java/jdk1.4.0_30/jre/lib/rt.jar
I am downloading 1.4 now, and I will update on the outcome.

Thanks!
Sothh is offline   Reply With Quote
Old 06-27-2013, 06:17 PM   #4
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,907
Karma: 6727464
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by Sothh View Post
After a TON of searching, I found the problem. It was not with the naming, but because the Kindle uses Java 1.4, and I was using the latest (1.7) to compile with.

The solution is to compile using
Code:
-target 1.4 -source 1.4
After doing this, the kindlet no longer gives the main class not found error, though the code still does not work. (I believe its because I don't actually have 1.4 to compile against using
Code:
-Xbootclasspath:/usr/java/jdk1.4.0_30/jre/lib/rt.jar
I am downloading 1.4 now, and I will update on the outcome.

Thanks!
No, you don't necessarily *have* to compile with the 1.4 SDK. Compiling with the given arguments will do, whatever your SDK is.

You can also check /mnt/us/developer/<Kindlet name>/work/crash.log for what exactly is causing problems.
ixtab is offline   Reply With Quote
Old 06-27-2013, 08:01 PM   #5
Sothh
Shaman of Time
Sothh began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2011
Device: Kindle Paperwhite First Gen
Yeah, figured that out. I was using a JFrame when I should have been using a JPanel. Now it compiles and runs fine. Thanks for the crash log location, I have been trying to find it.
Sothh is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Indents on <br class="calibre1" /> CyanBC Sigil 20 04-05-2013 11:59 PM
Kindlet Dev SOS: Main class not found cubemike99 Kindle Developer's Corner 7 02-09-2013 09:38 AM
class="none" vs class="none1" hymie Conversion 2 10-27-2011 06:45 AM
Value of Attribute "Class" is Invalid Error TFaire ePub 2 09-23-2011 11:25 AM
Changing or removing <div class="calibrenavbar"> ptsefton Recipes 3 05-28-2011 08:30 AM


All times are GMT -4. The time now is 08:54 AM.


MobileRead.com is a privately owned, operated and funded community.