CBC JVM issue

5 replies [Last post]
scottmil
scottmil's picture
Title: MiniBot
Joined: 05/10/2010
Posts:
BotPoints: 37
User offline. Last seen 11 years 14 weeks ago.

I'm working on, of all things, my Master's Thesis. I was going to use a CBC with the JVM. I installed the JVM on my machine w/ eclipse and on the cbc. My test program looks like this:

public class main {
public main()
{
System.out.println("Hello CBC!");
}
}

When I run the compiled .c all I get is a message saying:

"Static method "main" not found in Main"

I'm sure I'm making a shameful beginners mistake, or its something specific to this modded install of the JVM.

Some Help?

Scott

All is fair in love and war, and botball is both :)

scottmil
scottmil's picture
Title: MiniBot
Joined: 05/10/2010
Posts:
BotPoints: 37
User offline. Last seen 11 years 14 weeks ago.

minus the spam,,,

bump

All is fair in love and war, and botball is both :)

catron
catron's picture
Title: ZoomBot
Joined: 06/02/2009
Posts:
BotPoints: 98
User offline. Last seen 10 years 30 weeks ago.

Hey Scott, thanks for considering CBCJVM for use with your thesis! I am interested to see your research! The correct definition for a main method is as follows:

public static void main(String[] args) {
}

Be sure to also capitalize the class name, it is required to be "Main" with a capital M!

If you want faster support, you can email me at braden DOT mcdorman AT ossm DOT edu or my AIM bcmCatron. (Hopefully that is enough to thwart the spam bots.)

"When you do things right, people won't know you've done anything at all."

wmyers
wmyers's picture
Title: Advisor
Joined: 02/24/2011
Posts:
BotPoints: 54
User offline. Last seen 8 years 28 weeks ago.

Sorry about the spam... We just had a bot create an account and in seconds post 200 posts.

Wesley Myers
--
YAC Advisor
Botball International Champion 2007 and 2008

Carnegie Mellon University 2012
Electrical and Computer Engineering
Computer Science and Robotics

scottmil
scottmil's picture
Title: MiniBot
Joined: 05/10/2010
Posts:
BotPoints: 37
User offline. Last seen 11 years 14 weeks ago.

I actually attempted the corrections you recommended the other evening, and continued to have issues. This time relating to particular java libraries not being found. I thought it was an installation issue, and tried to reinstall, but no dice. I've actually decided to attempt another route for the time being, but if I revisit this option I'll let you know.

Thanks for the help.

Scott

All is fair in love and war, and botball is both :)

PiPeep
PiPeep's picture
Title: RocketBot
Joined: 07/19/2009
Posts:
BotPoints: 170
User offline. Last seen 8 years 28 weeks ago.

Sorry for not posting sooner (I haven't been watching the community site very much recently).

At the risk of repeating what you may have already done, or what Catron may have said:

  • Install CBCJVM on your computer following the guide on the CBCJVM wiki: https://github.com/CBCJVM/CBCJVM/wiki/Install-and-Setup
  • Install CBCJVM to your CBC. The last step of the prior mentioned install and setup guide on the wiki briefly describes where to look to figure out how to do this. (hint: you'll need a flash-drive)
  • Write your Java program like this: http://pastie.org/2116631 , and save it in a file called Main.java (case is important, and must match the class name). If you're not familiar with Java, I suggest you start here: http://download.oracle.com/javase/tutorial/getStarted/application/index....
  • Make sure your program compiles. This simple program doesn't depend on any CBCJVM specific libraries, but if it did, you should make sure CBCJVM's libraries are in your classpath. I don't know how the eclipse plug-in handles things, but with the command-line javac you should end up with something like javac -cp .:/absolute/path/to/cbcjvm/cbc/dist/lib/CBCJVM.jar Main.java
  • Try running your program on your computer before you put it on the CBC. Once again, I don't know how the eclipse plug-in handles things, on the command-line, running the Main.java program should be as simple as running java Main. As a note: if this program did depend on CBCJVM-specific libraries, which it doesn't, you would have to specify the classpath again, like java -cp .:/absolute/path/to/cbcjvm/cbc/dist/lib/CBCJVM.jar Main
  • Copy the program to the CBC. There's a variety of ways of doing this. The drop-dead easiest is simply to look that install_data folder that you put on your flashdrive earlier. Take a look at that code folder. Look at how the examples are put in there. Put your program in there like that (plus a .class file, CBCJVM doesn't have a compiler on the CBC, you must compile your program before transferring it over. The examples don't have these just simply because we haven't figured out a good way to automatically compile all the examples with ant yet.), and run the installer again (or CodeInstall.c, which only re-installs the code folder, and is thus much faster). The .c is simply a launcher, because the CBC's ui can't handle Java files.
  • Run the program on the CBC
  • If you have any further problems, you can contact catron, or me. I'm almost always on the Botball IRC (Community Chat). Just mention my nick, pipeep.