Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory monitor motherboard network operating system printer problem ram registry router slow software sound svchost.exe toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Programming Java on a Mac

Reply  
Thread Tools
bcap's Avatar
Senior Member with 164 posts.
 
Join Date: Sep 2005
Experience: Advanced
25-Sep-2006, 09:55 PM #1
Programming Java on a Mac
Hi Guys.

I have a bit of a debocle here.

I am running Eclipse on my Macbook Pro. I have an assignment for school (in Java) that uses a provided Simulator.jar package. The jist of it: create an instance of the Simulator, run it, and create creatures for the simulator (e.g. insect).

Now the problem I am getting is that when I run the class (the one that creates a new Simulator), everything works wonderful. The Simulator engine runs and I get a window coming up that says open, save, continue, quit, stop. Now what I am supposed to do is open a .conf file. In the .conf file, it says "insect (int,int,int,int)" where int is any integer.

My integer class is properly formatted, implementing the Simulated Entity interface, with the proper number of parameters. When I open this file, it says "world.insect not found. mispelled class name or missing package name".

What this means, is that when I open the new simulator and open the config file, it looks for "insect.class", in the package that i specify "world", which my insect class IS a part of.

For some reason, when I copy my 2 .java files onto a PC, and compile and run them, they work fine.

Is it something to do with Mac? Eclipse? I have tried compiling and running it through terminal and I get the same error.

If it helps at all, the link to the assignment is here:
http://www.cosc.brocku.ca/Offerings/...signment1.html

My .java files are as follows:

insect.java:

package world;

import java.awt.Color;
import Simulator.*;

public class insect implements SimulatedEntity {

public insect (int a, int b, int c, int d){

}

public Coordinates getLocation(){
return null;
}

public boolean isAlive(){
return false;
}

public void die(){

}

public String toString(){
return "test";
}

public Color getColor(){
return null;
}

public void act (World world){

}

}

runsim.java:

package world;

import Simulator.*;

public class runsim {

public runsim(){
Simulator sim = new Simulator ("runsim", 200, 200, SimulatorColors.WHITE, "world");
sim.run();
}

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

My .conf file reads:

XSize: 400
YSize: 400
Entities:
insect(1,1,1,1)

That is everything. Any help at all woudl be GREATLY appreciated!

Thanks in advance.

Bryan

Last edited by bcap; 25-Sep-2006 at 10:02 PM..
Chicon's Avatar
Computer Specs
Distinguished Member with 6,690 posts.
 
Join Date: Jul 2004
Location: 50° 34' 07.13" N - 04° 10' 23.
Experience: Second socks retriever
28-Sep-2006, 02:54 AM #2
Hi bcap,

I do not own a MAC but I tried your coding on my computer and it seems to work.
I used the following lines in my .conf file :

Code:

XSize:10
YSize:10
Entities:
insect(7,5,3,216)
 
When I run the application, a window pops up with 'runsim(Stopped)' as the title, then I click on Open to select the .conf file I made and nothing happens. But I have no error message.
__________________
Never teach an old monkey how to make faces. - (French maxim)
bcap's Avatar
Senior Member with 164 posts.
 
Join Date: Sep 2005
Experience: Advanced
28-Sep-2006, 03:03 AM #3
Chicon,

Thanks for the trial. I went to my professor the other day, and apparantly there is something implemented differently in Mac.

He broke it down to the depths of Java and found that a method "findName0" is implemented differently in the mac veresion - and this is possibly a bug.

When it is looking for a file in a package, it is supposed to look for PackageName.Class, where as the way it is implemented on mac is PackageName/Class, and this affects it somehow.

I have no idea, so I am resorting to coding in JCreator through parallels desktop.

Anyone else with any insight, I would greatly appreciate any help!

Thanks,

Bryan
dquigley's Avatar
Computer Specs
Senior Member with 112 posts.
 
Join Date: Apr 2006
Location: Woodinville, WA
Experience: Advanced
28-Sep-2006, 03:04 AM #4
The code looks fine. This sounds a lot like a dev environment issue. And the error appears like the jitter can't find your insect class. Some IDEs have specific paths to search for class code, libraries, etc. I'd check how that is setup that on the Mac.

Best,
Dan
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:21 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.