oh ok apparantly the html code is important
<html>
<body>
<applet id="ProjectApplet" style="display:block" code="ScratchApplet" codebase="./" archive="ScratchApplet.jar" height="387" width="482">
<param name="project" value="testproject.sb">
</applet>
</body>
</html>
so its not completely java... but can be embeded into a website as java if that is what you needed it for
Offline
Hi guys
I have heard of a way which you can get scratch programs in a java format. The only problem is that you need to know a bit of java language. You can download a program called "jGRASP" for free. It doesn't actually convert it but i think there is PDF files with scratch script images which you can download form somewhere.The java scripts are beside the scratch scripts so it shouldn't be too difficult.
I dont actually think there is a program which directly converts scratch to java.
Offline
LS97 wrote:
i will explore the online java applet to see if i can reach some conclusions.
meanwhile, if anyone else is interested, you can find it at
http://scratch.mit.edu/static/misc/ScratchApplet.jar
EDIT
i downloaded it and extracted its files.
i found out that most commands are found in the commands.logo file, editable in any text editor such as notepad.
unfortunately, i'm not that good at java scripting.
summing it up, you can simply run an SB project in a java applet using the embed code but substituting the project path with the location of the SB file.
in other words, use the code<applet id='ProjectApplet' style='display:block' code='ScratchApplet' archive='http://scratch.mit.edu/static/misc/ScratchApplet.jar' height='387' width='482'><param name='project' value='yourprojectname.sb'></applet>
to open it in an internet browser.
trying to figure out how to run it without the support of a browser.
Download the .jar file, and run it with an input of "projectname.sb" and of course, replace the projectname with your project's name.
EDIT: The command:
start ScratchApplet.jar project projectname.sb
Last edited by rdococ (2011-06-21 13:17:44)
Offline
The answer to this question is quite simple.
Open the project up in Scratch, then upload it. Find it online, and scroll down to find the 'add this' bit. Above the 'add this' button, it says 'embed'. Click that, then copy and paste the applet code into a website. Voilà! You have Java Scratch.
Offline
jon182 wrote:
yep. that is how you save it as java. (if saved first as a text file) and i even looked under properties and it said JAVA file.
there has to be a way to convert scratch to any type of file also, thinking logicly, a computer in the end reads everything as 1's and 0's. like 100101011111010100
so anything can be converted into anything even if you have to do a shi+load of programming
No No No!
Even though you might rename it into a java, the code is incorrect. Java can't understand squeak! Some compilers have to go through BILLIONS of scripts.
My advice? STOP.
Offline
TornFusion wrote:
Even though you might rename it into a java, the code is incorrect. Java can't understand squeak!
SB-files aren't squeak!
I have programmed a program, wich converts Scratch-Projects to Java!
Topic: http://scratch.mit.edu/forums/viewtopic.php?id=62402
Download: http://www.file-upload.net/download-350 … R.Jar.html
Sorry it's all in german...
Offline
LS97 wrote:
i will explore the online java applet to see if i can reach some conclusions.
meanwhile, if anyone else is interested, you can find it at
http://scratch.mit.edu/static/misc/ScratchApplet.jar
EDIT
i downloaded it and extracted its files.
i found out that most commands are found in the commands.logo file, editable in any text editor such as notepad.
unfortunately, i'm not that good at java scripting.
summing it up, you can simply run an SB project in a java applet using the embed code but substituting the project path with the location of the SB file.
in other words, use the code<applet id='ProjectApplet' style='display:block' code='ScratchApplet' archive='http://scratch.mit.edu/static/misc/ScratchApplet.jar' height='387' width='482'><param name='project' value='yourprojectname.sb'></applet>
to open it in an internet browser.
trying to figure out how to run it without the support of a browser.
I can make a html site and insert the code.
Offline
whuszah wrote:
i really wanted to do this so i could compare the languages and learn java, because i feel comfortable with scratch, and i wanted to transition.
The two are rather different. Graphics are integrated nicely into everything Scratch, and Scratch runs in real time. Java is an old fashioned monster called a console app. You write your program like a letter in a word processor. Then you run it through the compiler and see how many errors the compiler throws in your face. Repeat until the compiler says nothing. That is called a clean compile and as best the compiler knows, your legal code should run. Then you tell your program to run while crossing your fingers to make sure that there was not an error that the compiler could not imagine or that you did not string statements together in a way that may be legal, but does not do what you wanted it to.
Java is a fine language and will do many things Scratch may not be suited to and is well worth learning and is an employable skill. To learn Java, go to the Java tutorial "trails" maintained by Oracle, the owner of Java. The tutorials are as good as you will find for any computer language, but this will be a complete break from what you have become accustomed to here.
When you undertake a project, pick a language that is appropriate. If you need a heavy duty GUI to sit in front of a bunch of ugly data which you then beautify, Java will do fine. If you need a graphic heavy environment to run simple graphics or games, I'd call Scratch by far superior until you feel the need to make it massively multiplayer online.
Have fun programming. I used to be convinced that by now everyone would program and it would just be a part of normal literacy, but it is becoming increasingly clear that programmers are a special breed.
Offline
Pawnfork wrote:
BTW, if anyone writes the Scratch to Java cross compiler, or one in the other direction, I have the greatest admiration for your ability, time and raw determination.
There are big problems with the structure of a Scratch project and a Java program.
1. In Java you wouldn't use for every Sprite some Threads:
You make one Thread which draws all Images, lines, round rects... etc. at once!
2. The commands in Scratch (like [go ... steps], [touching...] and [bounce off edge]) are very much work in Java. (You normally don't use things like this because there are faster
and better ways...)
3. There are speed problems.
The Java program would be run much to fast and you would have to use
much "sleeps"... That's not really cool.
Offline
kattintáskor gf repeat until <(timer) > [10]> go to [mouse-pointer v] end think [Scripts in your posts!] for (3) secs
Offline
tamas_szerb wrote:
kattintáskor gf repeat until <(timer) > [10]> go to [mouse-pointer v] end think [Scripts in your posts!] for (3) secs
Okay... 1. This topic hasn't been posted on in over 5 months. 2. That was COMPLETELY irrelevant. 3. There is already a topic to test scratchblocks.
Offline
jon182 wrote:
yep. that is how you save it as java. (if saved first as a text file) and i even looked under properties and it said JAVA file.
there has to be a way to convert scratch to any type of file also, thinking logicly, a computer in the end reads everything as 1's and 0's. like 100101011111010100
so anything can be converted into anything even if you have to do a shi+load of programming
First I am learning java myself the .java extension doesn't mean anything special first you have to download a java compiler and compile the .java file to a .class file which you have to run by using the compiler also the running and compiling sometimes uses the command prompt. Also if you look at a program that uses java it will have a .exe or .class or .jar
extension.
Offline
Proanimation is exactly right.
I can program in java myself and know that changing the extension will do the same as
type random words into a .java and compiling it and expecting a program to come out.
The way to do this would be to create a compiler that understands the sb code
and converts it to java commands then compiles the resulting program as a java class
or more simply find a scratch to exe converter which would basicaly make a standalone executable and would run fast but would only run on windows unless you had an emulator.
Offline