Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Java Noob needs help!

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Java Noob needs help!

    Hello Java Programmers!
    I'm having a bit of trouble with one of my first java scripts! (i am a noob)
    the error i've been getting is "reached end of file while parsing"
    and my script is this Quote

    //Generated using EASYMC. EasyModCreator.tk
    package net.minecraft.src;
    import java.util.Random;
    public class mod_obbypickaxe extends BaseMod
    {

    public void load()
    {

    //This is our to-do list.
    addNames();
    setTextures();
    addRecipes();

    }

    public String getVersion()
    {
    return "V1";
    }

    public void addNames();
    {
    ModLoader.AddName(obbypickaxe, "obbypickaxe ");
    }


    public void setTextures()
    {
    obbypickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "obbypick.png");
    }


    public void addRecipes()
    {
    ModLoader.addRecipe(new ItemStack(obbypick, 1), new Object[] {
    "OOO", " D ", " D ",Character.valueOf('O'), Item.Obsidian, Character.valueOf("D"), Item.Obsidian
    });
    //You can go to the forums and look at my tutorial and the above code will make much more sense!
    }

    public static final Item obbypickaxe = new ItemPickaxe(5555, EnumToolMaterial.EMERALD).setItemName("obbypickaxe ");

    Unquote
    i've looked around and it would seem i needed a } to close it but i have tried to add
    that at the end... which ends up in more errors!

    So thanks in advance to any replys!

    and if anyone has any getting started tips, i will gladly take any advise!

    Thanks for your time
    Justin


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: Java Noob needs help!

    It's a bit hard to tell because the code isn't formatted, but I don't think the curly braces match. Specifically, perhaps there's a } missing at the end (to finish the class definition).

    If you're starting to learn Java I don't think wrestling with autogenerated code is the way to go. Google "java tutorial" to find Oracle's very comprehensive introduction to the language. In a hurry to get to the fun stuff? Don't be! But I'm showing my age... When the finish line comes into sight you do wonder what all the hurry was about.

  3. The Following User Says Thank You to pbrockway2 For This Useful Post:

    antares330 (September 24th, 2012)

  4. #3
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Java Noob needs help!

    When you add the }, what are your errors?
    The reason why you see different (more, but could have been less) errors when you add the } is because the IDE you are using can "see the greater picture" with the braces all in place. From there things could look perfect, or horrible, but different either way.
    The class you posted extends BaseMod, and many other classes are used in this code, do you have all of those classes?

  5. #4
    Junior Member
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Noob needs help!

    Quote Originally Posted by pbrockway2 View Post
    If you're starting to learn Java I don't think wrestling with autogenerated code is the way to go. Google "java tutorial" to find Oracle's very comprehensive introduction to the language. In a hurry to get to the fun stuff? Don't be! But I'm showing my age... When the finish line comes into sight you do wonder what all the hurry was about.
    Good Advise! i guess i will go start that tutorial!

    Thanks to the replys!

Similar Threads

  1. Help im a java noob!
    By jonathanfox in forum Collections and Generics
    Replies: 11
    Last Post: July 26th, 2012, 06:04 AM
  2. >>> Java Noob here <<<
    By Kikiam in forum Member Introductions
    Replies: 2
    Last Post: March 19th, 2012, 09:48 AM
  3. Please help! Noob java user here
    By New Guy_5 in forum Loops & Control Statements
    Replies: 3
    Last Post: November 14th, 2011, 09:44 PM
  4. [SOLVED] Java Noob, Jframe in Applet.
    By rLLZORS in forum AWT / Java Swing
    Replies: 2
    Last Post: May 5th, 2011, 10:42 AM
  5. Need Help with my hmwk! Java noob!
    By ravij in forum Loops & Control Statements
    Replies: 4
    Last Post: October 7th, 2009, 01:02 AM

Tags for this Thread