This site requires JavaScript, please enable it in your browser!
Greenfoot back
toytttttt
toytttttt wrote ...

2012/1/1

Conversion?

1
2
toytttttt toytttttt

2012/1/1

#
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.
toytttttt toytttttt

2012/1/1

#
Also, are there other languages which you can convert to?
darkmist255 darkmist255

2012/1/2

#
First of all, you know Greenfoot is Java right? Well, Greenfoot scenario files don't actually contain the code. Look in the project folder, lots of .JAVA files scattered about in there. You might be able to just copy those, try it out, though I don't really see why you would need to do this. But not, you can't convert to different languages. You could, however, maybe "translate" if you know the other language well and it is an Object-Oriented class based language.
kiarocks kiarocks

2012/1/2

#
only idea i have is, get the World, Actor, And other support classes from inside greenfoot, the core in greenfoot, and othewr things you need in your simulation, then you can make a .java file that says something like
public class runMyCode
{
public static void main(String[] args)
{
actor1.act()
}
}
For this to work you have to make the act method static, but it could still work.
mjrb4 mjrb4

2012/1/2

#
It's been in there since pretty much the beginning! Go to the standard export dialog then export it from there as a jar file.
kiarocks kiarocks

2012/1/2

#
i know, but without the buttons.
mjrb4 mjrb4

2012/1/2

#
The original message didn't say anything about the buttons, just about having it as a standalone Java program. In terms of translating to other languages, I'd have to question why you want to do it first - sure you could, but what would the point be apart from an academic exercise?
darkmist255 darkmist255

2012/1/3

#
Yeah, you can easily export the file as a JAR, I've done it lots.
toytttttt toytttttt

2012/1/4

#
mjrb4 wrote...
The original message didn't say anything about the buttons, just about having it as a standalone Java program. In terms of translating to other languages, I'd have to question why you want to do it first - sure you could, but what would the point be apart from an academic exercise?
I wantt to do it because you can do more with certain code files.
mjrb4 mjrb4

2012/1/5

#
I wantt to do it because you can do more with certain code files.
What is it you want to do that you can't do with Java, and why are you so sure you can't do it? There are ways to interface to code written in other languages (which is the approach you'd take rather than rewriting the entirety of Greenfoot in another language), but it's usually a case of if you have to ask these sorts of questions then you're probably not at the stage where it's a sensible thing to do!
darkmist255 darkmist255

2012/1/5

#
Yeah I see very little point in converting to another language, as the majority of things can be accomplished in most languages, just in different ways.
toytttttt toytttttt

2012/1/12

#
Okay, I get it. But what is the standard export screen? Searched around for all the usuals, but none there?
toytttttt toytttttt

2012/1/12

#
And why is everyone so dismissive when it comes to exporting?
darkmist255 darkmist255

2012/1/13

#
Not attempting to be, I don't really know a lot about exporting (only done it a few times). Others are just trying to figure out what specific part you need help with.
danpost danpost

2012/1/13

#
When you mouse-click on the 'Share' button in the top-right corner of the Greenfoot window (or select Scenario and Share... through the menu-bar, or press Ctrl-E), you are given three options as to how to export the scenario. One is to the Greenfoot site; the second is as a web-page; and the third option is for a stand-alone executable jar file. This third option will create the file in the directory (or output location) you specify.
There are more replies on the next page.
1
2