PDA

View Full Version : Java Cell phone programming problems.




helgimar
Mar 1, 2009, 01:54 AM
Hi

I am editing a java Cell phone game for my class.
I have no idea how to compile the .java files. Can someone please inform me how to do that, or compile them and send them back to me?

On the other hand, I have to put a timer on the program.
It has to take the time it takes to finish the puzzle, and then put your time on the high score list (which doesn't exit)

I also can't find where to change the name of the game, on my phone the name is Jigsawislam but I want it to be Púslið

Can someone incorporate that into my attached files?

Thanks.



lee1210
Mar 1, 2009, 05:45 AM
We will not do your homework for you.
javac filename.java
Will build filename.class from filename.java. The rest is your assignment. You can ask questions about an approach or snippit of code, but not "do my homework".

-Lee

helgimar
Mar 1, 2009, 12:48 PM
Thats the problem, JAVAC does not work!
I have tried it in both my mac and my PC and it won't compile for me.
In my PC it gives me 49 errors per file or something.

and I have no Idea how to compile java files on MAC.

lee1210
Mar 1, 2009, 01:56 PM
Did your teacher/professor not provide you instructions on building this project? It looks like there are J2ME/MIDP dependencies required. I downloaded a version for OS X from here:
http://mpowers.net/midp-osx/

I added the classes directory from there to my classpath, and tried to compile. c.java would compile. I got stuck after that, but I may just not know how to handle cross-dependencies in Java. d.java references JigsawIslam.java, and vice-versa. a.java references JigsawIslam.java, and b.java references d.java and JigsawIslam.java. It may be possible to build a project with these kinds of dependencies, but I just don't know how to do it.

Is this "known-good" code that was given to you, or did you write most of it? If the prior, were there instructions to build the project?

-Lee

Wes
Mar 1, 2009, 02:00 PM
Did your teacher/professor not provide you instructions on building this project? It looks like there are J2ME/MIDP dependencies required. I downloaded a version for OS X from here:
http://mpowers.net/midp-osx/

I added the classes directory from there to my classpath, and tried to compile. c.java would compile. I got stuck after that, but I may just not know how to handle cross-dependencies in Java. d.java references JigsawIslam.java, and vice-versa. a.java references JigsawIslam.java, and b.java references d.java and JigsawIslam.java. It may be possible to build a project with these kinds of dependencies, but I just don't know how to do it.

Is this "known-good" code that was given to you, or did you write most of it? If the prior, were there instructions to build the project?

-Lee

Doing a javac *.java should be enough to handle all the dependencies for you. Whoever wrote this code doesn't have particularly java'ish style, seemed very C! I guess this is is a by-product of it being java micro edition but still, not a fan of the code.

helgimar
Mar 1, 2009, 02:20 PM
Hi Guys,

No actually this is just a .jar file, that has been decompiled and edited.
I was just supposed to translate all the text to my language and than compile it again.

I changed the text but can't compile again, I tried compiling it in my PC and just got loads of errors...

lee1210
Mar 1, 2009, 02:43 PM
Doing a javac *.java should be enough to handle all the dependencies for you. Whoever wrote this code doesn't have particularly java'ish style, seemed very C! I guess this is is a by-product of it being java micro edition but still, not a fan of the code.

I figured, and that's what i tried. The code is nigh unreadable, so i got a bit confused with what the compiler was complaining about. There are classes called a,b,c,d, and local variables called the same thing, etc. I guess this is what a decompiler gets you? I would try renaming at LEAST the classes, if not all of the local variables, to something reasonable. Otherwise there is a lot of complaining. I just went for the local variable route, and it seemed to work... in so far as the classes were compiled. I changed all of the locally declared things called a,b,c, or d to old_X where X is the original value, then let the compiler tell me what other lines needed to change.

I have no idea if these things would work now... but they at least compiled after this.

I don't understand what this class is trying to teach, exactly... if it's a reverse engineering course, i would think warnings about the decompilers would have been issued clearly. If it's about writing games or something, I don't know why decompiling and translating would be part of it. One way or the other, this seems fixable, it will just take a few minutes of work renaming some variables or the classes.

-Lee