如何使用命令提示符为minecraft编译java文件,与minecraft分开
所以,我实际上主要用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
minecraft.jar 几乎总是位于
您可以使用的批处理语言中:
但是您可能还想先备份它,复制并重命名minecraft.jar,这样如果出现严重错误,您总是可以更轻松地恢复它。
the minecraft.jar is almost always located in
In batch language you can use:
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.
如果您正在编译 jar,则可以输入 jar 的输出位置:
我相信如果您要创建自己的 jar,这会起作用。这比直接编辑 Minecraft jar 更容易。
If you are compiling the jar, you can type in the location of the output for the jar:
I believe this would work if you were to create your own jar. This would be easier then directly editing the Minecraft jar.