我以这种方式创建了一个JAR文件jar cf jar-file input-files.现在,我正试图运行它.运行它不起作用(找不到jre命令):
jre -cp app.jar MainClass
Run Code Online (Sandbox Code Playgroud)
这也不起作用:
java -jar main.jar
Run Code Online (Sandbox Code Playgroud)
(无法从main.jar加载Main-Class清单属性).
我也发现了这一点
运行打包为JAR文件的应用程序(版本1.2 - 需要Main-Class清单标头)
什么是"Main-Class清单标题"?我该如何创建它以及在哪里放置它?
在我的Android应用程序中,我必须使用相机按钮click.It工作完美的所有Android版本除了安卓7(牛轧糖).当我点击相机选项,即使权限打开,应用程序即将退出.我认为问题出在相机调用intent.Below是我的代码.
camera = (ImageView) dialog.findViewById(R.id.camera);
camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickCamera();
dialog.dismiss();
}
});
private void clickCamera() { // 1 for icon and 2 for attachment
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this, new String[] { Manifest.permission.CAMERA }, MY_REQUEST_CODE);
} else {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, MY_REQUEST_CODE_STORAGE);
} else {
currentImageUri = getImageFileUri();
Intent intentPicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intentPicture.putExtra(MediaStore.EXTRA_OUTPUT, currentImageUri); // set the image file name
// start …Run Code Online (Sandbox Code Playgroud) bash案例:
第4行:意外令牌附近的语法错误`)'
我正在尝试case在Bash中使用该命令(再次在我的Raspberry Pi上),但是当我运行我的脚本时,Bash会发出错误.我已经阅读了很多教程,我认为我做的与他们一样,但有些事情是不对的.
这是我的代码:
#!/bin/bash
case "$1" in
help) echo "You asked for help. Sorry, I'm busy."
*) echo "You didn't say anything. Try 'help' as the first argument."
esac
Run Code Online (Sandbox Code Playgroud)
这是输出(文件名是newmkdir,我运行它没有参数):
./newmkdir: line 4: syntax error near unexpected token `)'
./newmkdir: line 4: ` *) echo "You didn't say anything. Try 'help' as the first argument."'
Run Code Online (Sandbox Code Playgroud)
我正在尝试让我的脚本解释help,然后在下一行输出任何其他内容.
(注意这只是一个glitched脚本的例子.这个脚本没有任何意义,甚至可能没有意义,它只是一个测试.)
我一直在从一本电子书中学习 Python。现在我正在学习这个Tkinter模块
这本书建议运行以下代码。但是,它不能正常工作。任何想法为什么?
from Tkinter import *
window = Tk()
window.geometry("200x200")
my_frame = Frame()
my_frame.pack
button1 = Button(my_frame, text = "I am at (100x150)")
button1.place(x=100, y=150)
button2 = Button(my_frame, text = "I am at (0 x 0)")
button2.place(x=0, y=0, width=100, height=50)
window.mainloop()
Run Code Online (Sandbox Code Playgroud)
我应该得到什么:

我得到的:

添加button1.pack()and 后button2.pack(),我得到了这个:
