This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-11-12 10:45:33

jon182
Scratcher
Registered: 2008-08-08
Posts: 55

scratch. --> java

ok. i have found a way to convert scratch to java but theirs one problem. let me explain.



ok. to convert it, save the project to the desktop, then right click propertries cange what it opens with to notebook. then open it in notebook and save it as whatever you want to name it then .java 

it is now a java file. HOWEVER now when you try to open it it says squek image file needed and no image that you click on works it says it can't open it. doies anyone with experiance in this type of stuff have any ideas??? like jens or some other awesome ppl?

Offline

 

#2 2008-11-12 13:02:31

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: scratch. --> java

Lol, you didn't convert it to java. Just because a file has a .java file extension doesn't make it a java file. I don't think there will be a way to convert scratch files to java files.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#3 2008-11-12 18:52:04

jon182
Scratcher
Registered: 2008-08-08
Posts: 55

Re: scratch. --> java

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

Offline

 

#4 2008-11-12 19:05:36

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: scratch. --> java

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 logically, 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

I don't think you understand. Yes the computer thinks it is a java file because of the .java file extension but it doesn't actually have any java code in it. You definitely can't convert scratch to java.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2008-11-20 15:07:06

osama777
Scratcher
Registered: 2008-11-18
Posts: 10

Re: scratch. --> java

Eeeeexxxaccttllyy. It  made be a bit hard to understand, but changing the extension does NOT convert the format. It is much more complicated and involves changing the very code inside the files.

Offline

 

#6 2008-11-24 23:16:21

AlanProjects
Scratcher
Registered: 2008-06-23
Posts: 500+

Re: scratch. --> java

archmage wrote:

Lol, you didn't convert it to java. Just because a file has a .java file extension doesn't make it a java file. I don't think there will be a way to convert scratch files to java files.

There actually is one, and it kind of hides in the things you never guess, its called the scratch player. lol I need to look at the code for that sometimes so I can convert it to something like c++. That'd be cool.

Offline

 

#7 2009-07-07 15:02:01

Eggs1
Scratcher
Registered: 2009-06-22
Posts: 10

Re: scratch. --> java

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

Actually, the computer processor (the thing that does the actual computing) reads it as it's native machine code, not binary. Also, converting the file by changing the extension is like trying to turn a cake into four-poster bed.

Offline

 

#8 2010-05-17 01:19:46

abhijitgade007
Scratcher
Registered: 2009-11-04
Posts: 3

Re: scratch. --> java

hi can u show me how to convert scratch project to Java

Offline

 

#9 2010-05-17 02:10:55

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: scratch. --> java

As stated above, there is not an automatic way to convert a scratch program to java.
although the online player is written in java.
But there might be a way to meet your goal.  what is it?
Why do you want it in Java?

To have a stand alone application?
To make it run faster?
To expand as a regular java application?


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#10 2010-05-17 17:28:43

songhead95
Scratcher
Registered: 2008-03-19
Posts: 100+

Re: scratch. --> java

________      ________     _________         ________
|   _____|    |   _____ |   |___    __|        / ______|
|   |____     |   |____||         |  |          / /
|   _____|    |   ______|        |  |          | |
|  |_____     |  |                  |  |           \ \______
|_______|    |_|              ___|  |__         \_______|
                                   |________|


Fail

Offline

 

#11 2010-05-17 18:28:53

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: scratch. --> java

songhead95 wrote:

________      ________     _________         ________
|   _____|    |   _____ |   |___    __|        / ______|
|   |____     |   |____||         |  |          / /
|   _____|    |   ______|        |  |          | |
|  |_____     |  |                  |  |           \ \______
|_______|    |_|              ___|  |__         \_______|
                                   |________|


Fail

http://i908.photobucket.com/albums/ac290/nikkiperson2/Facepalm.gif
EPIC FAILURE INDEED.

Offline

 

#12 2010-05-17 19:31:25

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: scratch. --> java

songhead95, ThePCKid,
no, it's not a "epic failure"

abhijitgade007 has a valid question.  Is there a way to convert a scratch app to a java app?  He bumped this to get an answer.  I hope we can help him.

Last edited by AddZero (2010-05-17 19:34:26)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#13 2010-05-17 19:33:21

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: scratch. --> java

AddZero wrote:

songhead95, ThePCKid,
no, it's not a "epic failure"

abhijitgade007 has a valid question.  He bumped this to get an answer.  I hope we can help him.

I think they were referring to the original attempt to convert a .sb file to a java file merely by changing the extension.


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#14 2010-05-18 16:39:01

songhead95
Scratcher
Registered: 2008-03-19
Posts: 100+

Re: scratch. --> java

demosthenes wrote:

AddZero wrote:

songhead95, ThePCKid,
no, it's not a "epic failure"

abhijitgade007 has a valid question.  He bumped this to get an answer.  I hope we can help him.

I think they were referring to the original attempt to convert a .sb file to a java file merely by changing the extension.

precisely

Offline

 

#15 2010-05-18 17:52:01

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: scratch. --> java

Ok, then referring to the first post; I would call it a honest mistake, not an epic failure. 
Yes changing the extension doesn't work.  I believe I tried that when I was young. 

jon182 did bring up a good idea by tring to convert a scratch program to java.
It would be nice to expand into faster java applications.  Alice 3.0 http://www.alice.org/ is built on java, and you can edit drag and drop like scratch, or text, and I believe you can expand as a regular java application.
http://www.alice.org/community/showthread.php?t=757
It would be neat if scratch could do this too.

There are also programs that convert code from one language to another.
This could be done for scratch.

Last edited by AddZero (2010-05-18 19:29:25)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#16 2010-08-02 08:18:20

Flappyworm
New Scratcher
Registered: 2010-08-02
Posts: 1

Re: scratch. --> java

You need to copy the code into a proper editor like Eclipse or something!

Offline

 

#17 2010-08-03 02:36:15

MabonBaladevaKain
Scratcher
Registered: 2010-07-25
Posts: 80

Re: scratch. --> java

Are you guys talking about converting Scratch project files or the actual Scratch program itself? ... even if you converted Scratch to another language, would that really matter? ... Wouldn't it still be coded to create the same .sb files?
Doesn't that mean that you'd have to change the actual Scratch program's code itself?
Why not just use the code it was programmed in to decompile it to its original form and then change what it saves the .sb files as into a real code like Java or C++ or does it not work that way?
Would that mean an almost complete re-coding of Scratch, from scratch or is it simpler than that?

I'm curious about these sort of things.

Offline

 

#18 2010-08-03 03:15:19

mooseofawesomeness
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: scratch. --> java

MabonBaladevaKain wrote:

Are you guys talking about converting Scratch project files or the actual Scratch program itself? ... even if you converted Scratch to another language, would that really matter? ... Wouldn't it still be coded to create the same .sb files?
Doesn't that mean that you'd have to change the actual Scratch program's code itself?
Why not just use the code it was programmed in to decompile it to its original form and then change what it saves the .sb files as into a real code like Java or C++ or does it not work that way?
Would that mean an almost complete re-coding of Scratch, from scratch or is it simpler than that?

I'm curious about these sort of things.

Well panther saves to .pt files, so I imagine that's not too hard.  What is hard is getting it to save in the right code format, such as c, c++, BASIC, etc. Also getting to read that format is difficult.


I am urhungry's alternate account with a cooler username. Your argument is invalid.

Offline

 

#19 2010-08-03 03:59:35

MabonBaladevaKain
Scratcher
Registered: 2010-07-25
Posts: 80

Re: scratch. --> java

So, does that mean anything made in Java is going to save in a Java code format or is it possible to make a Java-created app save its files as a C++ format or even some weird encrypted unknown format?

Are the .pt files completely different or just .sb files with a renamed ending?

Offline

 

#20 2010-08-03 04:37:30

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: scratch. --> java

Save as all programs.


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#21 2010-08-04 15:01:17

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: scratch. --> java

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.

Last edited by LS97 (2010-08-04 15:17:30)

Offline

 

#22 2010-08-05 03:32:51

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: scratch. --> java

MabonBaladevaKain wrote:

So, does that mean anything made in Java is going to save in a Java code format or is it possible to make a Java-created app save its files as a C++ format or even some weird encrypted unknown format?

Are the .pt files completely different or just .sb files with a renamed ending?

pt files, just like .bingo (from Bingo 1.2) files, are simply SB files with a different extension. they have been renamed because they are not compatible with the mainstream scratch.

Offline

 

#23 2010-09-22 20:09:00

whuszah
Scratcher
Registered: 2010-06-10
Posts: 1

Re: scratch. --> java

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.

Offline

 

#24 2010-12-28 17:43:01

wigity
Scratcher
Registered: 2009-07-11
Posts: 12

Re: scratch. --> java

there is a way of doing it... but i can't remember what it is lol i found it on another forum somewhare ages ago... i think it was java anyway. i used it to embed one of my projects into my website. the only problem is that i need to do it again and cant find the forum lol

Offline

 

#25 2010-12-28 17:57:02

wigity
Scratcher
Registered: 2009-07-11
Posts: 12

Re: scratch. --> java

AH HAH ok so the forum is:

http://scratch.mit.edu/forums/viewtopic.php?id=191

so you need to download 2 files
1. http://scratch.mit.edu/static/misc/ScratchApplet.jar
2. http://scratch.mit.edu/static/misc/soundbank.gm

and then i think you just put the .sb in the same folder as those files  smile  i havn't tested it again yet but i think that is how it works... give it a go

Offline

 

Board footer