runtime « jar « Java I/O Q&A





1. How to load a jar file at runtime    stackoverflow.com

I was asked to build a java system that will have the ability to load new code (expantions) while running. How do I re-load a jar file while my code is ...

2. How to invoke a method at runtime from a jar file    stackoverflow.com

I have multiple jar files at a specific location.Based on some calculation ,i need to load different jar files and invoke a certain method inside the jar. The jar file contains methods ...

3. change a config.properties file in a jar / war file in runtime and hotdeploy the changes?    stackoverflow.com

change a config.properties file in a jar / war file in runtime and hotdeploy the changes ? my requirement is something as follows, we have a "config.properties" in a jar/war file ...

4. Reading content of a JAR file (at runtime)?    stackoverflow.com

I have read the posts: http://stackoverflow.com/questions/320510/viewing-contents-of-a-jar-file
and
http://stackoverflow.com/questions/1429172/list-files-inside-a-jar But I, sadly, couldn't find a good solution to actually read a JAR's content (file by file). Furthermore, could someone give me a hint, ...

5. Downloading JAR files at runtime in Java    stackoverflow.com

I am wondering if it is possible to have a Java desktop application, on startup, look to some URL, to see if it needs an update, and if so download necessary ...

6. Java - How to enter runtime arguments (of main method) by double-clicking a jar file?    stackoverflow.com

I encountered this problem several times. If I pack a Java application in an executable jar file that takes arguments from a user, then the user have to invoke the program ...

7. Swapping a running jar at runtime    stackoverflow.com

I am building an update system in which I need to be able to replace a referenced jar of a running application jar at runtime. I am finding I am running ...

8. NoClassDefFoundError thrown when specifying same jar file at compile and run time    stackoverflow.com

Hi I'm trying to use an external Java package from my own code and keep getting NoClassDefFoundError even though I am using the same class path that I compiled with. For your ...

9. How to make drools drl file access updated jar at runtime    stackoverflow.com

Recently i was working on a drools project where i came across certain issues and i need some help. In my project i access jar at runtime by making use of the ...





10. How to load all classes of a jar file at runtime?    stackoverflow.com

According to this question, it is possible to load a class from a jar file with:

ClassLoader loader = URLClassLoader.newInstance(
    new URL[] { jarFileURL },
    ...

11. Extracting a jar file to a specific path using java runtime    stackoverflow.com

I'm using the following command in runtime to extract a jar to a specific path, but the file is extracted in my class exe path. cmd="cmd /c cd F: && cd ...

12. loading JAR file at run time and then reading it...    coderanch.com

Hi all, This is srudeep. Currently am facing some problems. 1. my project needs a JAR file which contains .class files to be loaded dynamically at runtime. 2. Using the class name which i know, i should search the JAR file loaded for the existance of that class. 3. If that class exists then i should create an instance of that ...

13. Adding JAR file to Classpath at Runtime    coderanch.com

I'd be interested in an example of that because I don't see how to do it. More commonly, create a new URLClassLoader (or a custom subclass) with the new URL in the constructor arguments. Use that loader to load some anchor for your app, and anything from there down (if you do nothing else to break the chain) will have the ...

14. How to load a JAR file dynamically while runtime...    coderanch.com

Hi all, This is srudeep. Currently am facing a couple of problem. 1. my project needs a JAR file which contains .class files to be loaded dynamically at runtime. 2. Using the class name which i know, i should search the JAR file loaded for the existance of that class. 3. If that class exists then i should create an instance ...

15. Runtime.exe() is not working from a jar file    coderanch.com

Hi All, I have a jar file which have classes and a package in it. One of these classes is calling another class which is present in the package. The code i am using it is as follows: Runtime r=Runtime.getRuntime(); Process p=null; p=r.exec("java deep.slideshow.PlayShow"); It is working fine when i am executing it without making jar file. But when i make ...

16. set "classpath" in run time to acees JAR file??    coderanch.com

As you know, from command line, you can do like java -classpath c:\myapp\my.jar;. test to run the application "test" which will access the class in c:\myapp\my.jar But I want to acess any class in a new jar files added to this current directory without stopping the application. I tried to use System.setProperty("java.class.path","....") to update the classpath after I get the jar ...





17. How to execute a jar file at run time    coderanch.com

Hi All, I want to execute a jar file at runtime. I have used the following code. But it throws exception, Can any one tell me how to do that. mycode is -------------- {code} import java.io.File; public class FileExecution { public static void main(String args[]){ try { Runtime runtime = Runtime.getRuntime(); runtime.exec("C:/Documents and Settings/pmr/Desktop/swingcallbackdemoapp.jnlp"); } catch (Exception e) { e.printStackTrace(); } ...

18. Are Jar Files Required at run time    coderanch.com

Hello, I have created a simple web application that sends a email. It worked locally on Tomcat as necessary Jar files were on the classpath. But when i uploaded the same war on the Godaddy server on our hosting domain it failed. My questions are 1. Is it neccessary to include necessary jar file on which my application is dependent in ...

19. Help! Accessing files in a JAR file at Runtime    coderanch.com

Just don't treat resources as files, because when inside a JAR, they aren't files - they are JAR entries (see JarFile and JarEntry). If you only need to read from the "file" use getResourceAsStream instead of trying to use File and FileInputStream. If you need to write to it you're simply out of luck.

20. How to add new jar files to class path dynamically at runtime?    coderanch.com

Not sure this is the right forum for this question, but here goes... I need to develop a web app (Spring MVC, if you must know, but the question is not spring-specific), that will allow a user to upload a JAR file that they have developed. The servlet needs to scan the JAR for compatible classes that implement a specific "plugin" ...

21. Add a jar file to Java load path at run time    coderanch.com

Hi I loaded my file successfully , but when I tried to use the driver to connect to the DB , I get java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver Here is my class import java.net.URL; import java.io.IOException; import java.net.URLClassLoader; import java.net.MalformedURLException; import java.sql.Connection; import java.sql.DriverManager; import java.io.*; public class JarFileLoader1 extends URLClassLoader { public JarFileLoader1 (URL[] urls) { super (urls); } public void addFile (String ...

22. Open a command prompt using Runtime.getRuntime().exec() and run a jar file    coderanch.com

Hi, Can anybody give a hint how I can open a command prompt (in Linux as well as windows) using Runtime.getRuntime().exec() method and run a jar file? The idea is to run another java application from my java application and view the console debugs in the opened command prompt. I was able to open command prompt in ubuntu linux with this. ...

23. create a jar file programmatically using runtime.getruntime??    forums.oracle.com

Probably because the working directory is not where you expect so does not contain the 'classes' directory or the manifest file. You can define the working directory by using the exec() command that has 3 arguments (setting the second to null) or you can use the full paths to the files/directories. If you have no done so then you should certainly ...

24. Add a jar file to Java load path at run time    forums.oracle.com

import java.net.URL; import java.io.IOException; import java.net.URLClassLoader; import java.net.MalformedURLException; import java.sql.Connection; import java.sql.DriverManager; import java.io.*; public class JarFileLoader1 extends URLClassLoader { public JarFileLoader1 (URL[] urls) { super (urls); } public void addFile (String path) throws MalformedURLException { String urlPath = "jar:file://" + path + "!/"; addURL (new URL (urlPath)); } public static void main (String args[]) { try { File f = ...

25. How to execute a jar file at run time    forums.oracle.com

hey, just making sure, are you running this command on a windows box? because you should be using the back slashes between directories. at any rate, try the following and let me know if it does not work: String addr = "C: Documents and Settings\\pmr\\Desktop swingcallbackdemoapp.jnlp"; Process p = Runtime.getRuntime().exec("cmd /c start" + addr ); and now you should also have ...

26. Replacing jar files loaded to class loader at runtime    forums.oracle.com

my application will be responsible for replacing a set of files and folders within a specific location. But there could be a case where the application might need replace the jars in which it resides. I mean at runtime replace the jar in which the invoked class resides. How can this be done? Please help Edited by: akhilachuthan on Mar 25, ...

27. Runtime.exe() is not working from within a jar file.    forums.oracle.com

thanks a lot for your reply friend. I tried the same you tell me to do by using the cmd; java -cp my.jar package.class And then tried to make the jar file with the help of eclipse, after adding my jar file into classpath of my project in eclipse. Its working fine on my local system. But when i put this ...

28. Get the name of the executed jar file at runtime    forums.oracle.com

I could load all jar files from the application directory and seek for a class that implements a main method, but if there are multiple jar files with a main method, or one jar file contains some other classes with a main method, I will get an incorrect answer. It is required to get an exact answer from the method, any ...

29. Dynamic loading jar files at runtime    forums.oracle.com

What i did was created a /plugins/lib dir inside the apps plugin folder. And put all external jars the plugins need in there. And in the manifest of the plugin.jar i put an attribute for class-path to be "lib". Then i got an exception: java.io.FileNotFoundException: C:\Documents and Settings\myuser\theprog\plugins\lib (Access is denied) But that lib actually exist now. Edited by: JAeon on ...

30. how to run a Jar file during runtime    forums.oracle.com

31. Loading Jar files at runtime    forums.oracle.com

JarEntry entry = jis.getNextJarEntry(); int loadedCount = 0, totalCount = 0; while (entry != null) { String name = entry.getName(); if (name.endsWith(".class")) { totalCount++; name = name.substring(0, name.length() - 6); name = name.replace('/', '.'); System.out.print("> " + name); try { loadClass(name); System.out.println("\t- loaded"); loadedCount++; } catch (Throwable e) { System.out.println("\t- not loaded"); System.out.println("\t " + e.getClass().getName() + ": " + e.getMessage()); ...

32. Dynamic jar file inclusion at run time    forums.oracle.com

Hello, I have a java application which should accept the three parameters. 1) The jar file location 2) Particular Class file insdie that jar(we specified the location in step number 1) 3) And method name in that class. My question is how to include specified jar location with jar name to CLASSPATH at run time. So that i can execute a ...

33. Runtime replacing loaded jar file    forums.oracle.com

Hi everyone, I have this problem. I have a client application that launches third parties java applications in its own JVM. In order to reduce launching time of these applications I preload jars using -Djava.ext.dirs parameter. However at runtime, I need to replace some of these jars, without closing the client application. Is it possible? And if it is possible, how ...