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

#1 2012-02-02 08:14:39

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Java Official Topic

Today I finally broke down the last barrier preventing me from learning java: the inability to use the command javac from the command line. Now I'm beginning to learn, and it would be great to have some help from the community too!
So far, I've used Java From the Ground Up, and made a Hello, World! program. Please post links to resources and tutorials to help people like me!

Edit: I now made a dev blog, 16skittles.tumblr.com! All my java achievements will go there, although they don't really matter much.  tongue

Last edited by 16Skittles (2012-02-02 18:08:05)


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#2 2012-02-02 13:54:21

poopo
Scratcher
Registered: 2009-09-20
Posts: 1000+

Re: Java Official Topic

Java is a great language.  smile  If your not already using it I suggest netbeans.


http://i45.tinypic.com/28rnqki.jpg

Offline

 

#3 2012-02-02 14:26:13

Magmawulf
New Scratcher
Registered: 2012-01-14
Posts: 80

Re: Java Official Topic

@16skittles:  That's really good! 

@poopo:  Netbeans is great, isn't it?

@All:  I want to get the mcp working with Netbeans though.  sad

Offline

 

#4 2012-02-02 14:48:54

ipodbiped
Scratcher
Registered: 2011-02-06
Posts: 1000+

Re: Java Official Topic

Yay! At last, a new one of these!

Offline

 

#5 2012-02-02 17:14:23

poopo
Scratcher
Registered: 2009-09-20
Posts: 1000+

Re: Java Official Topic

Magmawulf wrote:

@poopo:  Netbeans is great, isn't it?

@All:  I want to get the mcp working with Netbeans though.  sad

Yes.  big_smile

I know how to make it work with NetBeans.
1)Make a new project named Minecraft
2)Drag and drop all the minecraft .java files to Minecraft\src
Viola! you can edit the files in netbeans. You can't run it since it needs the other jars but you can have netbeans superior error catching skill behind you.  smile


http://i45.tinypic.com/28rnqki.jpg

Offline

 

#6 2012-02-02 17:37:39

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

I'll try netbeans, so far I've been using notepad++. It's good for syntax checking in HTML and such, but besides that it isn't really good for much.
It is great to be cross-platform and such, but it really is annoying that file names are case sensitive.

Last edited by 16Skittles (2012-02-02 17:41:18)


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#7 2012-02-02 18:08:32

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Java Official Topic

Java's way too complicated for me :c


Why

Offline

 

#8 2012-02-02 18:09:28

fungirl123
Scratcher
Registered: 2011-10-09
Posts: 1000+

Re: Java Official Topic

RedRocker227 wrote:

Java's way too complicated for me :c

Sames
I just don't get it!


http://www.thebrag.com/wp-content/uploads/2011/06/GroupLove_General1_IMG_9057.jpg

Offline

 

#9 2012-02-02 18:12:56

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Java Official Topic

fungirl123 wrote:

RedRocker227 wrote:

Java's way too complicated for me :c

Sames
I just don't get it!

Well, to be fair, I haven't actually tried it XD But if Stencyl blows my mind, and that's supposed to be the next step up from Scratch, then there's not really much point in even trying to learn Java :l


Why

Offline

 

#10 2012-02-02 18:21:40

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

I suggest trying Java, it is commonly used, and no programming language is easy without good tutorials. Right now, I'm going through the Official Java Tutorials and they seem to be good (duh).

Also, NetBeans is MAGICAL!!! No need to remember those stupid declarations!  lol
But on the other hand, I can't feel like a h4x0r by typing in command line. Oh well, I might as well make a hacking game in Java to really feel like a hacker XD

Edit: Thank you moderator!

Last edited by 16Skittles (2012-02-02 18:43:25)


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#11 2012-02-02 18:52:30

poopo
Scratcher
Registered: 2009-09-20
Posts: 1000+

Re: Java Official Topic

YOU GUYS NEED TO BUY A BOOK!!!!!!!!!! It makes it so much easier. I suggest
Java 24 hours by rogers cadenhead.


http://i45.tinypic.com/28rnqki.jpg

Offline

 

#12 2012-02-02 18:57:56

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Java Official Topic

Get Eclipse. Best IDE hands down.


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#13 2012-02-02 19:08:16

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: Java Official Topic

I prefer Eclipse. MCP has built-in support for it.


~ihaveamac - visit ihaveamac.net

Offline

 

#14 2012-02-02 19:09:58

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

Meh, I think I'll stick with Netbeans for now. Although I must say, Java is much easier and more fun than I thought it would be! In the Java tutorial, I am currently around the if-then and if-then-else part.


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#15 2012-02-02 19:16:12

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: Java Official Topic

16Skittles wrote:

Meh, I think I'll stick with Netbeans for now. Although I must say, Java is much easier and more fun than I thought it would be! In the Java tutorial, I am currently around the if-then and if-then-else part.

Maybe make a mod for Minecraft. Use the Minecraft Coders Pack, and figure out how to use it with Netbeans. It comes with builtin Eclipse support, and I prefer eclipse a lot more. But you can also manually edit the files with any text editor and use recompile/startclient/startserver files that come.


~ihaveamac - visit ihaveamac.net

Offline

 

#16 2012-02-02 19:20:11

poopo
Scratcher
Registered: 2009-09-20
Posts: 1000+

Re: Java Official Topic

ihaveamac wrote:

16Skittles wrote:

Meh, I think I'll stick with Netbeans for now. Although I must say, Java is much easier and more fun than I thought it would be! In the Java tutorial, I am currently around the if-then and if-then-else part.

Maybe make a mod for Minecraft. Use the Minecraft Coders Pack, and figure out how to use it with Netbeans.

Please note my earlier statement.

Anyone want to make a program with me? We can use the java.net team server built into netbeans.  smile


http://i45.tinypic.com/28rnqki.jpg

Offline

 

#17 2012-02-02 19:37:06

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

ihaveamac wrote:

16Skittles wrote:

Meh, I think I'll stick with Netbeans for now. Although I must say, Java is much easier and more fun than I thought it would be! In the Java tutorial, I am currently around the if-then and if-then-else part.

Maybe make a mod for Minecraft. Use the Minecraft Coders Pack, and figure out how to use it with Netbeans. It comes with builtin Eclipse support, and I prefer eclipse a lot more. But you can also manually edit the files with any text editor and use recompile/startclient/startserver files that come.

Lol, I'm not that advanced yet, this is only my first day in Java! I have managed to make a (not really) useful program, basically a bruteforce program that can guess a number (defined in the code, I haven't gotten to input yet) by repeatedly adding one to the variable. It isn't much, but in it I managed to make it probably more complicated than it needs to be by implementing Boolean.
Here's my code:
Instead of this, which will go until it reaches the number only,

Code:

package javasandbox;

public class JavaSandbox {


    public static void main(String[] args) {

        //This java file is specifically for testing random stuff! Delete the remaining code and start fresh!
        
        //This Program will repeatedly try a number until it reaches the predefined number.
 
       int counter = 0;
        boolean correct = false;
       
        while(counter != 45){
        counter = counter + 1;
        
        }
        System.out.println(
                "And the number is... *drumroll*");
        System.out.println(
                counter);
        }
            
    }
}

Code:

//This stuff is just the necessary things to open a file, it is necessary for the compiler, but does virtually nothing to affect the code
package javasandbox;

public class JavaSandbox {

    public static void main(String[] args) {
        //This java app is specifically for testing random stuff! Delete the remaining code and start fresh!
        
        //This Program will repeatedly try a number until it reaches the predefined number.
        
        /**All variables must be declared before we can use them. int counter = 0; declares
        *that counter is an integer and is equal to zero to begin.
        *boolean correct = false; declares that correct is a boolean (has two states, true or
        *false) and begins equal to false.
        */

        int counter = 0;
        boolean correct = false;

       /**The while() statement makes it so that while the boolean correct is false, the
       *within the { } will be executed.
       */

        while(correct == false){
        
        //This statement just adds one to the value of counter

        counter = counter + 1;

       /**This statement is just like the if in Scratch. If the counter equals 45, it will
       *Set the boolean correct to true, completing the while() loop and allowing the code
       *to output the value.
       */

        if (counter == 45){
            correct = true;
        }
        
        }
       //This is simple, it will output "And the number is... *drumroll*" followed by the
       //value of counter
        System.out.println(
                "And the number is... *drumroll*");
        System.out.println(
                counter);
        }
            
    }
}

This code uses a Boolean to check whether or not the number is correct. If you want to see how it works, I added a few extra comments in the bottom one.


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#18 2012-02-02 19:42:01

poopo
Scratcher
Registered: 2009-09-20
Posts: 1000+

Re: Java Official Topic

It will take a while to get to input for command line programs like that.  wink
You have to learn File IO first weirdly enough.


http://i45.tinypic.com/28rnqki.jpg

Offline

 

#19 2012-02-02 19:43:57

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: Java Official Topic

16Skittles wrote:

ihaveamac wrote:

16Skittles wrote:

Meh, I think I'll stick with Netbeans for now. Although I must say, Java is much easier and more fun than I thought it would be! In the Java tutorial, I am currently around the if-then and if-then-else part.

Maybe make a mod for Minecraft. Use the Minecraft Coders Pack, and figure out how to use it with Netbeans. It comes with builtin Eclipse support, and I prefer eclipse a lot more. But you can also manually edit the files with any text editor and use recompile/startclient/startserver files that come.

Lol, I'm not that advanced yet, this is only my first day in Java! I have managed to make a (not really) useful program, basically a bruteforce program that can guess a number (defined in the code, I haven't gotten to input yet) by repeatedly adding one to the variable. It isn't much, but in it I managed to make it probably more complicated than it needs to be by implementing Boolean.

It's pretty easy to do some simple mods. Just use MCP and it deobfuscates it for you. Then you have all these classes like GuiIngame, BlockPiston, etc.


~ihaveamac - visit ihaveamac.net

Offline

 

#20 2012-02-03 08:09:31

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Java Official Topic

LOL so much talk about how that dev env is inferior to this one, and I use NotePad!

Offline

 

#21 2012-02-03 14:15:19

GameHutSoftware
Scratcher
Registered: 2010-04-24
Posts: 1000+

Re: Java Official Topic

poopo wrote:

YOU GUYS NEED TO BUY A BOOK!!!!!!!!!! It makes it so much easier. I suggest
Java 24 hours by rogers cadenhead.

i first learned java from that book


Lurking more than posting, but still here.

Offline

 

#22 2012-02-03 15:11:52

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

maxskywalker wrote:

LOL so much talk about how that dev env is inferior to this one, and I use NotePad!

Lol, if you use notepad, the biggest thing you miss is syntax highlighting and automatic tabbing. Other than that it works just fine, but  especially for someone learning the syntax it is best to use an IDE


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#23 2012-02-03 18:59:43

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

I made my first program of any real use! In Geometry, we are learning about the Fibonacci Sequence and the Golden Ratio, so I made a program to calculate the first 45 Fibonacci numbers! This is the java class file, but I want to embed it in an HTML document. Any tips on how to do this?
Also, the source code can be found Here, it is a .java file, which can be opened in any text editor.


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#24 2012-02-03 19:03:33

Magmawulf
New Scratcher
Registered: 2012-01-14
Posts: 80

Re: Java Official Topic

poopo wrote:

Magmawulf wrote:

@poopo:  Netbeans is great, isn't it?

@All:  I want to get the mcp working with Netbeans though.  sad

Yes.  big_smile

I know how to make it work with NetBeans.
1)Make a new project named Minecraft
2)Drag and drop all the minecraft .java files to Minecraft\src
Viola! you can edit the files in netbeans. You can't run it since it needs the other jars but you can have netbeans superior error catching skill behind you.  smile

So how do I rerun it?

Offline

 

#25 2012-02-03 19:06:01

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Java Official Topic

Magmawulf wrote:

poopo wrote:

Magmawulf wrote:

@poopo:  Netbeans is great, isn't it?

@All:  I want to get the mcp working with Netbeans though.  sad

Yes.  big_smile

I know how to make it work with NetBeans.
1)Make a new project named Minecraft
2)Drag and drop all the minecraft .java files to Minecraft\src
Viola! you can edit the files in netbeans. You can't run it since it needs the other jars but you can have netbeans superior error catching skill behind you.  smile

So how do I rerun it?

I think you would need to copy all of the .java files back into the MCP src directory.


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

Board footer