How can I convert the commandline:
jar -cf myfile.jar *.class
to java code in Eclipse?
I hava all the classes pathes in the string. I need to generate jar at runtime.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, you can create your command line and run it from java using either
Runtime.getRuntime().exec(cmd)or usingProcessBuilder.Second, jar is just a zip file. You can create it using either
ZipOutputStreamorJarOutputStream