嗨,我想使用java从命令提示符运行一些东西
我想转到以下目录C:\Program Files\OpenOffice.org 3\program\
然后运行
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
我试过但我无法做到这一点!
我的代码
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Runtime rt = Runtime.getRuntime();
//Process pr = rt.exec("cmd /c dir");
// Process pr = rt.exec("cmd /c dir");
Process pr = rt.exec(new String[]{"C:\\Program Files\\OpenOffice.org 3\\program\\soffice",
"-headless",
"-accept='socket,host=127.0.0.1,port=8100;urp;'",
"-nofirststartwizard"});
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println(line);
}
int exitVal = pr.waitFor();
System.out.println("Exited with error code "+exitVal);
} catch(Exception e) {
System.out.println(e.toString()); …Run Code Online (Sandbox Code Playgroud) 如果我在main方法中使用省略号会有什么不同吗?
public static void main(String... args) {
}
Run Code Online (Sandbox Code Playgroud) ArrayList valforspinner=new ArrayList();
ArrayAdapter<String> adapter=null;
spinner = (Spinner) findViewById(R.id.Spinner01);
adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, Printers);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
new Thread(new Runnable() {
public void run() {
valforspinner= GetList.List(myPrefs.getString("IP", ""));
adapter.notifyDataSetChanged();
}}).start();
Run Code Online (Sandbox Code Playgroud)
当结果出现在arraylist即值时,旋转器仍然是空的?
我正在使用getent group命令来获取groups用户名linux.但它没有显示任何usernames一段groups我知道存在.
我需要这个信息有没有其他方法?
拿起前两个结果: -
root:x:0:
bin:x:1:bin,daemon
Run Code Online (Sandbox Code Playgroud)
如您所见,组根中没有用户,bin组中没有2个用户.我知道根组包含一个用户root,但它现在在这里显示它.
我想在Android中获取数据时从服务器获取数据并刷新UI.
我该怎么用?AsyncTask或服务或其他什么?
我想要包含函数应返回true,即使以下是大写字母
List<String> pformats= Arrays.asList("odt","ott","oth","odm","sxw","stw","sxg","doc","dot","xml","docx","docm","dotx","dotm","doc","wpd","wps","rtf","txt","csv","sdw","sgl","vor","uot","uof","jtd","jtt","hwp","602","pdb","psw","ods","ots","sxc","stc","xls","xlw","xlt","xlsx","xlsm","xltx","xltm","xlsb","wk1","wks","123","dif","sdc","vor","dbf","slk","uos","pxl","wb2","odp","odg","otp","sxi","sti","ppt","pps","pot","pptx","pptm","potx","potm","sda","sdd","sdp","vor","uop","cgm","bmp","dxf","emf","eps","met","pbm","pct","pcd","pcx","pgm","plt","ppm","psd","ras","sda","sdd","sgf","sgv","svm","tgs","tif","tiff","vor","wmf","xbm","xpm","jpg","jpeg","gif","png","pdf","log");
if(pformats.contains(extension)){
// do stuff
}
Run Code Online (Sandbox Code Playgroud) 我使用以下代码从库中选择一张图片.
Intent intent_gallery = new Intent();
intent_gallery.setType("image/*");
intent_gallery.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent_gallery, 1);
Run Code Online (Sandbox Code Playgroud)
但是,我不需要它来查看选择图片的其他应用程序.我希望它直接打开默认图库,而不是向我展示选择图片的其他应用程序.
嗨,我有一个应用程序,我想从表中选择数据,如果没有找到生成新值并插入数据库,然后再次循环统计检查下一个值,依此类推.对于新请求,这将完成大约十亿次.
我应该使用hibernate还是简单JDBC?
我应该使用hibernate
session.saveOrUpdate(obj);
Run Code Online (Sandbox Code Playgroud)
要么
session.save(obj);
Run Code Online (Sandbox Code Playgroud)
还有一件事我想问的是,对于每个插件,我是否必须初始化我的表类对象(new Mytable)?只设置值会做什么?
喜欢
MyTable obj=new Mytable();
obj.setName("dasd");
obj.set...
obj.save();
Run Code Online (Sandbox Code Playgroud)
或者我可以只初始化一次
`MyTable obj=new Mytable();`
and in a loop put
for(...
obj.setName("dasda");
obj.save
)
Run Code Online (Sandbox Code Playgroud)