Thanks danpost, you've been the most helpful so far
I did this, but I got one of those files with the Internet explorer symbols on the front and it wouldn't open. Help?
For a stand-alone, you want to use the third option, to share the scenario as 'Application'. It appears you went with the second option (as a 'Webpage').
No, I definately picked the stand alone, and it's labeled as a .JAR file
Try right-click -> Open With -> C:\Program Files\Java\jdkx.x.x\bin\Java (Or Java(TM) Platform SE Binary if it's already a recommended program on your computer)
I did that, but it brings up something which looks like a command promt that suddenly quits. From a screenshot I caught while it was closing, it read:
Exeption in thread "main" java.lang.NoClassDefFoundError:
and then some other stuff which I dont have time to put in, will do if needed
P.S location of file wasnt in the actual code, but since the file name contains my name, I wont put it here.
Hi toyttttt,
I'm willing to try to help you, but I don't get what you are trying to do:
"I was just wondering if anyone knows a way to convert a greenfoot scenario file into a standard java file so you can run greenfoot projects in java. If this is not currently possible, take this as a sujestion for future versions of Greenfoot."
Are you :
1) Trying to create a desktop runnable version of your application?
2) Trying to export the java code in order to import into another editor/environment?
3) Trying to do something else?
If you could help me help you; willing to guide you through. For information:
The Greenfoot project (folder) has the .java files which are compiled to .class files. There are also other auxiliary files that help to build and detail what is required by a greenfoot app. It is quite possible to extract these java files into another editor (i.e. eclipse), but I don't see why you would want to do that.
Greenfoot provides an export to Jar file from the share option, by clicking share, click third icon "application" and then provide a file name with jar extension. If you have java fully installed on your machine (java 6 or 7), clicking the .jar file on the desktop/viewer will start the application as is.
If you are in windows, you can also start up a cmd window. CD to where the jar is and type 'java -jar <filename.jar>' and this will start it for you to. Any exceptions or problems will remain in the window for you to see the problem.
Your JAR should then run on any machine in theory that has Java 6/7 installed. I hope some of this helps..
Do reply and I'll try to guide you.
Kind regards
Sp33dy
I have a application which I currently have on my desktop, exported from the export window under application. It's a simple game where you have too collect space rock and dodge the ball catcher. I am only converting it to a stand-alone app for the experience so I can do it for future projects, whenever I will need a stand-alone app. I downloaded java just a few weeks ago so it shouldn't be out of date yet (I have a new windows seven with an i3 intel inside proccesor, if it helps). As I've said I've already got the app, but it won't run properly. I just want it to run with the java platform so I can play my game and I'm sorted. Please look at the post before yours to see exact description of what happens when I try to run it.
Okay, thanks for the (long) reply, hopes this helps,
Toytttttt
To be honest, I'm just doing this so I know how to.
Hi,
Ok, so from what you've stated; given has your name in. I figure that is the name of a new class you've created in Greenfoot. If so, then the export either hasn't extracted your class into the JAR or it has been removed from it after.
We need to determine/convince ourselves that your greenfoot environment is exporting correctly. Can I make a bold suggestion? Can you find another example on this website that has source. Click on open in greenfoot and then do an export to jar on that? Pick a simple looking project. See if you get the same error or not. If you do, given the code wont be referring to your name, you can then freely cut and paste here. In fact, go pick one of my examples, because they do export ok.
Small tip (not sure if you are aware). If you've got the command window open (see above) and issue:
java -jar <filename>.jar
from the directory that the jar lives in, you'll see error stack trace listed in the window. Go to top left hand of window. Where the minature cmd window icon is, click it and select edit>mark. Then highlight the error and press enter. You should then be able to paste the full error here. It'll be much easier to know the full error and the project that you tried.
I'm unsure whether you have an environment problem or greenfoot issue at the moment.
Kind regards
Sp33dy