jcommander

java使用ZXing生成二维码,以BASE64编码格式页面显示,微信手机端长按图片保存失败问题解决办法

人盡茶涼 提交于 2020-03-11 19:26:09
使用Google的Zxing包来完成生成二维码图片。 1.maven工程依赖如下 <dependency> <groupId>com.google.zxing</groupId> <artifactId>core</artifactId> <version>3.3.0</version> </dependency> <dependency> <groupId>com.google.zxing</groupId> <artifactId>javase</artifactId> <version>3.3.0</version> </dependency> Zxing版本选择说明:网上查阅资料显示Zxing3.3.0需要jdk1.7支持,更高版本可能需要1.8。 由于我的项目不是maven的,所以我在另外一个maven项目中引入依赖、打包项目、取出jar包如下 core-3.3.0.jar jai-imageio-core-1.3.1.jar javase-3.3.0.jar jcommander-1.48.jar 2.代码部分 因为不想保存图片,所以使用Zxing直接处理为字节数组,然后处理为BASE64编码字符串,交给页面img标签显示。(使用data:image/png;base64) import java.io.ByteArrayOutputStream; import

How to print help using jcommander?

断了今生、忘了曾经 提交于 2019-12-04 10:27:42
问题 How to print help using jcommander? I couldn't find an API for this. 回答1: Find this small snippet to show the application help. Fore simplicity everthing was done in one class. public class JCommanderExample { @Parameter(names = "-debug", description = "Debug mode") private boolean debug = false; @Parameter(names = "--help", help = true) private boolean help = false; public static void main(String[] args) { JCommanderExample jct = new JCommanderExample(); JCommander jCommander = new

How to print help using jcommander?

橙三吉。 提交于 2019-12-03 05:08:51
How to print help using jcommander ? I couldn't find an API for this. Find this small snippet to show the application help. Fore simplicity everthing was done in one class. public class JCommanderExample { @Parameter(names = "-debug", description = "Debug mode") private boolean debug = false; @Parameter(names = "--help", help = true) private boolean help = false; public static void main(String[] args) { JCommanderExample jct = new JCommanderExample(); JCommander jCommander = new JCommander(jct, args); jCommander.setProgramName("JCommanderExample"); if (jct.help) { jCommander.usage(); return; }