大家好, 我想从Java代码中运行以下命令行命令 F:Dev \ Data \ ServerDir \ schema> admin -action runActivity -script 28.0.1234554321 -select"A111111,password3"-用户E0987808 -password apple -key XYZ12847NK. 为此,我编写了此代码
Hi All, I want to run following command line command from a java code F:Dev\Data\ServerDir\schema>admin -action runActivity -script 28.0.1234554321 -select "A111111,password3" -user E0987808 -password apple -key XYZ12847NK. For this i have written this code
import java.io.*; import java.lang.*; public class ProcessBuildDemo { /** * @param args */ public static void main(String[] args) { String b =("admin").concat(" ").concat("-").concat("action").concat(" ").concat("runActivity").concat(" ").concat("-").concat("script").concat(" ").concat("28.0.1234554321").concat(" ").concat("-").concat("selected").concat(" ").concat("\"").concat("A111111").concat(",").concat("password3").concat("\"").concat(" ").concat("-").concat("user").concat(" ").concat("E0987808").concat(" ").concat("-").concat("password").concat(" ").concat("apple").concat(" ").concat("-").concat("key").concat(" ").concat("XYZ12847NK"); //String a = "WindowsApplication1.exe"; //String [] command= {"CMD","/c",a}; String [] command = {"CMD","/c",b}; ProcessBuilder pb= new ProcessBuilder(command); pb.directory(new File("F:\\Dev\\ServerDir\\schema")); try { pb.start(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }每当我运行此代码时,我都会在线程"main" java.lang.NoClassDefFoundError:ProcessBuildDemo/class 中遇到提及异常的异常. 我是Java新手,请帮助我解决此问题.
Whenever I am running this code i am getting an Exception mentioning Exception in thread "main" java.lang.NoClassDefFoundError: ProcessBuildDemo/class I am new in java please help me resolving this issue.
推荐答案首先-在此处检查问题的答案: 从Java执行命令行命令 [ ^ ] 现在到这个问题: -您使用IDE吗? Eclipse和Netbeans是免费的.请使用其中之一. -如何编译代码? 很棒的文章: 3种解决Java中NoClassDefFoundError的方法 [ ^ ] First of all - check the answer to your question here: Executing Command line command from java[^] And now to this Question: - do you use a IDE? Eclipse and Netbeans are free. Please use one of them. - how do you compile your code? great article: 3 ways to resolve NoClassDefFoundError in Java[^]
更多推荐
java.lang.noclassdeffounderror ...
发布评论