Restart application or reload jar-file(class-files)

hi,
i write an update service for my application!everytime a update is available, the new jar-file(my application) will be downloaded and replace the old, running jar-file! now i want to restart my application to use not a mix of old and new class-files in the vm!
is there any possibility for restarting my java vm or is there another way to "refresh the class-files in the vm"?
thx mseele

Hi,
The easiest way is to terminate the jvm (using System.exit), and just have a loop in the script file that starts your application. In that way your application will be restarted when the jvm exits.
To write a classloader of your own is another, but a lot harder way.
/Kaj

Similar Messages

  • Java.io.File class file

    hi may i know how can i get this java.io.File class file, where can i download it from to use it.

    Nothing..... just a visit from the Deprecation Fairy..... she was a little plastered and removed
    java.io.File by mistake .... :)

  • How to move(migrate) OAF files(class files,PG files) using tool(Kintana)

    Hi,
    How to move(migrate) OAF files(class files,PG files) using tools(Kintana).
    Just want to know process for moving(migrating) OAF Files(class,PG) one instance to over instance(i.e dev to testing) using tools like kintana. We are planning to PVCS as versioning tool.
    Thanks

    New Line Types need to be added to Kintana Workflows and these line types should be able to use the xmlimport/xmlexport scripts.
    We have customized Kintana to migrate forms personalizations using FNDLOAD.
    I think, Change Management team should be able to address this.
    Srini

  • Java - referencing external jar and class files

    When compiling (loadjava) a Java class, how can an externally referenced '.jar file' be resolved please? Using '-resolve' doesn't do the job in this case.
    Many thanks.

    I think I've seen an option for this with manifest files (or was it something that had to do with the java plug-in). There was something about the version and only download a new version if it was newer than the one on your local computer. This version thing is something you define in the manifest file at least. Take a look at jar and manifest files, there might be something there.

  • Jars and .class files - security of the source code

    Hi,
    I have an app that is in a jar file with the .class files (so no source code).
    I'm wondering how difficult it is to attain the source code from these .class files in my jar? Looking through the contents of the .class files it seems there is a large amount of readable text. For example I see method names, variables, etc.
    This leads me to believe these jars are not secure. What is a better way?
    Thanks!
    Edit:
    Looking around, I've noticed many java decompilers and Sun even supports a dissembler - javap. I think this is not cool, haha.
    What way can I protect my code? To me, the value of java just went way down due to the ease at attaining source code (based on what I read in the past hour or so. I have yet to try it myself). I wonder if this impacts companies reasons not to use java?
    Edit 2:
    I heard that there may be a way to make the jar closed, so you can't say, use winrar, to extract the class files. Does anyone know anything about this?
    Message was edited by:
    dayrinni
    Message was edited by:
    dayrinni

    Hi,
    I have an app that is in a jar file with the .class
    files (so no source code).
    I'm wondering how difficult it is to attain the
    source code from these .class files in my jar?
    Looking through the contents of the .class files it
    seems there is a large amount of readable text. For
    example I see method names, variables, etc.
    This leads me to believe these jars are not secure.
    What is a better way?
    Thanks!
    Edit:
    Looking around, I've noticed many java decompilers
    and Sun even supports a dissembler - javap. I think
    this is not cool, haha.
    What way can I protect my code? To me, the value of
    java just went way down due to the ease at attaining
    source code (based on what I read in the past hour or
    so. I have yet to try it myself). I wonder if this
    impacts companies reasons not to use java?All intellectual property stored in electronic form is vulnerable. Not just Java bytecode. You can use tools called obfuscators to make decompiling more difficult, which is usually good enough. The truth is, no matter how great you think your code is, it's of a lot less interest to others than you actually think. Unless you've got a particularly sexy argorithm or something, it's not really worth worrying too much about
    All you can do is make it more difficult for people to crack things, never prevent it. True of all languages, all electronic media

  • Decompile JAR , Update .Class file , Compile?

    Is it possible to decompile a excutable JAR file, update the .class file and compile it again?
    I'm using DJ Decompile software.
    Need your expertise.. =P

    Well, you wouldn't decompile the jar. You'd basically just unpack it, and then you'd decompile the classes inside it, and then you'd update the .java file, and then recompile the source code files and repackage it into a new jar.
    But otherwise, yes.
    There may be a variety of better options though. For example, maybe you could create a single new class that replaces or wraps a single class in the jar, and then create a new manifest file with the Main-Class attribute pointing to your new class. Or with any luck you could get the original source code. Etc.

  • Program File/Class File

    Am trying to get Program File and Class File to
    communication. I get this error message:
    A file found in a source-path must have the same package
    structure as the definitions package “Nproj”.
    Any suggestions? I would so appreciate it.
    The Class File is in the folder “Nproj’.
    Program File:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import Nproj.Product;
    var myProduct = new Product();
    myProduct.setDesc("Teddy Bear");
    trace(myProduct.getDesc());
    ]]>
    </mx:Script>
    </mx:Application>
    Class File:
    package Nproj
    public class Product {
    var desc:String;
    public function Product() {
    public function getDesc():String {
    return desc;
    public function setDesc(myVar:String):void {
    desc = myVar;
    Thanks,
    BudHud

    "BudHud" <[email protected]> wrote in
    message
    news:g9ndhf$knm$[email protected]..
    > Am trying to get Program File and Class File to
    communication. I get this
    > error message:
    >
    > A file found in a source-path must have the same package
    structure as the
    > definitions package ?Nproj?.
    People googling on that text quite often wind up on this page
    of my blog:
    http://flexdiary.blogspot.com/2008/03/importing-packages-in-as3.html
    HTH;
    Amy

  • Cannot acces (a class), bad class file, class file contains wrong class

    Hi,
    I am trying to implement a Java package and I've never done this before. The package is called 'randomX' and I downloaded it from here: http://www.fourmilab.ch/hotbits/source/randomX/randomX.html
    I downloaded the .tar file on my Windows Vista system, unzipped it, and dragged and dropped into(in my case): C:\Program Files\Java\jdk1.6.0_05\src\java\util
    This is also the directory where Random.java is, so I figured it went there, plus the Java Documentation says that, I think.
    The Java Docs are here: http://www.fourmilab.ch/hotbits/source/randomX/doc/
    Thanks in advance,
    Rommel.

    dcminter wrote:
    No. That's not right - you need to put the JAR file into your classpath.
    [http://en.wikipedia.org/wiki/Classpath_(Java)|http://en.wikipedia.org/wiki/Classpath_(Java)]
    If it doesn't come with a JAR file then you'll need to build it first. Sounds like that might be outside your comfort zone.Thanks for the link and the tip. I have no idea what a JAR file is, much less how to build one.
    However, the thing has a "Makefile" file. Can I build the JAR from this?
    #   Makefile for randomX package
    JAVA = /usr/java/jdk1.5.0_06
    CLASSPATH = $(JAVA)/classes:..:.
    SRC = randomX.java randomJava.java randomHotBits.java randomLCG.java \
          randomMCG.java randomLEcuyer.java randomXdemo.java
    CLASS = $(SRC:.java=.class)
    all:     
         javac -classpath ..  *java ; cp -p *class randomX
    test:
         java randomXdemo
    clean:
         rm -f *.bak *.class
         rm -rf doc
         mkdir doc
         rm -rf randomX
         mkdir randomX
    RELEASE = $(SRC) Makefile
    release:
         tar cfvz randomX.tar.gz $(RELEASE)
    html:
         javadoc -classpath $(CLASSPATH) -d doc *.java
    images:
         ( cd $(JAVA)/images ; tar cfv /tmp/ZZimages.tar . )
         rm -rf doc
         mkdir doc
         mkdir doc/images
         (cd doc/images ; tar xfv /tmp/ZZimages.tar )
         rm -f /tmp/ZZimages.tar
         touch randomX.java
    .SUFFIXES:  .java .class

  • (newbie) Question about replacing .class files and web.xml file

    I'm new to servlets and I have two quick questions...
    Do I absolutely need a web.xml file to define all my servlets, or can I simply place .class files into the WEB-INF directory and expect them to run?
    If my application server (for example Tomcat) is running and I replace a servlet .class file, do I need to restart the server for the new .class file to take effect?
    ...or are both of these questions specific to the application server I'm using?

    Hi,
    From an article I read:
    With Tomcat 3.x, by default servlet container was set up to allow invoking a servet through a common mapping under the /servlet/ directory.
    A servlet could be accessed by simply using an url like this one:
    http://[domain]:[port]/[context]/servlet/[servlet full qualified name].
    The mapping was set inside the web application descriptor (web.xml), located under $TOMCAT_HOME/conf.
    With Tomcat 4.x the Jakarta developers have decided to stop allowing this by default. The <servlet-mapping> tag that sets this mapping up, has been commented inside the default web application descriptor (web.xml), located under $CATALINA_HOME/conf:
    <!-- The mapping for the invoker servlet -->
    <!--
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    -->
    A developer can simply map all the servlet inside the web application descriptor of its own web application (that is highly suggested), or simply uncomment that mapping (that is highly discouraged).
    It is important to notice that the /servlet/ isn't part of Servlet 2.3 specifications so there are no guarantee that the container will support that. So, if the developer decides to uncomment that mapping, the application will loose portabiliy.
    And declangallagher, I will use caution in future :-)

  • Parse .class files in runtime - how?

    Hi, I need help :)
    I'm trying to make a Java application that scans all the .class files it can find, looking for my custom annotations, and then parses them into an XML file. I have a class that scans the classpath, finds all .class files, and passes them on to the parser. Now, when I run this project in Eclipse, it works fine - finds all the .class files, filters them and parses them. However, when I convert the app into a runnable JAR, or an EXE file for Windows, it doesn't find anything. Even if the class files are in the directory where the app is, it still doesn't see them. And when I explicitly select a .class file and give it to my classFinder class, I get a ClassNotFound Exception. Here's the code that I use to scan for all .class files and filter them, I suspect that's where the problem is:
    public class ClassFinder {
         private final FilenameFilter classFilter = new FilenameFilter() {
              public boolean accept(File dir, String name) {
                   return name.endsWith(".class");
          * Finds all classes that are in the directories on the classpath. It will
          * find all classes in subdirectories as well. Note that this method will
          * not search for classes that are in jars on the classpath.
          * @return a list of found classes
         public List<Class<?>> findAllClassesOnClasspath() {
              List<Class<?>> classes = new LinkedList<Class<?>>();
              List<String> classNames = listClassNames();
              for (String className : classNames) {
                   className = className.replace(File.separatorChar, '.');
                   className = className.substring(0, className.length() - ".class".length());
                   if (!className.contains("$")) {
                        try {
                             Class<?> clazz = Class.forName(className);
                             if (clazz.getAnnotation(SuiteAnnotation.class) != null) {
                                  classes.add(clazz);
                        } catch (ClassNotFoundException e) {
                             throw new RuntimeException(e);
              return classes;
         private List<String> listClassNames() {
              String classpath = System.getProperty("java.class.path", "");
              StringTokenizer filesTokenizer = new StringTokenizer(classpath, File.pathSeparator);
              List<String> classes = new LinkedList<String>();
              while (filesTokenizer.hasMoreTokens()) {
                   String token = filesTokenizer.nextToken();
                   File classpathElement = new File(token);
                   if (classpathElement.isDirectory()) {
                        String elementPath = classpathElement.getAbsolutePath();
                        List<File> dirs = new LinkedList<File>();
                        dirs.add(classpathElement);
                        dirs.addAll(findSubdirectories(classpathElement));
                        for (File dir : dirs) {
                             String packageName = dir.getAbsolutePath().substring(elementPath.length());
                             if (packageName.startsWith("" + File.separatorChar)) {
                                  packageName = packageName.substring(1);
                             List<String> classesInDir = Arrays.asList(dir.list(classFilter));
                             if (classesInDir == null) {
                                  System.out.println("Root je: " + dir.getName());
                             List<String> fullClassNames = new LinkedList<String>();
                             for (String classInDir : classesInDir) {
                                  fullClassNames.add(packageName + File.separatorChar + classInDir);
                             classes.addAll(fullClassNames);
              return classes;
         private List<File> findSubdirectories(File dir) {
              assert dir.isDirectory();
              List<File> results = new LinkedList<File>();
              List<File> rootFiles = Arrays.asList(dir.listFiles());
              for (File file : rootFiles) {
                   if (file.isDirectory()) {
                        results.add(file);
                        results.addAll(findSubdirectories(file));
              return results;
         public static void main(String[] args) {
              List<Class<?>> classes = new ClassFinder().findAllClassesOnClasspath();
              for (Class<?> clazz : classes) {
                   System.out.println(clazz);
    }Can anyone help? Why does this work if I run it as a project in Eclipse (or in Netbeans, works in both), but not when I run it as a standalone JAR or EXE file in Windows? When run as a project, it returns a list of classes it found, but when run as a runnable JAR, or EXE in Windows, it doesn't find anything. Why?

    I've added this:
    if (className.startsWith(".")) {
         className = className.substring(1);
    }And now I get this:
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: NewTest (wrong name: parser/NewTest)
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
         at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
         at parser.ClassFinder.findAllClassesOnClasspath(ClassFinder.java:54)
         at parser.Parser.getClassNames(Parser.java:51)
         at testresultsparser.ListBean.getWholeListModel(ListBean.java:60)
         at testresultsparser.TestResultsParserView.initComponents(TestResultsParserView.java:142)
         at testresultsparser.TestResultsParserView.<init>(TestResultsParserView.java:33)
         at testresultsparser.TestResultsParserApp.startup(TestResultsParserApp.java:19)
         at org.jdesktop.application.Application$1.run(Application.java:171)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

  • How to convert JSP Compiled class file back to JSP

    Is their any way to convert the JSP converted class file back into JSP file, I have few JSP files missing in my application but i do have class files deployed corresponding to the JSP file. Is their any way where i can convert my JSP class file back to JSP. I tried used decompliers but it conerts the class file into JAVA files, Is their any such decompiler that converts the JSP converted class file into Java files.
    Thanks in Advance.

    nope...its not et al possible...!!!
    You cant convert class file back to JSP....!!

  • RUN the EXE OR JAR, if the file has been dropped to EXE OR JAR

    My requirement is to run my application Executable OR Jar, if the file has been dropped to that executable OR Jar and can show the file name which has been dropped.
    Thanks-
    Ashish Pancholi

    we would like the user to be able to pick a file from native file system and drag & drop it to our application icon and have it uploaded to server
    We have an existing java desktop application which starts, when user click on our application icon (placed on desktop) OR double click on executable(.exe). It opens the frame which allows user to select the file from native file system and uploads it to the server.
    Now we would like to facilitate user, that he can pick a file from windows explorer and drag it to the application icon & drop it on the application icon on the desktop. This would start the uploading of that file on the server.
    We are using JSmooth to build an executable from jar. I would like to know..
    How we can launch the application if user drops local file onto the system icon ?
    How we get the absolute path of file name which has been dropped onto the executable ?

  • J2me can load a .class file (using classLoader)?

    Hi everybody,
    I am developing a J2ME application that can load a .class file on a PDA.
    Recently, I have found that the java.lang.CLASSLOADER is not defined on the J2ME. So, there is no way to use it.
    I am asking if there is any way to load a .class file from another one on a PDA or mobile phone.
    Thanks for your time and interest,

    Use the class Class, that have a forName() method.

  • Run app with Class Files from JBuilder

    Hi,
    I have Java class files (at this point no java source code/files).
    How can I run the application from JBuilder with these class files.

    Thank you Annie.
    I want to run JBuilder in debug mode.
    Basically my application connects to the Sybase db. It will get some data from tables. But when I am running my app in debug mode ... I am hoping that it will show me the data. I dont see any data from the db tables.
    Do I need to setup anything else to see what data it is selecting through JBuilder

  • Creating win 32 exe files from java class files

    Hi I am using windows 2000.
    I have developed a java swing gui application that has about 10 class files. I downloaded the microsoft sdk for java 4.0 for converting all my class files into a single .exe file. I used jexegen in this SDK to do this process. But when I double click the exe file, it just pops up and closes instantenously without showing my startup frame.
    Can anyone help ?

    There is no Microsoft solution for this until you get J#, change your program
    (J# is a little bit different that java but not much, it's closer to Java than C#)
    and then compile to Win32 .exe.
    For the refrence list of all Java to Native code compilers, check this page:
    http://www.geocities.com/marcoschmidt.geo/jcomp.html#native :
    Different from "normal" compilers (like javac or jikes), native compilers do not create bytecode files
    (.class) that are interpreted by a Java Virtual Machine but native executables (like .exe files on
    Windows). "How do I create an EXE from Java?" is a very frequently asked question in newsgroups
    like comp.lang.java.programmer, native compilers are the answer. Some native compilers are listed
    below, check them out.

Maybe you are looking for

  • How do I create a constant in TestStand?

    For example, if the symbolic value for the reverse gear on an automotive bus is 2, then I need a constant, REVERSE, that is accessible from all of the sequences in a file and cannot be changed from 2.  It is not obvious how to do this in the Variable

  • User license

    I installed adobe reader but i can not open the page that i need and show me a message that said "before viewing pdf documents  in this browser you must launch Adobe Reader and accept the end user license agreement then, quit and relaunch the browser

  • Website asking for database login

    </p Hi, I need your help and please help me. I have a report that have been working all this time until IT dept told me to change the database to something else.  I changed the datasource and it is running just fine on my computer.  When I loaded my

  • Impossible d'installer lion sur mac pro

    il m'est impossible d'installer OSX LION sur mon MACPROPour essayé d'installer OSX LION j'ai : - supprimé ma partition RAID0 et créer une partition normale - Installé OSX SNOW LEOPARD + mise à jour 10.6.8 - Lancé l'installation de OXS LION Et la quan

  • Grants for a procedure to create a snapshot

    Hi Forum, I'm struggling with identifiying the necessary system rights to enable a procedure to create a snapshot using execute immediate. Is anybody aware of the grants which have to be assigned to the user owning that proc? Thx for any help, Juerge