CBCJVM and multiple classes?

2 replies [Last post]
imjake9
imjake9's picture
Title: NooBot
Joined: 03/01/2012
Posts:
BotPoints: 19
User offline. Last seen 8 years 47 weeks ago.

I am using CBCJVM, but I'm a little confused about how to use multiple files/classes. I have the Main class, Main.java, and a separate class, EventUtils.java. They are in the same directory, the default package. However, when I try and compile Main.java, it throws me an error:

cannot find symbol
symbol: variable EventUtils

How can I get it to include this file when compiling and downloading?

Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 8 years 32 weeks ago.

KISS IDE's front end for CBCJVM only allows one java file to be downloaded to a CBC project directory right now. It should be noted, however, that one java file can have several top level classes.

For example, this would be a valid java file:

  1. class A {
  2. public String b() { return "Hello, World!"; }
  3. }
  4.  
  5. class Main {
  6. public static void main(String[] args) {
  7. A a = new A();
  8. System.out.println(a.b());
  9. }
  10. }

Anonymous classes are also supported.

KISS IDE was originally designed for C, and didn't quite align to the java idea of a "project." I have been working diligently on making a project system for KISS IDE, and this will solve the problem of file relations at download time. I imagine that we will see a major overhaul of KISS released by summer.

It should also be noted that you may load a java program over USB flash drive as well. If you were to use an IDE like Eclipse, you could copy the project's bin directory to a flash drive and not run into this issue.

Thanks for your patience.

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.

imjake9
imjake9's picture
Title: NooBot
Joined: 03/01/2012
Posts:
BotPoints: 19
User offline. Last seen 8 years 47 weeks ago.

Thanks a lot for the response. The simple knowledge that the CBCJVM project is being worked on is definitely encouraging. This limitation is definitely a downside, but I understand the issues, and this workaround should work well for now. If you can ever get it working using multiple files, I'd love to see package support and maybe even classes that don't require being named Main. Perhaps you could make it JAR-based with a manifest file handing that? Either way, simply having multiple files would be enough, at least for now.

As for using a flash drive, that's probably a good idea. I'm using NetBeans on a Mac (though I also have Eclipse since that's necessary for some things), and I could definitely try that out. I tried using CBCDownloader with the USB support, but it hung as soon as it tried to read anything from the USB cable. Perhaps it's a Mac OS X issue?

Thanks again for bringing Java to the CBC.