Results 1 to 7 of 7
  1. #1
    BatchBat is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Exclamation Java compiling Error

    Hello all,

    While compiling a mod for Minecraft, I get this error:

    Java Code:
     mod_CerealMod.java:4: error: illegal start of expression
    public staticfinal Item CEREAL = (new ItemFood(, 20, 100f, false)).setItemName("CEREAL").setIconIndex(ModLoader.addOverride("/gui/items.png"' "CEREAL.png"));
                                                                                                                                                                                   ^
    mod_CerealMod.java:5: error: illegal start of expression
    public static final Item SPOON = (new ItemSpade(, EnumToolMaterial.WOOD))setIte
    mName("SPOON").setIconIndex(ModLoader.addOverride(gui/items.png", "/SPOON.png"
    ));
                                                                      ^
    2 errors
    This is copied from the javac.exe window that pops up after I run the following batch script:

    Java Code:
     @echo off
    echo Before running, make sure you have Java JDK installed.
    echo.
    echo In addition, make sure you have modified this .bat to compile your .java file.
    echo Continue?
    PAUSE
    REM Insert name of .java file after the =
    set javafile=mod_CerealMod.java
    start C:\PROGRA~1\java\jdk1.7.0_05\bin\javac.exe %javafile%
    PAUSE
    EDIT: No idea why batch file code is now java code... disregard that

    The error is generated from compiling the following .java code:

    Java Code:
     package net.minecraft.src;
    import java.util.Random;
    public class mod_CerealMod extends BaseMod {
    public static final Item CEREAL = (new ItemFood(, 20, 100f, false)).setItemName("CEREAL").setIconIndex(ModLoader.addOverride("/gui/items.png", "/CEREAL.png"));
    public static final Item SPOON = (new ItemSpade(, EnumToolMaterial.WOOD)).setItemName("SPOON").setIconIndex(ModLoader.addOverride("/gui/items.png", "/SPOON.png"));
    
    
    public String getVersion() {
    return "1";}
    public void load() {
    ModLoader.addName(CEREAL, "CEREAL");
    ModLoader.addName(SPOON, "SPOON");
    ModLoader.addRecipe(new ItemStack(mod_CerealMod.CEREAL, 1), new Object[] {"012", "345", "678", Character.valueOf('0'), item.wheat, Character.valueOf('1'), mod_CerealMod.SPOON, Character.valueOf('2'), item.wheat, Character.valueOf('3'), item.wheat, Character.valueOf('4'), Item.bucketMilk, Character.valueOf('5'), item.wheat, Character.valueOf('6'), item.sugar, Character.valueOf('7'), Item.bowlEmpty, Character.valueOf('8'), item.sugar});
    ModLoader.addRecipe(new ItemStack(mod_CerealMod.SPOON, 1), new Object[] {"0 2", "345", " 7 ", Character.valueOf('0'), Block.planks, Character.valueOf('2'), Block.planks, Character.valueOf('3'), Block.planks, Character.valueOf('4'), Block.planks, Character.valueOf('5'), Block.planks, Character.valueOf('7'), item.stick});
    }
    public void GenerateSurface(World world, Random random, int i, int j) {
    
    
    
    
    }private void addSmelting(Block block, ItemStack is) {
    ModLoader.addSmelting(block.blockID, is); }
    private void addSmelting(Item item, ItemStack is) {
    ModLoader.addSmelting(item.shiftedIndex, is); }
    private ItemStack getIS(Item item, int amount) {
    return new ItemStack(item, amount); }
    private ItemStack getIS(Block block, int amount) {
    return new ItemStack(block, amount); }
    }
    TL;DR ME JAVA NO COMPILED D:

    Any help is greatly appreciated, thank you in advance!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Java compiling Error

    Moved from Java Program -> Java JDK

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Java compiling Error

    Learn Java first: The Java™ Tutorials

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    BatchBat is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Default Re: Java compiling Error

    Quote Originally Posted by DarrylBurke View Post
    Learn Java first: The Java™ Tutorials

    db
    The code actually was generated by a program, not by hand. There probably is a faulty generation code. I'll go see if any other program will work.
    You can close this thread if necessary.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Java compiling Error

    By "generated" do you mean decompiled?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    BatchBat is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Default Re: Java compiling Error

    I suppose so...

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 16
    Last Post: 01-11-2012, 03:45 PM
  2. Error while compiling
    By vibaviattigala in forum New To Java
    Replies: 3
    Last Post: 11-30-2010, 03:07 PM
  3. Error compiling java subclass from command prompt
    By littleone in forum New To Java
    Replies: 5
    Last Post: 10-26-2010, 04:45 PM
  4. Java compiling error
    By fadijava in forum New To Java
    Replies: 21
    Last Post: 10-15-2009, 09:55 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •