Jar file is not cached

Hi,
I have a problem in caching the jar file. When the browser was closed and then open again, it tries to load the jar file from the web server again. It seems the jar file is never cached in the Java-Plug in. Here is the code for the page:
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width=80% height=70% hspace="10" vspace="10" align="middle"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab"
standby="Please wait...">
<PARAM name="type" value="application/x-java-applet">
<PARAM name="codebase" value="/">
<PARAM name="cache_archive" value="w1.jar">
<PARAM name="cache_option" value="Plugin">
<PARAM name="code" value="Proteus.class">Web Motion Control Applet</OBJECT>
Any idea?
Thanks for the help!

Have the same nasty issue here - beginning with 1.4.2 we see that the java plug-in add
Cache-Control: no-cache
Pragma: no-cache
to the HTTP request when downloading the JAR file (also happen when JAR is already in local plug-in cache). Therefore the web server always sends a HTTP 200 with full content instead of a lightweight HTTP 304 Not Modified.
See also: Bug: 4837340 comment from mwwsun
Is there a way to disable the explicit "no-cache" request?
Keep the byte.
C�dric

Similar Messages

  • Jar file is not being creating

    Dear Members,
    My problem is that: I am using a serialized class in my project.( i.e. I created another project, I made up a serialized class in this this project And I compiled this project. Later I added this project to my actual/first project' s library folder for using this seralized class.) After I disposed my actual project. I builded it for creating a jar file. But any jar file is not falling out (I am using NetBeans) Could you help me please to solve this problem?
    Thank you for taking the time...
    Regards,

    Dear Members,
    My problem is that: I am using a serialized class in my project.( i.e. I created another project, I made up a serialized class in this this project And I compiled this project. Later I added this project to my actual/first project' s library folder for using this seralized class.) After I disposed my actual project. I builded it for creating a jar file. But any jar file is not falling out (I am using NetBeans) Could you help me please to solve this problem?
    Thank you for taking the time...
    Regards,

  • JAR file does not get uploaded to client for my SERVLET generated APPLET

    Some help please...
    I have a servlet that generates the HTML code that contains an APPLET. This APPLET needs a JAR file that is listed under its ARCHIVE property. The SERVLET is in a JAR file that is in the same directory as the other needed JAR file. If I create a static HTML with the output of the SERVLET it works fine. But if go through Weblogic the needed JAR file does not get uploaded to the client so I get a java.lang.NoClassDefFoundError:and my APPLET does not load.
    Q1: I am not sure what to put under the CODEBASE tag. I tried "." and I also tried "http://mymachine" but both did not work. I also tried without the CODEBASE tag. No luck. The SERVLET is bound to http://mymachine/servlet.
    Q2: Does anyone have any suggestions on how to do this? Is there a way to force the browser to upload a certain JAR file?
    Thanks...

    It works!!
    This is what I did:
    The jar file in question was the weblogic.jar. I tried putting it under the lib directory of my war file but I had problems because the weblogic.jar contains other war files inside so when I tried to deploy my war file it also tried to deploy the inner war files which for some reason did not work. So I tried removing the war files from the weblogic.jar and this time I had no problems deploying my war file but I still could not find the classes I needed. So I tried moving the weblogic.jar to the root dir of my war file and it worked!! Now the trick here was: I did not set the CODEBASE AND I had the ARCHIVE paramenter set in TWO places like below:
    <APPLET CODE = "marketmap.client.MarketMapApplet"
    ARCHIVE = "weblogic.jar"
    WIDTH = "657"
    HEIGHT = "382"
    ALIGN = "BOTTOM"
    ALT = "APPLET tag not recognized">
    </XMP>
    <PARAM NAME = CODE VALUE = "MyApplet" >
    <PARAM NAME = "type" VALUE="application/x-java-applet;version=1.2.2">
    <PARAM NAME = "scriptable" VALUE="false">
    <PARAM NAME = ARCHIVE VALUE="weblogic.jar">
    </APPLET>
    Actually if you do not place a parameter named ARCHIVE (at the end) it wil NOT work. I tried with multiple jar files listed and it works great too.
    Anyway I figure I'd share. Thanks for the help too.
    Lastly for people who choose not to upload the jar files to clients, you should look at the bea documentation on applets. It lists a classpath servlet that allows you to provide classes to the clients without having to force them to download the jar file.

  • The Apache axis2 jar files are not taking at run time

    While running the application I was getting the following errors. The error is getting at run time only. It has compiled successfully.
    It ran under eclipse without any issues. But with Apache axis we are getting following error trace while uploading to server. The Apache axis2 jar files are not taking at run time.But compiling successfully.
    The application is running under Oracle R12 server.I didn't find any option to set class path for run time in R12 server.
    Using Java version is 1.6 and Apache axis2.1.6.2
    Error trace:
    Exception :java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis2.description.AxisService
    Error : java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis2.description.AxisService
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.populateAxisService(RightNowSyncServiceStub.java:41)
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.(RightNowSyncServiceStub.java:636)
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.(RightNowSyncServiceStub.java:625)
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.(RightNowSyncServiceStub.java:673)
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.(RightNowSyncServiceStub.java:665)
    com.rightnow.ws.util.ContactUtils.initializeService(ContactUtils.java:57)
    somejsp.jspService(_somejsp.java:189)
    com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:473)
    oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
    oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
    oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
    com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
    oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
    com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:642)
    com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
    com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)
    com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
    com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
    com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
    oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    java.lang.Thread.run(Thread.java:619)

    Hello,
    I too am trying to use Axis2 application in R12. But getting the following error:
    java.lang.classCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SoapMessageFactory1_1Impl cannot be cast to oracle.webservices.soap.VersionedMessageFactory
    If I run the application standalone from java command line it works fine. I think the error could be because of some oracle app jars getting picked up inatead of my application jars. How to make sure that my application jars get picked up instead of oracle jars
    I tried loading my jar file and then setting it as contextClassLoader using "Thread.currentThread().setContextClassLoader", but this did not help.
    Can you please let me know what can be tried to fix this
    Thanks
    Srikanth

  • How to load .jar files when not specified in the .jnlp file

    Hello,
    We are deploying an application with JWS but due to the nature of this app, we need to download additional jar file only when the user has been authenticated. The jar file(s) we need to download can hardly be predicted (in term of name) and thus cannot be all listed as lazzy resource in the .jnlp file.
    However, we would like to take advantage of the various JWS features relateed to .jar download and cache and would prefer not to reinvent the wheel by implementing our on stuff (i.e. URLClassLoader with caching etc.).
    Any idea, suggestion?
    Thanks in advance.
    Fred.

    How about writing a second jnlp file with the optional jar listed in it and running it only if your user is authenticated?

  • Icons in JAR file did not appear on runing web form

    Hi
    I am testing web application built using Forms6i with path 9. I configured the form server to run as a servlet and I put all the icons used in the application in JAR file I name it ICONS.JAR, I put this file in \FORMS60\JAVA\ directory.
    I made the following configurations:
    In Apache listner configuration file httpd.conf :
    Alias /forms60java/ "D:\orant\forms60\java\/"
    In forms confuguration file formsweb.cfg:
    imageBase=CodeBase
    archive=icons.jar
    serverApp=Default
    in registry.dat file:
    default.icons.iconpath=
    default.icons.iconextension=gif
    In base HTML file:
    <PARAM NAME="imageBase" VALUE="%imageBase%">
    <PARAM NAME="serverApp" VALUE="%serverApp%">
    <PARAM NAME="CODEBASE" VALUE="/forms60java/"
    The forms are run with nao problem except that the icons do not appear. I see java console on the client machine, and I see that ICONS.JAR was downloaded and saved in jar cache.
    In Apache access log file I see that there is an attempt to load the icons from the path <server_name>/forms60java/icon_name.gif but not from the archived JAR file.
    What could be goes wrong or missing?

    Hi Amin,
    Maybe the icons.jar file doesn't contain the files (try opening it with WinZip or some other tool and verify the files are indeed there).
    Maybe some case sensitivity issues are at play?
    Or the GIF files are the wrong size so maybe you're only seeing the transparent upper left corner of alle the icons displayed on your iconic buttons or whatever.
    Just a couple of wild shots (cause it doesn't appear you're having errors - but check all your log files including error_log)
    Regards,
    Jesper

  • Pre-Deploy JAR files to JRE Cache in Windows

    We are looking to build an SMS installer to pre-deploy all controls for our application to our end-users desktops. The application is Siebel.
    Several of the controls are in JAR files and we want to pre-deploy these into the Java Cache via the SMS installer, as we block all control downloads from websites (both internal and external) including JAR as a matter of security policy.
    The JAR files look like they should go to
    C:\Documents and Settings\WindowsUserName\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\jar
    but there appears to be associated files that we can't create.
    How can we do this? Any guidance appreciated.
    We are currently using JRE 1_4_2_06.

    Hi Julien,
    Thanks for your reply.
    We imported the the specified SCAs in our track.
    we are getting the following errors.
    Kind Status Priority Description Resource In Folder Location
    Error The import com.sap.xss.per cannot be resolved CcPerAddressInterface.java NS1_XSSTR_Dessusaddrsap.com/gen_wdp/packages/com/sap/xss/hr/per/us/address/cc line 18
    Error com.sap.pcuigp cannot be resolved (or is not a valid type) for the argument fpm of the method loadConfiguration CcPerAddressInterface.java NS1_XSSTR_Dessusaddrsap.com/gen_wdp/packages/com/sap/xss/hr/per/us/address/cc line 113
    Error com.sap.pcuigp cannot be resolved (or is not a valid return type) for the method getNextPerspective CcPerAddressInterface.java NS1_XSSTR_Dessusaddrsap.com/gen_wdp/packages/com/sap/xss/hr/per/us/address/cc line 127
    Error com.sap.pcuigp cannot be resolved (or is not a valid type) for the argument currentPerspective of the method getNextPerspective CcPerAddressInterface.java NS1_XSSTR_Dessusaddrsap.com/gen_wdp/packages/com/sap/xss/hr/per/us/address/cc line 127
    Error com.sap.pcuigp cannot be resolved (or is not a valid return type) for the method getCAPState CcPerAddressInterface.java NS1_XSSTR_Dessusaddrsap.com/gen_wdp/packages/com/sap/xss/hr/per/us/address/cc line 137
    Error com.sap.pcuigp cannot be resolved (or is not a valid type) for the argument perspective of the method getCAPState CcPerAddressInterface.java NS1_XSSTR_Dessusaddrsap.com/gen_wdp/packages/com/sap/xss/hr/per/us/address/cc line 137
    we manually set below .jar files in classpath settings.
    pcuixssfpm.jar
    pcuixssutils.jar
    logging.jar
    essper.jar
    Is there any alternative to work around.
    Thanks & Regards,
    Raj

  • .jar file is not working properly :developed in NETBEANS

    Hi Gurus,
    i am using NETBEANS IDE 7.2.
    i am developing a project that interacts with databases 10g and COM ports of machine , these all processes are performed by .bat file which i am trying to run from jFramform , code works perfectly .bat file is also called perfectly when i run the project using F6 from the NETBEANS, for testing i placed some dialogue boxes on the form to test it ,
    but when i run executable .jar  file , form run successfully and dialogue box works perfectly but .bat file is not called by executable .jar file.
    this is how i call the .bat file...
      String filePath = "D:/pms/Libraries/portlib.bat";  
            try { 
              Process p = Runtime.getRuntime().exec(filePath); 
            } catch (Exception e) { 
                e.printStackTrace(); 
    and below is the contents of portlib.bat file
    java -jar "D:\SMS\SMS\dist\SMS.jar" 
    you must probably ask why i am calling a .jar file using .bat file .
    reason is that this .jar project sends message using GSM mobile , System.exit(); is compulsory to complete a job and then do the next one ,
    if i use the same file to execute this job it makes exit to entire the application (hope you can understand my logic).
    that's why i use extra .jar file in .bat file , when single job is completed .bat exits itself and new command is given.
    Problem is that code is working perfectly in NETBEANS when i run the project but when i run .jar then .bat file is not working  ,
    thanks.

    Thanks Sir ,
    You need to first test an example that works like the one in the article.
    There are plenty of other examples on the web - find one you like:
    http://javapapers.com/core-java/os-processes-using-java-processbuilder/
    I tried this one.
      try {
                ProcessBuilder dirProcess = new ProcessBuilder("D:/SMS/SMS/Send_message.bat");
                 File commands = new File("D:/SMS/SMS/Send_message.bat");
                 File dirOut = new File("C:/process/out.txt");
                 File dirErr = new File("C:/process/err.txt");
               dirProcess.redirectInput(commands);
                 dirProcess.redirectOutput(dirOut);
               dirProcess.redirectError(dirErr);
                 dirProcess.start();
            } catch (IOException ex) {
                Logger.getLogger(mainform.class.getName()).log(Level.SEVERE, null, ex);
    as instructed in the article i compiled  both the projects at same version or sources and libraries which is 1.7
    here is my version details
    C:\>javac -version
    javac 1.7.0_07
    C:\>java -version
    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
    Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
    inside the NETBEANS IDE c:\process\err.txt  remains empty and code works perfectly , but when I run executable .jar file( by double clicking on that file in dist directry) then c:\process\err.txt becomes full with this error text and there is no response from calling D:\SMS\SMS\send_message.bat
    here is the error text
    java.lang.UnsupportedClassVersionError: sms/SMSMAIN (Unsupported major.minor version 51.0)
      at java.lang.ClassLoader.defineClass0(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)
    Exception in thread "main"
    here is /SMS/SMS
    unknown source ?

  • .jar file suddenly not working

    I have some minimal experience working with .jar files, but I am baffled here.
    Recently, the jar file for one of my programs stopped working. I had just made a change to my main class, so i repackaged the jar. Now it says "Can't find main class" when I try to run it. It will only work if I add the line
    Class-Path: . (there is a period there)
    to my manifest.
    This would be fine, but I want to use exe4j to make it into a Windows executable. exe4j must do something where it does not honor the mainifest settings, because the executable gives out a "can't find main class" error no matter what.
    What has happened? It is only an issue with this program, i have repackaged several others to test, and they work without the "Class-Path" workaround. I'm pretty sure that it's not something in the nature of the program itself, because it worked eariler, and my only change was a small one (the text of a few JLabels).
    I have made sure that my main class is in the root of my jar file, and I have the Main-Class attribute correctly set in my manifest. The program runs fine outside the jar, but displays this odd behavior only when "jarred".
    Any help would be greatly appreciated.

    also, it's only the one class that's affected.
    I tried setting the Main-Class to other classes in the jar, and that worked fine. When I tried to make a workaround, making one of the other classes' main call the one I wanted, i got a "fatal exception" error. I'm pretty sure it still couldn't find the file.

  • Jar file is not getting executed from commandline

    Hi ,
    this is the weired problem i had.
    i have created a executable jar file.When i double click that file it is getting executed without any problem but when i go to command prompt and tries to run this jar by using folowing command
    java -jar myjar.jar
    it is giving me the error as
    Exception in thread "main" java.lang.UnsupportedClassVersionError:com/build/deploy/Deploy (Unsupported major.minor version 49.0)
    i am not getting why it is giving me this version error.
    can any body answer my question.
    i am using version JDK1.5 also program is running perfesctly from ecllipse IDE.

    I believe that something in your system is set up so that when you double click the jar, the correct java or javaw version is being used, but when you use the command line, an older version of java is being used.

  • JAR FILE IS NOT DETECTING IN WINDOW

    hi
    I am facing some problems during package creation
    My current J2SDK is 1.5.0_02-b09
    I create one packge called as p1.jar
    It consist of one class & one interface
    sa.java
    package p1;
    public class sa
         private int a,b;
         public sa(int a,int b)
              this.a=a;
              this.b=b;
         public void showval()
              System.out.println(" a="+a+" b="+b);
    sb.java
    package p1;
    public interface sb
       public int s1=34;
       public int s2=43;
       public void  takeme(int a,int b);
    /code]
    I create a jar file and set its path in
    MY COMPUTER ---->advanced --------->Environment & variables ----->classpath
    if i specify  import p1.* in  the following manner import p1.*;
    public class demopack implements sb
         int a,b;
         public demopack(int a,int b)
              this.a=a;
              this.b=b;
         public void takeme(int x,int y)
              a=s1+x;
              b=s2+y;
              System.out.println("a="+a+" b="+b);
         public static void main(String[] args)
                   demopack d=new demopack(10,20);
                   d.takeme(12,23);
                   sa s=new sa(12,23);
                   s.showval();
    Following Error is executing
    Z:\javademo>javac demopack.java
    demopack.java:4: cannot access sb
    bad class file: .\sb.java
    file does not contain class sb
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    public class demopack implements sb
                                     ^
    1 error----------------------------------------------------------------------------------------
    but if i mention import statement in following way there are no error
    import p1.sa;
    import p1.sb;
    public class demopack implements sb
         int a,b;
         public demopack(int a,int b)
              this.a=a;
              this.b=b;
         public void takeme(int x,int y)
              a=s1+x;
              b=s2+y;
              System.out.println("a="+a+" b="+b);
         public static void main(String[] args)
                   demopack d=new demopack(10,20);
                   d.takeme(12,23);
                   sa s=new sa(12,23);
                   s.showval();
    Is above mention problem is version problem
    For user defined package Every time I have to import individual class ?
    Is any alternative Solution (excluding -classpath option of javac)

    Well
    I follow your instruction
    I am pasting the command prompt operation
    Coding is same above
    My all three files (.java )is resides in javath folder
    command prompt code
    Z:\javath>javac -d . sa.java
    Z:\javath>javac -d . sb.java
    Z:\javath>jar -cvf p1.jar p1/*.class
    added manifest
    adding: p1/sa.class(in = 687) (out= 423)(deflated 38%)
    adding: p1/sb.class(in = 185) (out= 153)(deflated 17%)
    Z:\javath>javac demopack.java
    demopack.java:4: cannot access sb
    bad class file: .\sb.java
    file does not contain class sb
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    public class demopack implements sb
                                     ^
    1 error
    Z:\javath>------------------------------------------------------------
    in demopack.java file i want to access class files which are resides in
    jar files
    Actually when we are writing import java.io.*;
    we can access all the class file from that io package
    Same thing i am trying to implement for user defined package
    I hope you understand my question
    regards

  • My JAR file is not working properly!!!

    Hi everyone,
    I made an application that has a GUI (window). I converted it into a JAR file so I can send it to a friend by email. Then she can run it to generate the output. First, the user has to select a destination to save the .txt file (using JFileChooser). Then enters the inputs (using JTextFields). Clicks "Run" button (Results will be calculated and copied to the file). A Message will appear indicating that the results are copied. The problem is that when I run the application in the IDE (Eclipse) it works fine. But when I convert it into JAR, The moment I click the "Run" button, suddenly the window closes. Please HELP???
    Thank you

    DrClap wrote:
    Eng.Sh_2004 wrote:
    Sorry guys, but i would like to make things clearer, As I mentioned earlier, What i'm doing is the following: 1) Using the Jfilechooser, save the results into a filename.txt file _[main class in the manifest file (class for the GUI) ]._ 2) Click "run" to write the data to the created file in step 1 [_another class is used to write to file_]. I have a feeling that the problem is related to the manifest main class. What do you think guys?I think your description of the problem is very bad. And I think your idea of making wild guesses is a bad way of diagnosing problems.
    First of all. A JFileChooser does not save anything. It just allows the user to select a file to be saved to. So if you thought that the first step was writing anything or creating any file, you're probably wrong. But examining the code would help you understand.
    Second, if you're having problems because one class chooses the file name and a second class writes data to it, then you're probably running into the basic beginner problem we see around here all the time of how to communicate data between objects. Again, examining the code might help.
    Third, you need to understand what is writing that error message. Examining the code would help there too.
    So: stop guessing. Look at the code.I'm still New To Java that's why i find difficulty in problems diagnosis. Regarding the JAR problem, as you mentioned, I used JFileChooser to select a file and (copying data) is the other part. So I will look at the code again.
    Edited by: Eng.Sh_2004 on Aug 26, 2010 1:10 PM

  • Execute jar file: "could not find the main class" program will terminate

    Hey,
    I am new to Java. I have started to make a small java program which supposed to help me at my studies to lean the Dominic Memory System. I have used the latest version of Netbeans 5.5.1 to build my program in. I have two problems which I cannot figure out how to solve, please help me.
    The first problem is that the java script I have made works when I compile it in Netbeans, but when I create a Jar file it does not work. I receive a pop up message in windows ?could not find the main class program will terminate? when I execute the jar file.
    The second problem I have is that I need to compare the strings generated by the "numbers" and "TIP" and if the numbers is not identical the numbers in the ?Center? JPanel should be highlighted as red.
    If anyone would like to clean up the code I would be pleased. I have copied quite a lot from anyone because of my one lack of knowledge.
    * GoListener.java
    * Created on 12. september 2007, 21:48
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package grandmaster;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Vector;
    import java.util.StringTokenizer;
    import java.awt.Color;
    * @author Computer
    public class GoListener implements ActionListener {
    private JTextField viewer;
    private JTextField TIP;
    private JTextField freq;
    private JTextField max_num;
    private Vector numbers;
    public GoListener(JTextField j,JTextField k, JTextField m, JTextField f, Vector n) {
    freq = f;
    max_num = m;
    viewer = j;
    numbers = n;
    TIP = k;
    public void actionPerformed(ActionEvent e){
    int time = Integer.valueOf(max_num.getText());
    int f = Integer.valueOf(freq.getText());
    if (e.getActionCommand() == "GO") {
    for (int i = 0; i< time;++i) {
    int number=0;
    number = (int)Math.floor(100*Math.random());
    while(number>51){
    number = (int)Math.floor(100*Math.random());
    if(number<=9){
    viewer.setText(" "+"0" + String.valueOf(number) + " ");
    } else{
    viewer.setText(" " + String.valueOf(number) + " ");
    viewer.paintImmediately(viewer.getBounds());
    numbers.add(number);
    try {
    Thread.sleep(f*1000);
    } catch (Exception exp) {
    viewer.setText(" XX ");
    viewer.paintImmediately(viewer.getBounds());
    if (e.getActionCommand() == "VIEW") {
    try {
    //int numb = Integer.valueOf( TIP.getText() ).intValue();
    StringTokenizer tokenizer = new StringTokenizer(TIP.getText(), " ");
    String[] split = null;
    int tokenCount = tokenizer.countTokens();
    if (tokenCount > 0) {
    split = new String[tokenCount];
    for (int current = 0; current < tokenCount; current++) {
    split[current] = tokenizer.nextToken();
    viewer.setText(" " + String.valueOf(numbers) + " ");
    // k=numbers(1);
    /*while(c<i){
    String.valueOf(k).equals(split[1]);
    c++;
    TIP.setText(" " + split[2] + " ");
    } catch (Exception exp) {
    try {
    //string testit = numb.toString();
    //String str = "" + numb;
    //viewer.setText(str);
    //viewer.setText(numbers.toString());
    numbers.clear();
    } catch (Exception exp) {
    * Main.java
    * Created on 12. september 2007, 21:07
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package grandmaster;
    import java.util.Vector;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.JButton;
    import java.awt.*;
    import grandmaster.GoListener;
    * @author Computer
    public class Main extends JFrame {
    private JTextField viewer;
    public JTextField TIP;
    // private TextInputPanel TIP;
    private Vector numbers;
    /** Creates a new instance of Main */
    public Main() {
    numbers = new Vector();
    JPanel p = new JPanel(new GridLayout(0,4));
    JButton go = new JButton();
    JButton view_num = new JButton();
    go.setText("Go!");
    go.setVisible(true);
    go.setActionCommand("GO");
    view_num.setText("VIEW");
    view_num.setVisible(true);
    view_num.setActionCommand("VIEW");
    JTextField max_num = new JTextField();
    max_num.setText("5");
    JTextField freq = new JTextField();
    freq.setText("1");
    viewer = new JTextField();
    viewer.setText("XX");
    TIP = new JTextField("");
    p.add(go);
    p.add(max_num);
    p.add(freq);
    p.add(view_num);
    getContentPane().add(p,BorderLayout.NORTH);
    getContentPane().add(viewer,BorderLayout.CENTER);
    getContentPane().add(TIP,BorderLayout.SOUTH);
    setSize(200,200);
    GoListener g = new GoListener(viewer,TIP,max_num, freq, numbers);
    go.addActionListener(g);
    view_num.addActionListener(g);
    * @param args the command line arguments
    public static void main(String[] args) {
    // TODO code application logic here
    Main window = new Main();
    window.setVisible(true);
    }

    NetBeans questions should be posted to the NB site. It has mailing lists and associated forums.
    This tutorial from the NB site addresses running programs outside of NB
    http://www.netbeans.org/kb/articles/javase-deploy.html
    When you compare objects, use ".equals()" and reserve == for comparing values.

  • Executable JAR file: Could not find the main class.

    Hello,
    I have a problem with making an executable JAR file.
    I have written a JAVA program that consists of five different classes of which User.java is the main class and I have saved a text document with Main-Class: User and a blank line after that.
    If I try:
    jar cmf MainClass.txt User.jar User.class Beheerder.class Operator.class Manager.class MaakVisueelSchema.class
    it makes a executable jar file which actually works! :)
    But when the Operator class trys to open the MaakVisueelSchema class the screen stays blank.
    I can run MaakVisueelSchema with java MaakVisueelSchema.
    So I tried to make an executable JAR that consists only of MaakVisueelSchema, the same way as I did for User:
    Main-Class: MaakVisueelSchema
    jar cmf MainClass.txt MaakVisueelSchema.jar MaakVisueelSchema.class
    Then I get the error message:
    Could not find the main class. Program will exit.
    from the Java Virtual Machine Launcher.
    The big difference between MaakVisueelSchema and the other classes is that MaakVisueelSchema contains a PaintComponent method and an ComponentListener. Is it possible that one of those creates the error?
    Can anyone help me with this problem?
    Thanks in advance!
    Bye!

    Yes,
    I tried:
    jar xvf MaakVisueelSchema.jar
    and it returns:
    META-INF/
    META-INF/MANIFEST.MF
    MaakVisueelSchema.classN/G. You need to manually create a manifest file in a text editor, have it point to your main class, and enter it in your jar command as an argument.

  • Jar file could not find main class.. I cant see why?

    I have read loads of tutorials on this and it should be very straight forward but i STILL cant make a working jar file of my program.. please see if you can see anything wrong with what im doing..
    my program is one .java file that compiles perfectly, and is runnable both through eclipse and by using the command prompt.. i made a jar file using both eclipse and the command prompt, and neither worked.. every time i run it by double clicking it i get the error "could not find main class, program will exit". here is the contents of my jar:
    CorePackage\IPEmailer.class
    CorePackage\IPEmailer$1.class
    CorePackage\IPEmailer$SMTPAuthenticator.class
    META-INF\MANIFEST.MF
    the MANIFEST.MF file contains:
    Manifest-Version: 1.0
    Class-path: .
    Created-By: 1.6.0_02 (Sun Microsystems Inc.)
    Main-Class: CorePackage.IPEmailer
    (yes there is a blank line at the end)
    the class mentioned in 'Main-Class' has a main method that looks like this:
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new IPEmailer();
    }the program uses 2 external jar files:
    activation.jar
    mail.jar
    and reads a file called:
    ipemailer.ini
    and writes a file called:
    ip.txt
    the program has no GUI and is intended to run 'silently' in the background
    please help me understand what is wrong with this

    package CorePackage;
    import javax.mail.*;
    import javax.mail.Authenticator;
    import javax.mail.PasswordAuthentication;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    public class IPEmailer implements Runnable{
          * @param args
         String recipientsinput[]={""};
         String subject;
         String body;
         String server;
         String user;
         String pass;
         String from;
         String urlString = "http://www.whatismyip.org";
         String currentIP;
         String ipFromFile;
         boolean webFailed;
         long interval = 900000; //15 mins
         long oldInterval;
         Thread t = new Thread(this);
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              new IPEmailer();
         public IPEmailer(){
                         ..........etccould the problem be that the class is a thread? i cant see why it would be, but ive never made a jar where the main class also 'implements runnable'

Maybe you are looking for