如何使用命令提示符为minecraft编译java文件,与minecraft分开

发布于 2024-12-20 14:39:29 字数 1541 浏览 2 评论 0原文

所以,我实际上主要用 python 编码,但我需要用 java 做一件事,并且没有 java 经验,我真的不明白这是如何工作的。

我的程序创建java文件,然后用命令提示符编译它们,并将它们放入minecraft.jar中,但我不太明白需要在命令提示符中编写什么来将类路径设置为minecraft.jar。特别是因为我需要它在每个人的计算机上工作,而且我不知道我的程序(以及 java 文件)在哪里。

有人可以帮我解决这个问题吗?

编辑: 好的,所以我尝试这样做:

javac -classpath %appdata%\.minecraft\bin\minecraft.jar BLOCK1.java 

它给了我这个错误:

LLBLOCK1.java:3: error: cannot find symbol
public class LLBLOCK1 extends Block
                              ^
  symbol: class Block
LLBLOCK1.java:5: error: cannot find symbol
    private World worldObj;
            ^
  symbol:   class World
  location: class LLBLOCK1
LLBLOCK1.java:12: error: cannot find symbol
        public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
                                      ^
  symbol:   class World
  location: class LLBLOCK1
LLBLOCK1.java:12: error: cannot find symbol
        public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
                                                                        ^
  symbol:   class EntityPlayer
  location: class LLBLOCK1
LLBLOCK1.java:9: error: cannot find symbol
        super(i, j, Material.wood);
                    ^
  symbol:   variable Material
  location: class LLBLOCK1
LLBLOCK1.java:14: error: package Block does not exist
world.setBlockWithNotify(i + 0, j + 0, k + 0, Block.stone.blockID);
                                                   ^
6 errors

我写的类路径错误吗?

So, I'm actually coding primarily in python, but I need to do one thing in java, and having no java experience, I'm really not understanding how this works.

My program creates java files, then compiles them with command prompt, and puts them into the minecraft.jar, but I don't really understand what I need to write in command prompt to set the classpath to the minecraft.jar. Especially because I need this to work on everyone's computer, and I won't know where my program (and thus the java files) are.

Could anyone give me a hand with this?

Edit:
Okay, so I tried doing this:

javac -classpath %appdata%\.minecraft\bin\minecraft.jar BLOCK1.java 

And it gives me this error:

LLBLOCK1.java:3: error: cannot find symbol
public class LLBLOCK1 extends Block
                              ^
  symbol: class Block
LLBLOCK1.java:5: error: cannot find symbol
    private World worldObj;
            ^
  symbol:   class World
  location: class LLBLOCK1
LLBLOCK1.java:12: error: cannot find symbol
        public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
                                      ^
  symbol:   class World
  location: class LLBLOCK1
LLBLOCK1.java:12: error: cannot find symbol
        public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
                                                                        ^
  symbol:   class EntityPlayer
  location: class LLBLOCK1
LLBLOCK1.java:9: error: cannot find symbol
        super(i, j, Material.wood);
                    ^
  symbol:   variable Material
  location: class LLBLOCK1
LLBLOCK1.java:14: error: package Block does not exist
world.setBlockWithNotify(i + 0, j + 0, k + 0, Block.stone.blockID);
                                                   ^
6 errors

Am I writing the classpath wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愛上了 2024-12-27 14:39:29

minecraft.jar 几乎总是位于

C:\Users\User_Name\AppData\Roaming\.minecraft\minecraft.jar

您可以使用的批处理语言中:

%appdata%/.minecraft/minecraft.jar

但是您可能还想先备份它,复制并重命名minecraft.jar,这样如果出现严重错误,您总是可以更轻松地恢复它。

the minecraft.jar is almost always located in

C:\Users\User_Name\AppData\Roaming\.minecraft\minecraft.jar

In batch language you can use:

%appdata%/.minecraft/minecraft.jar

However you may want to also back it up first, copy and rename the minecraft.jar so if anything goes horibly wrong you can always restore it easier.

夏九 2024-12-27 14:39:29

如果您正在编译 jar,则可以输入 jar 的输出位置:

-jar cvfm c:/users/matt/documents/Minecraft.jar manifest.txt *.class

我相信如果您要创建自己的 jar,这会起作用。这比直接编辑 Minecraft jar 更容易。

If you are compiling the jar, you can type in the location of the output for the jar:

-jar cvfm c:/users/matt/documents/Minecraft.jar manifest.txt *.class

I believe this would work if you were to create your own jar. This would be easier then directly editing the Minecraft jar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文