Results 1 to 5 of 5
  1. #1
    CrazyTofu999 is offline Member
    Join Date
    Jan 2013
    Posts
    5
    Rep Power
    0

    Question class, interface, or enum expected

    So whenever I try to recompile a java file it comes up with the infamous error message:

    "src/minecraft/net/minecraft/src/mod_Block.java:1: class, interface, or enum expected
    Traceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 765, in emit
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
    ^"

    Basically it's expecting a class, interace, or enum. I know that usually this means that a bracket is placed incorrectly, but it looks fine to me. Please if you see what's wrong tell me It would be highly appreciated!!

    Here is the java file:

    package net.minecraft.src;

    import java.util.Random;

    public class mod_Block extends BaseMod
    {
    public static final Block jetBlock = new BlockJet(140,0).setHardness(0.1F).setResistance(5. 0F).setBlockName("asdf").setLightValue(1F);

    public mod_Block()
    {
    ModLoader.registerBlock(jetBlock);
    jetBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/jetBlock.png");
    ModLoader.addName(jetBlock, "WOOHOO");

    ModLoader.addRecipe(new ItemStack(jetBlock, 10), new Object []{
    "**", Character. valueOf('*'), Block.dirt
    });
    }



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

    public void load()
    {

    }
    }

    thanks!
    Last edited by CrazyTofu999; 01-12-2013 at 07:51 PM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default Re: class, interface, or enum expected

    What happens when you try compiling the code using the javac command in a command prompt window?

    How are you compiling it now?


    Please edit your post and wrap the code in code tags. See:
    BB Code List - Java Programming Forum - Learn Java Programming
    Last edited by Norm; 01-12-2013 at 07:58 PM.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    CrazyTofu999 is offline Member
    Join Date
    Jan 2013
    Posts
    5
    Rep Power
    0

    Default Re: class, interface, or enum expected

    I am recompiling using a command in terminal "bash recompile.sh"

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default Re: class, interface, or enum expected

    Sorry, I have no idea what that command does. I use the javac command to compile java programs.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    Wnt2bsleepin is offline Senior Member
    Join Date
    Feb 2012
    Posts
    219
    Rep Power
    3

    Default Re: class, interface, or enum expected

    Quote Originally Posted by CrazyTofu999 View Post
    I am recompiling using a command in terminal "bash recompile.sh"
    You're using MCP? A toolkit that allows you to decompile and make modifications to minecraft.

    Are you using eclipse like it says in the tutorial?

Similar Threads

  1. Replies: 1
    Last Post: 10-03-2012, 09:38 PM
  2. Class Interface or enum expected
    By ankiit in forum New To Java
    Replies: 9
    Last Post: 12-22-2011, 09:10 AM
  3. class interface or enum expected Imports java.io.*; error
    By prathamkool in forum New To Java
    Replies: 2
    Last Post: 10-02-2011, 04:53 PM
  4. Replies: 2
    Last Post: 10-02-2010, 02:13 AM
  5. class, interface or enum expected?
    By Addez in forum New To Java
    Replies: 2
    Last Post: 08-26-2009, 07:54 PM

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
  •