Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Dynamically running a .class file in the same project or .jar

$
0
0
Here's a link of what I'm trying to do. You can say that I'm trying to do a simple IDE

I made a new thread because I'm now encountering new problems..

As I've read from searching about this topic. One way to do this is
Process process = Runtime.getRuntime().exec("java -cp Project.jar helloworld");


My question is, which java does .exec uses and is there a way to do this without defining the directory?
I mean, let's say I have the .class files inside .jar located at the resources directory.
Can I do it something like this..
Process process = Runtime.getRuntime().exec("java -cp Project.jar src\Project\resources\helloworld");


Or is there a better way to do this?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>