Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reconstruction of java command line arguments

Is there a way to reconstruct the command line arguments passed to Java within a Java program, including the JVM options and classpath option?

I have a Java program that needs to restart the JVM and manipulate its bootclasspath (i.e. trying to override some system classes). I use the libc system method to invoke the new JVM.

I'm open for better approaches, but Java agents isn't an option.

like image 317
notnoop Avatar asked Nov 26 '22 19:11

notnoop


1 Answers

Why not use a file that has these properties just like the Eclipse ini file and NetBeans conf files. That way you just read these properties and spawn the new Java process with these properties.

Back to your question, this previous answer should do

like image 94
n002213f Avatar answered Nov 28 '22 11:11

n002213f