• Post Reply Bookmark Topic Watch Topic
  • New Topic

jar and URLClassloader problem

Erwin DES
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a program that makes a copy of my program-files (in a folder) from a floppy disk (or CD) to a place on the C-drive.
Then I wanted to start a jar-file to launch my program. The call to this jar-file is functioning only when I execute it directly, but not automatically when calling it in the code after the copy-proces.
I have already figured out that it have to use URLClassloader or something but my code below does not work...
public static Object createObject(String name, String path) throws Exception {
URL classPath = new URL(path);
URLClassLoader classLoader = new URLClassLoader(new URL[]
Class clazz = classLoader.loadClass(name);
return clazz.newInstance();
Can anyone give me a solution to this problem?
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!