Trouble creating jar from java applet in eclipse

I have a java applet in eclipse which I can run, however, I need to be able to view the applet in IE, because certain pieces wont work when I run within eclipse. When I attempt to export the project to a jar it asks for a main class, which does not exist. Can someone please help as to how I can launch my applet from eclipse into IE, or how I can export it as a jar?
Thanks!

Don't you just use copy the class from your workspace and embed it in your HTML by pointing to it's new location. Eclipse only asks for the main class when exporting an executable Jar anyways. Why don't you just get the class and putting in your directory with your HTML?

Similar Messages

  • Read, Write and create files from java applet.

    Dear All,
    I have created a two files. One is applet and one application file. I am creating a instance of application file in applet. Application file is used for reading, writing and creating files. When I invoke applet from broser it dipslays error wrt file access permission. From the forum search I know that we need to sign the applet / edit the java policy to run the code locally. Final delivery of my code should execute on different system. Its not web. I have created a html page on submitting the form it invokes applet to read the form values from param and needs to update the values in xml file located locally. Please help me on how I can proceed with this fix.
    Thanks in advance.

    Sorry if I have not stated the problem clearly. I need to update content to files hosted in local system using java applets.
    I belive there are two ways to achive that.One with jar signer and one with modifying the java policy file. But this application needs to be installed in different system locally as I have created a application with webpage as useinterface and need to update the content in local files on submission. Not sure on how to modify the java.policy files in each end user system and whats the value we need to update in java policy file. Please help me on the steps to be followed

  • I am using a Application in c dll calling from jni jar by java applet in firefox version 19.0 , the problem is click event message box will not working correct

    I am using a Application in c dll calling from jni jar by java applet in firefox version 19.0 , the problem is button click event message box or popup window will not working correctly. Please any one suggest me the steps to overcome this not responding or slowness in the responding problem of Button click event.

    Hello,
    In Firefox 23, as part of an effort to simplify the Firefox options set and protect users from unintentially damaging their Firefox, the option to disable JavaScript was removed from the Firefox Options window.
    However, the option to disable JavaScript was not removed from Firefox entirely. You can still access it from about:config or by installing an add-on.
    '''about:config'''
    # In the address bar, type "about:config" (with no quotes), and press Enter.
    # Click "I'll be careful, I promise"
    # In the search bar, search for "javascript.enabled" (with no quotes).
    # Right click the result named "javascript.enabled" and click "Toggle". JavaScript is now disabled.
    To Re-enable JavaScript, repeat these steps.
    '''Add-ons'''
    You can alternatively install an add-on that lets you disable JavaScript, such as
    *[https://addons.mozilla.org/firefox/addon/noscript/ No-Script] (to disable JavaScript on a per page basis, as required)
    *[https://addons.mozilla.org/firefox/addon/quickjava/ QuickJava] (to easily disable and enable JavaScript, automatic loading of images, and other content)
    Thank you and I hope this helps!

  • Executing jar from java code, then kill parent java code

    Please suggest if there is any best way around on executing jar from java code then killing parent java code.
    a) I have desktop based java application say "Monitor.java" which runs every 5 minutes.
    b) How can I START external java application say "execute.jar" from Monitor.java THEN EXIT Monitor.java
    I tried various options using "ProcessBuilder" and calling bat file but I need Monitor (parent application to EXIT, immediately after calling child (execute.jar)
    Try1) ProcessBuilder builder = new ProcessBuilder("java -jar execute.jar");          
    Process process = builder.start();
    Try2) Runtime r = Runtime.getRuntime();
    Process p = null;
    p = r.exec(new String[] { "cmd", "/c", "start C:/temp/Test.bat" });

    I have a requirement to transfer data from one db to another db from Java Application Layer.Maybe, maye not. We get all sorts of weird "requirements" - which are nothing but thoughts or proposed solutions.
    But,
    Did the "requirement" mention whether the table existed already or not in the target database? - If not, did it tell you to create it - drop/create it?
    Did the "requirement" deliver some explanation to why this copying was neeeded? - Are we talking replication? - Or a one time cloning?
    Etc, etc,
    Personally I would always argue against a "reuirement" like that. - It just isn't the way to do it. Period.
    Regards
    Peter
    P.S: If you are satisfied with what COPY does, then you could let Java make an OS call and do it from there?

  • Help with creating an animated java applet...

    Hello, everyone! I'm working on a homework assignment for my Intro to Java class, and I'm having a problem I've never run into before. My assignment is to create a animated Java applet which displays an image of an alien spaceship which travels in diagonal lines across the applet area. My main problem is that when I try to compile my code, I get three "cannot find symbol" errors about my variable "alien." I can't figure out why declaring it as a class variable hasn't solved my problem. The errors pop up for the repaint() method, as well as the pane.add and the paintIcon. Here's my code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.Timer;
    class DrawAlien extends JPanel
    public class Alien extends JApplet implements ActionListener
      ImageIcon alien;
      public void init()
        Container pane = getContentPane();
        alien = new ImageIcon(getClass().getResource("alien.gif"));
        pane.setBackground(Color.black);
        pane.add(alien);
        Timer timer = new Timer(30, this);
        timer.start();
      public void actionPerformed(ActionEvent e)
        alien.repaint();
    }I've only posted the section which I think is relevant to my problem, but I can post the rest if anyone thinks it's necessary.
    I'm aware that the code isn't ready yet in several other ways, but I don't think I can move on until I figure out what's up with the "alien" variable. I don't need anyone to write code for me or anything like that, I just lack perspective here. A couple hints in the right direction would be invaluable. Thanks!
    Edited by: springer on Nov 25, 2007 10:46 PM

    You can?t add ImageIcon into pane, you can do like below.
    alien = new ImageIcon(getClass().getResource("alien.gif"));
        pane.setBackground(Color.black);
        JLabel label = new JLabel(alien);
        pane.add(label);

  • Creating and running JARs from Java programs

    OK, I have been googling and searching, but this is something I cannot work out, so I raelly need some help.
    Basically, I am building a GUI app that would generate, compile and run java programs. And I also want to enable the users to create JARs they can later double-click if they want to run the program.
    I am using Runtime to compile programs and it works just fine. When I click on a button to create a JAR, my application creates one, but when I double-click on it, it can't find main and it exits. Now that is not so much unusual, but I am positive that my manifest file is OK, because when I run the same command from the command line, then I can click on the JAR file to run it.
    So what is the deal here? I mean, why would a JAR file created from the command line run and the one created through a GUI app using the very same command could not find main?
    Any help would be graetly appreciated.

    again, another unanswered question.
    BTW I'l keep bumping these until I get an answer that works. I have been up 3 hours now trying to get this sorted and it's something that netbeans is supposed to do on its own!?!?!?!?!
    Hello, SUN, is there anyone there???
    No, didn't think so.

  • Build a .jar from an applet

    Hi. I have the following code.
    import controller.Application;
    import model.Slideshow;
    import view.MainFrame;
    import java.applet.Applet;
    public class Main extends Applet {
        public void init() {
            Slideshow slideshow = new Slideshow("untitled.xml");
            Application app = new Application(slideshow);
            new MainFrame(app);
    }I can create the .jar file but when I open it a message of "couldn't finde main class" appears... obviously... it's an applet ! how can I create an excecutable file? thanks very much

    Akcents wrote:
    public class Main{
    public static void main(String[] args) {
    Slideshow slideshow = new Slideshow("untitled.xml");
    Application app = new Application(slideshow);
    new MainFrame(app);
    how can I make an executable file with this class????
    This question is quite different from your original question. Is it your intent to convert the application into an applet or are you interested in creating an [executable JAR file|http://java.sun.com/javase/6/docs/technotes/guides/jar/jarGuide.html]? If it's the latter, when bundling your application in a JAR file you'll need to update the [JAR file manifest|http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html] with a Main-Class entry. If it's the former, the following link will be helpful:
    [http://java.sun.com/docs/books/tutorial/deployment/applet/getStarted.html |http://java.sun.com/docs/books/tutorial/deployment/applet/getStarted.html ]

  • Error while creating jar from source folder

    Hi,
    i have source folder and i added log4j.properties
    i try to build for creating jar (sourcecode.jar) by ant build (build.xml)
    it is throwing error and saying that "package org.apache.log4j does not exist"
    i spend more time to resolve this error , but i could not find any solution.
    what is the error on this.. below the build.xml code which i try to build jar
    <project name="MyProject" default="dist" basedir=".">
        <description>
            simple example build file
        </description>
      <!-- set global properties for this build -->
      <property name="src" location="src"/>
      <property name="build" location="build"/>
      <property name="dist"  location="dist"/>
      <target name="init">
        <!-- Create the time stamp -->
        <tstamp/>
        <!-- Create the build directory structure used by compile -->
        <mkdir dir="${build}"/>
      </target>
         <path id="classpath">
                 <fileset dir="${src.dir}">
                 <include name="log4j-1.2.16.jar"/>
                 </fileset>
         </path>
         <target name="compile" depends="init"
            description="compile the source " >
        <!-- Compile the java code from ${src} into ${build} -->
        <javac srcdir="${src}" destdir="${build}"/>
      </target>
      <target name="dist" depends="compile"
            description="generate the distribution" >
        <!-- Create the distribution directory -->
        <mkdir dir="${dist}/lib"/>
        <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
        <jar jarfile="${dist}/lib/EscapeIncontra.jar" basedir="${build}"/>
      </target>
      <target name="clean"
            description="clean up" >
        <!-- Delete the ${build} and ${dist} directory trees -->
        <delete dir="${build}"/>
        <delete dir="${dist}"/>
      </target>
    </project>i am using log4j.properties inside source folder also added in eclipse class path..
    Thanks
    Rosina

    user13836688 wrote:
         <path id="classpath">
                 <fileset dir="${src.dir}">
                 <include name="log4j-1.2.16.jar"/>
                 </fileset>
         </path>
    maybe you ment<path id="classpath">
                 <fileset dir="${src.dir}">
                 </fileset>
                 <pathelenemt path="${your_lib_folder_path}/log4j-1.2.16.jar"/>
         </path>bye
    TPD

  • Calling a WebService from Java Applet

    Hi all,
    In my application I have 3 projects:
    1. server - for all the business logic.
    2. view - for web app.
    3. swing - for applet.
    In the view project I wrote a WS, and I want to call it from my applet. So I created a WS using the Jdev (10.1.3.2) wizard in the view project (I tested it and it worked fine), and in the swing project I created a proxy for this WS, tested it and it worked fine. Then I created a JAR containing the swing project with the WS proxy classes, opened the Applet and find out that I have some classes missing, so I started adding all the relevant Jars and ended with a ~13MB JAR containing all the swing project jars that in the class path for a simple Applet.
    I know that I'm missing something but I dont know what. Do I really need all those Jars. Is there a simple way to call to a WS via Applet?
    This is the list of all the Jars:
    activation.jar
    commons-logging-api.jar
    commons-logging.jar
    ejb.jar
    http_client.jar
    jaxb-api.jar
    jaxb-impl.jar
    jaxen.jar
    jaxr-api.jar
    jaxrpc-api.jar
    jazncore.jar
    jdom.jar
    jms.jar
    jta.jar
    mail.jar
    mdds.jar
    oc4jclient.jar
    ojdl2.jar
    ojmisc.jar
    ojpse.jar
    oraclepki.jar
    orajaxr.jar
    orasaaj.jar
    orawsdl.jar
    orawsrm.jar
    osdt_cert.jar
    osdt_core.jar
    osdt_saml.jar
    osdt_wss.jar
    osdt_xmlsec.jar
    relaxngDatatype.jar
    saaj-api.jar
    saaj-impl.jar_old
    servlet.jar
    wsclient.jar
    wsdl.jar
    wssecurity.jar
    wsserver.jar
    xdb.jar
    xml.jar
    xmlparserv2.jar
    xsdlib.jar
    By the way at the end of all this annoying process I got the next exception:
    [failed to localize] typemapping.nested.exception.initialization(javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found)
         at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService.java:282)
         at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(BasicService.java:244)
         at com.tm.view.ws.misc.runtime.WSMisc_Service_SerializerRegistry.getRegistry(WSMisc_Service_SerializerRegistry.java:26)
         at com.tm.view.ws.misc.runtime.WSMisc_Service_Impl.<init>(WSMisc_Service_Impl.java:26)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:92)
         at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryImpl.java:121)
         at com.tm.view.ws.misc.WSMiscSoap12HttpPortClient.<init>(WSMiscSoap12HttpPortClient.java:20)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at client.base.connectivity.ClientRequestAgent.runWS(ClientRequestAgent.java:135)
         at client.base.connectivity.ClientRequestAgent.run(ClientRequestAgent.java:44)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Shachar

    Try this:
    1. open the webService data controll in the Data Controls section and drag the method from the webService onto the method call activity in your task flow. This will overwrite the current method property (the one which pints to your bean, make a copy of this entry if you can't reproduce it by hand). This too will create an entry in the pageDef of the method call activity.
    2. reenter (or paste) the original value in the method property, so that it again points to your bean. The entry in the pageDef will remain!
    3. now in the bean method you can access the method via its binding like you access any other method from the binding:
    // GET A METHOD FROM PAGEDEF AND EXECUTE IT
    // get the binding container
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    // get an Action or MethodAction
    OperationBinding method = bindings.getOperationBinding("YourMethodActionNAME");
    if (method == null)
    // handle method not found error...
    // if there are parameters to set...
    Map paramsMap = method.getParamsMap();
    paramsMap.put("param","value")  ;    
    // execute the method
    method.execute();
    List errors = method.getErrors();
    if (!errors.isEmpty())
       // handle errors here errors is a list of exceptions!
    // no error resume normal workTimo

  • Print- Save as PDF from Java applet on a webpage in Safari

    I am on a Mac running OS X version 10.8.5 and Safari version 6.1.2.  I am using the website www.wordle.net, which uses a Java applet to create a Wordle. The applet has a print button.  The website FAQ says I should be able to save a Wordle as a PDF on a Mac.  When I try to do this I get a small dialog that simply says "Error whilte printing."
    Here is some of the system.log:
    Mar  4 16:57:54 Kroghs-iMac.local sandboxd[602] ([557]): java(557) deny file-write-create /private/var/folders/f0/c8r_ry6d4131x95phl6fv7kr0000gn/T/WebKitPlugin-f12Pu6/53 164c620f81b
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x96096].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x97097].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x98098].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x99099].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x9a09a].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:55 Kroghs-iMac.local java[557]: Printing failed because PMSessionBeginCGDocumentNoDialog() returned -108.
    I've removed the Adobe plug-ins from /Library/Plug-Ins
    Print->Save to PDF works from Safari when I am on a regular webpage.
    Print->Save to PDF works from Pages
    Help!  I want to make Wordles for the teachers at my kids school for Teacher Appreciation Week.

    YES!!!!!!!
    I was pulling my hair out last night over this. I noticed the Find function was not working properly. I KNEW there was something in the PDF and Preview was not showing it. I spent 2 hours trying to find someone with a similar Find function problem, but could not find much. Also, it could not copy and paste text. I KNOW it worked before because I had taken notes on this particular PDF and had copy and pasted whole paragraphs for myself into Pages. Which is what got me searching online tonight.
    I re-downloaded the same PDF. When first opened in Preview, the Find and copy/paste functions worked. Same thing in Acrobat reader and Acrobat Pro. After confirming this, I re-opened it in Preview, highlighted some text and closed. It asked to Save Changes and I did. I immediately re-opened it, and guess what? Find no longer works and neither does copy/paste. Just to be sure, I tried re-opening in Acrobat reader and Pro; same thing. No copy/paste, corrupted Find feature. Well, copy/paste sort of functions, its just that it pastes a square with an alien head in it that says "Private Use 100000 Plane 16".
    And finally, on some PDFs that have not even been saved in Preview, the Find function is not working properly also. It happened on the re-downloaded PDF I just talked about. It finds many instances of the word, bit the left and right arrows next to "Found on X# Pages are greyed out and do not move through the document. Once I go to the left pane that displays page thumbnails and click on a few different ones, THEN it starts working.
    So yes, Apple, Preview is corrupting PDF files upon save, AND it is not working properly on other files. Please fix this. PLEASE.
    And my specs are the same as Gary; iMac 27 inch Late 2009, Yosemite 10.10.1. Is ANYONE else having this issue with a different Mac?

  • Gif file not found in JAR from Java Application

    Hello Forumers,
    Could some one please explain how to create a JAR file from where I can get a GIF file. I have tried a number of different ways but it allways fails. (I have tried to add the GIF files using the jar command and I have tried to add it using WinZip after the jar is created).
    To isolate the problem I created this very simple program, the program works very well when the gif file resides on the directory from where I run the Application, but when I remove it from the directory it fails. I have tried to put the GIF file in the JAR in a number of different ways but it allways fails. (I have also tried with and without slash before the name of the GIF). I guess the problem is the way I create the JAR file
    import java.io.*;
    public class GifTest
    { public static void main(String args[])
    { InputStream in = GifTest.class.getResourceAsStream("/open.gif");
    if (in==null)
    System.out.println("Null returned");
    else
    System.out.println("OK");
    Any Hints appreciated
    /Kjell

    Hi,
    here is a small application using my own class GetImageIcon.
    Normally I have this "help-class" in a utility-package to use it from all my projects without copying. For this example I copied the code in the test application. Feel free to use the code of the class like you want. For me it works fine.
    Do the following:
    1. Create a folder called /meta-inf under the folder where the class-files are. Use a text-editor and create a file saved as "manifest.mf".
    manifest.mf tells the jar-file which is the main-class from where the application will start when double-clicked.
    It only has to contain one line:
    Main-Class: GifTest
    2. Compile and create the jar file. I made a bat-file containing:
    javac -verbose GifTest.java
    %pause
    REM Create Jar-File
    jar cmf meta-inf/manifest.mf GifTest.jar *.class *.gif
    REM Show Table of Content of the Jar-File
    jar tf GifTest.jar
    %pause
    So you can see what's in the jar-file.
    3. When you double-click on the jar-file the application is executed. So it is easier to use for the users. They don't have to type in anything on the command-line. You can deploy this jar-file to any client and run it. The only thing you have to do, is to install the JRE on the clients.
    I develop with JDK 1.3.1 and JRE 1.3.1 is installed on the clients of the company I work for.
    //Begin of the code
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.jar.*;
    public class GifTest extends JFrame
            protected JLabel m_title;
            protected ImageIcon m_image;
            static File file;
            //You have to define the name of the jar-file
            static String jarFile = "GifTest.jar";
            //Instance of the class GetImageIcon
            protected GetImageIcon gii = new GetImageIcon();
            public GifTest()
                    super("GifTest");
                    setSize(400,200);
                    //the name of the image and the name of the jar-file the image resides in
                    m_image = gii.getImageIcon("orb.gif", "GifTest.jar");
                    m_title = new JLabel(null, m_image, SwingConstants.CENTER);
                    getContentPane().add(m_title, BorderLayout.NORTH);
            public static void main(String argv[]) {
                    GifTest frame = new GifTest();
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setVisible(true);
    public class GetImageIcon{
    * @param fileName the full qualified name of the file
    * from the root of your application. use a "/" before the
    * fileName, eg. /images/warning.gif
        public ImageIcon getImageIcon(String fileName, String jarName) {
            int counter, c, i = 0;
            byte buffer[];
            JarFile  jfile;
            JarEntry jentry;
            InputStream in;
            ImageIcon m_image;
            try{
                    // Create Jar-File object from JarFile
                    jfile = new JarFile(jarName);
            catch(Exception ex){
                    System.out.println("JarFile-Problem " + "\n" + ex);
                    return null;
            try{
                    // create Jar-Entry object from File-Name in JarFile
                    jentry = jfile.getJarEntry(fileName);
            catch(Exception ex){
                    System.out.println("JarEntry-Problem " + "\n" + ex);
                    return null;
            try{
                    // create InputStream from JarEntry
                    in = jfile.getInputStream(jentry);
            catch(Exception ex){
                    System.out.println("JarEntry-Problem " + "\n" + ex);
                    return null;
            try{
                    //get uncompressed size of entry data in Jar-File and create byte-array with this size
                    buffer = new byte[(int)jentry.getSize()];
                    //write int-value 'c' (casted to byte) with read() and while-loop in byte-Array
                    while((c = in.read()) != -1){
                            buffer[i] = (byte)c;
                            i++;
            catch(Exception ex){
                    System.out.println("in.read()-Problem " + "\n" + ex);
                    return null;
            try{
                    //create ImageIcon with byte-Array 'buffer'
                    m_image = new ImageIcon(buffer);
            catch(Exception ex){
                    System.out.println("ImageIcon-Problem " + "\n" + ex);
                    return null;
            // return the created ImageIcon
            return m_image;
    }

  • Parameter passing from java applet

    Hi all.
    currently i'm trying to create online testing applet (like TOEFL exam) for fun.
    i've create basic testing rutine, but i got stuck on showing the results.
    i want to show the results on the HTML so that users can print it out easily. but i donw know how to pass parameter from Java to some other language.
    I've searched for JavaScript, but it seems that it's only possible when using NetScape. Also, I searched for PHP, but it's just not possible. HTML seems that it's only possible from "HTML to Java"...
    if anyone knows how i can do it, and which language i should use, please let me know.
    thanx!

    i want to print out the questions that user have mistaken. print out the question, wrong answer, and right answer.
    all the answers are created by radiobutton so i want to get the only the Strig values, which wouldn' be so difficult.
    I've searched about JSObject, but could u tell me where can i install the package (or SDK)?
    And do users need to install the package as well?
    thanks for your time.

  • Accessing files in a JAR from an Applet

    I've been stuck trying to get my applet to work online. The applet and its inner classes, as well as a folder with a bunch of text files it needs to run, are all in a jar file (on a geocities website =/ just trying to get it working). My html code for the applet looks like this:
    <applet code=Graph.class archive="Grapher.jar" height="600" width="1000">
    </applet>
    Graph is the class that runs the applet, and it has some inner classes for buttons and a drawing pane. When I try to run the applet online, I get this error:
    java.lang.NoClassDefFoundError: Graph$MyDrawPanel
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
         at java.lang.Class.getConstructor0(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    I know that Graph$MyDrawPanel is in the jar, and the applet works in NetBeans, what can i do to make firefox look inside the jar to find my inner classes?

    Try this:
    <applet code="InteractiveGrapher.Graph.class" codebase="." archive="monarchive.jar" width="1000" heigth="600">
    </applet>See http://java.sun.com/j2se/1.5.0/docs/guide/jar/jarGuide.html
    See also the example in the java tutorial
    http://java.sun.com/docs/books/tutorial/deployment/applet/browser.html
    (See the code source of the web page)
    hth,
    Message was edited by:
    java_2006

  • Calling Servlet from Java Class in eclipse

    Hi ,
    I am calling a Servlet from JAVA Class as I am using IDE: Eclipse. The Problem is below
    URL url = new URL(ServletPath);
    URLConnection connet = url.openConnection();
    I am using the above code in JAVA to Connect to Servlet I have given Print statement in Servlet such that whenever it calls it prints on Console but when I try to run the code the Statement is not printed in the Console of eclipse I think URL connection is not able to establish any connection ..... if any has solution for this please reply
    Thanks & Regards,
    Arvind

    I am calling a Servlet from JAVA Class as I am using IDE: Eclipse. The Problem is below
    URL url = new URL(ServletPath);
    URLConnection connet = url.openConnection();Why should the Servlet running in different Runtime print on your Eclipse Runtime. Please be more clear about the question.

  • DOS command from java applet

    Hi, I need to perform a DOS command from Java (using WFC if needed)...
    I have no idea, so please help!
    Thank you.

    OH OH OH WAIT! It is an Applet! i think there will be some security issues here! Sure enough you can't execute commands on the system from an applet unless you make some changes on the java.policy files on the client machine (that means, if your applet is in a web page, every machine which view your page).

Maybe you are looking for

  • How to set foreach's items(wcm:idcService)

    I use wcm:idcService get the service from the Oracle content server,and I set the service as COLLECTION_GET_CONTENTS,var as contentInfo,when I use the c:foreach tag to show my datas,how should I get the contentInfo,the code below is not usefull. <?xm

  • Can't Install Windows in Boot Camp - Windows Driver Issue

    Before update to Mavericks, I had an installation of WIndows 7 running in Bootcamp.  I had updated this to Windows 8. Just prior to Mavericks release, the hard drive in my MacBook Pro started to fail.  I had a full backup of the OS X partitiion, but

  • Where does the resources bundle files need to be

    Hi All, Does any of you knows where all the custom resources bundle files that will be used on BCC need to be? I have something like this: BCC module /src/com/mycompany/resources/WebAppResources.properties But when I try to use it This happens javax.

  • Rejection of a purchase order or purchase requisition.

    Hello, I know this is a question that was asked many times before, but nobody was able to give a clear answer to it. The objects purchase order(BUS2012) and purchase requisition(BUS2105) do not have between their methods, the rejection. But they cont

  • EP6 SP2 Metaframe XP

    We are currently experiencing Mayor problems on our Metaframe servers. When users access the Portal the portal loads up correcly. But as soon as they navigate within the portal it just refreshes the page it started up with. Are there any browser sett