Java running old class file

When I make a change to a Swing program and compile, it runs the old version, as if the changes were never made. Any ideas?
I make a new directory and copy the java file, re-compile and it works...but I don't want to have to do that every time.
Dan

If you have like
class1.java
class2.java
class3.java
class1.class
class2.class
class3.class
then make changes to class1.java and class2.java, then run javac class1.java, it will see that class2.class exists so it won't bother to recompile class2.java, either delete all the classes or do javac *.java
Shish

Similar Messages

  • How to run a class file in MAC os, compiled in XP.

    Hi all,
    i am compiling a java program in windows using JDK 1.5 and i am copying this file to MAC os (Panther). In Mac i am running this class file using JDK 1.4.i am getting the following exception,
    Exception in thread "main" java.lang.UnsupportedClassversion error.
    This is understandable, but is there any solution for this ...
    Any one experienced the same problem ...
    If any one comes up with a solution to solve this, plz let me know...
    Thanks in advance......

    You are compiling it in 1.5 and expecting 1.4 to run it?
    You have two options: compile it at the 1.4 level or upgrade your Mac to 1.5

  • How to clear old class files cached in JVM

    JVM stores old class files in its cache even after the corresponding files have been deleted from the database. This causes a conflict if a new file is saved with the same name as one that was deleted earlier causing old data to be fetched and not the new one.
    am using the following line of code to load the class file :
    Class.forName(className, false, this.getClass().getClassLoader())
    please help
    Thanks - N

    Why are you trying to do that?
    Dynamic Classloading(reloading) has a meaing only on "application container" like WAS.
    Not appropriate for normal applcation.
    Focus on enhancing your application logic and algorithm rather than wasting your brain on difficult and meaningless things. Applying some flexible design patterns wouldn't suffice?
    Anyway, Sun provides wonderful and simple custom classloader sample.
    http://java.sun.com/developer/onlineTraining/Security/Fundamentals/magercises/ClassLoader/help.html
    Anayzing tomcat source(which is downloadable) is another approach.
    Edited by: Dion_Cho on Nov 26, 2007 5:18 PM
    Typo...

  • Compiling on a dual core machine and running the class files on linux.

    does compiling on a dual core machine and running the class files on linux have any effect?

    well, the problem that i felt was that when i runmy
    class files on my machine(windows xp, dual core),
    Thread.sleep(60000) sleeps for 1 minute. but wheni
    run it on a linux machine, Thread.sleep(60000)sleeps
    for 2 minutes. my application has a lot ofthreads.
    I can't be 100% sure, but I'm pretty sure that
    sleep(60000) doesn't sleep for 2 minutes on the other
    machine.I, wholeheartedly, agree.
    Due to timing issues it may seem to sleep a few milliseconds more, but not double.
    Of course, if there is a "real-time" (or even simply higher than the Java app) priority program running that is using a lot of the CPU it may seem like it sleeps a lot longer than 60000, but that is a different issue.

  • Tomcat Web-server uses old .class files

    Hi Friends,
    My Tomcat webserver uses old .class files. The problem persists even if I delete old class files. The new ones are formed but then if i again recompile, the new-old ones are used :)
    Am I doing something wrong????
    Please suggest!!

    I have experienced this problem before as well. Tomcat seems to cache compiled class files for better speed. To get Tomcat to reload class files that I've recently recompiled here is what I do:
    1. Go into the Tomcat server administration area (http://localhost/admin)
    2. Choose the context that is using the classes that you want to reload (from Service / Host)
    3. Make sure reloadable is set to true
    3. Click save, and then commit changes
    Hope this helps, but if there is a better way to get Tomcat to use the most recent class files I would love to hear it!

  • Running the .class file from java code

    I'm doing a kind of providing service like compiling and running Java code on server side and giving output to the end user.
    Please suggest me an approach with code to run .class file from the Java code.
    import java.io.*;
    public class demo {
    public static void main(String args[]) throws IOException, InterruptedException {
    int result;
    try {
    System.out.println("command output:");
    Process proc = Runtime.getRuntime().exec("java -cp . demoh");
    InputStream in = proc.getInputStream();
    result = proc.waitFor();
    BufferedInputStream buffer = new BufferedInputStream(proc.getInputStream());
    BufferedReader commandOutput = new BufferedReader(new InputStreamReader(buffer));
    String line = null;
    System.out.print(commandOutput);
    try {
    while ((line = commandOutput.readLine()) != null) {
    System.out.print(line);
    System.out.println("command output: " + line);
    }//end while
    commandOutput.close();
    } catch (IOException e) {
    //log and/or handle it
    }//end catc
    } catch (IOException e) {
    System.err.println("IOException raised: " + e.getMessage());
    }

    What happened when you tried what you have there?

  • Unable to run a .class file w/ javaw

    I created a simple application which uses swing gui.
    This application works just fine when I click the "run" button in eclipse.
    But as soon as i copy the .class file from the eclipse project folder to somewhere else and try to run it with "javaw myclass" (the filename is myclass.class) nothing happens.
    No command not found error, no nothing.
    Its like javaw finds and executes the .class and then returns to the command prompt... But I dont see any windows or any sign of my program running.
    Thx in advance

    When run with just java I get this:
    C:\>java myclass
    Exception in thread "main" java.lang.NoClassDefFoundError: myclass$1
    at myclass.<init>(myclass.java:38)
    at myclass.<init>(myclass.java:28)
    But I Eclipse it works just fine...
    What does Eclipse do that I dont?

  • Java wont open .class file

    ok i just started at this and found this web site http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html#1
    i copyed exactly what he says to copy:
    * The HelloWorldApp class implements an application that
    * displays "Hello World!" to the standard output.
    public class HelloWorldApp {
    public static void main(String[] args) {
    // Display "Hello World!"
    System.out.println("Hello World!");
    then put all that in notepad save it as "HelloWorldApp.java". i go to the msdos prompt type in javac HelloWorldApp.java it turns it in to a .class file and i type it
    java HelloWorldApp and it gives me an error:
    Exception in thread "main" java.lang.NoClassDefFoundError: helloworldapp (wrong
    name: HelloWorldApp)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    What did I/He do wrong.

    thanks it worked. can you tell my why?

  • Can i generate java API from class files

    I have only class files. Is it possible to generate the java API using the javadoc.If yes, pls tell me how can i do??

    Also, Javadoc 1.4.2 will contain an unsupported option -Xclasses
    that should allow you to do this. You must pass in class names
    and use -classpath to find them. For com.package.MyClass
    at /home/classes/com/package/MyClass.class,
    you would run:
    javadoc -Xclasses -classpath /home/classes com.package.MyClass
    For mroe info, see:
    http://developer.java.sun.com/developer/bugParade/bugs/4720100.html-
    Doug Kramer
    Javadoc team

  • Problem running my class file

    i'm using os x and when i compile my HelloWorld.java i have no errors and it creates the HelloWorld.class file in the same directory. now if i try to run the program from the terminal by typing in
    java HelloWorld it works file, but if i try to send the HelloWorld.class file to any other machine or even open it not using the terminal(finding the file and double clicking it) it won't run.
    Any idea how to make this program stand alone like i would want??
    Thanks

    alright i'll look it up, the little i've done with
    java on windows with textpad i thought i was creating
    a .class that executed from the ms-dos window but
    perhaps something else the compiler did behind the
    scenes to make it executable?Nope.
    java HelloWorldYou're running java.exe. It's taking HelloWorld as its argument, finding the class called HelloWorld.class, taking it as input, and executing its main method through the JVM.
    It's exactly the same thing as if you type Notepad somefile.txt or javac SomeFile.javaThe first word is the .exe or .bat that's running, and the next word is an argument that the program interprets as a file to use as its input.

  • My server still taking old class file

    Hi,
    I have got a J2EE application.
    In that I have to modify a Java file.
    I made the required changes and check it in the local test environment and find that it is working fine and the changes are reflecting in my application.
    Then I copied the class file in the main server and deploy the server(i m using oracle9i server) .
    After successful depletion ''THE CHANGES WERE NOT REFLECTED IN THE APPLICATION ".
    I found the latest class file is copied in the application(checked the class file using D-Complier).
    MY PROBLEM IS : WHY THE SERVER IS NOT TAKING THE LATEST CLASS FILE ??
    IS THERE ANY PROBLEM OF WEB-CACHING ??
    kindly advise how can i rectify it.
    keep smiling.....
    Debasis

    The last response is correct. You have to stop the server and start it again to reflect the changes in the class file. Only the JSP files can be changed dynamically while server is running as the container compiles it if there is any change in the file. All other files need a server restart.
    Thanks

  • How to run a class file from windows ?

    hi, i have created a shorcut to run my java application from my windows desktop, but i have the error message "Couldn't find the main class, programm will exit",
    the shortcut is as follow
    [%windir%\System32\javaw.exe C:\ProgramFiles\\Main]
    thanks for you help,

    Im new to running java from a shortcut but this may help. I hope this helps.
    this is the command you ned to write and refer to my example;
    javaw.exe -cp <path to class file> packageName.className
    This is an example of wat i have typed to run my program from a shortcut;
    C:\JBuilder3\java\bin\javaw.exe -cp C:\jbuilder3\myclasses\welcome.jar welcome.welcome
    Hope this helps
    good luck!!!
    Matx3001

  • Java Concurrent Program .class file location

    Hi frnds,
    I need to know the .class file location of a java concurrent prog. I know the filename from concurrent program executables and my concurrent program filepath is oracle.apps.xxogl.f04.cp.file. But I dont know where the exact location of the file is. pls help me.
    I searched for the same and found the following article in many places which doesnt seem to help me much.
    http://geektalkin.blogspot.com/2008/03/oracle-apps-java-concurrent-program.html
    pls help. thanks in advance.
    Lisan

    Hi;
    pls file can be found like
    /apps_st/appl/bom/12.0.0/patch/115/sql/
    Contains SQL*Plus scripts used to upgrade data, and .pkh, .pkb, and .pls scripts to create PL /SQL stored procedures.
    Regard
    Helios

  • Identify Java version from CLASS file

    Hi,
    I have a .class file. I would like to identify the Java version from that.
    Is there a way to find out?
    Also, is there a way to find out the Java version from JAR file?
    Thanks.

    Kavipriya wrote:
    I have a .class file. I would like to identify the Java version from that.
    Is there a way to find out?Sure, there's the major version number (48, 49, 50) included in the class files. Look for the class file specification, shouldn't be too hard to find.

  • Java version for class file

    i have some class files, and i need to know what Java compiler used to compiled that class file (only care for the version number...like 1.4.2, 1.5.0, 1.1.0, etc)
    any one know how i can get this info? or any good google keywords?

    thanx, since now i know how the class file bytes are set up..i guess i can get the version number by looking at the hex.
    tedious (but not that tedious)...thought there be a simplier way...oh well..
    thanx again

Maybe you are looking for

  • Portal Runtime Error - java.lang.NullPointerException in Role Permissions

    Hello All: I am getting a runtime error while trying to bring up permissions for copies of SAP delivered roles. Any help much appreciated. ================= [EXCEPTION] #1#com.sapportals.portal.prt.component.PortalComponentException: Error in service

  • Can ADF keep multiple pages open at the same time?

    My company is currently developing an application to upgrade a client's FORMS system to one based on ADF. One of our client's biggest complaints with the new technology is that he can't work on many tasks at the same time, because our application can

  • Instalation problems

    hi, i hope i get help in these forums, i have a msi tvanywhere plus,but when i try to install the driver instalation fails. i have donde this. I have changed the card to another pci slot, i have tried both drivers(cd,and the online drivers). i havere

  • File opens in html editor automatically

    Hi Guys, maybe one of you came across the same problem before and knows a trick how to solve it: I want to edit several html files stored in the KM but for some reason some of them are opened automatically in the html editor. I do not even get the se

  • Workflow based on role

    Hi all, Please let me know, how to create a workflow based on specific Roles. I know it's a bit silly query, but i have got struck here. Thanks, Shash