How to open files in MIDP (from the jar file)?

Hello,
I can't seem to figure out how to open a file that is in my MIDP applications jar-File.
From what I've found via Google, I assume that the way to do it should be by using
Connector.openInputStream("file:{path_to_my_file}")
but I only get the error
java.lang.ClassNotFoundException: com.sun.midp.io.j2me.file.Protocol
(Running the Emulator from Suns WTK 2.0 with DefaultColorPhone)
I've also tried file:// with the same result.
Any ideas?
Many thanks in advance!
Bjoern

I think I've found something that looks promising now:
Class.getResourceAsStream()

Similar Messages

  • How to open or install fonts from a .suit file under Lion?

    How to open or install fonts from a .suit file under Lion? Thanks!

    although I believe I *have* used the .suit extension when I was creating suitcase files for TrueType fonts.
    You can get away with that because you haven't really changed anything. It's already a suitcase file, with a Type code of FFIL (the Creator code is mostly irrelevant). Adding .suit still tells the OS it's a suitcase.
    However, if you do something silly like change the Type code to LWFN (the outline portion of a PST1 set), then neither Font Book, or any other font manager knows what to do with it. It's recognizing the LWFN code, but the data structure of course doesn't match. The file is still a Mac legacy TrueType font. Suitcase Fusion 5 tosses this on the screen when I change the Type code to the wrong one:
    Changing the extension to something obviously wrong, like .otf produces the same message. It's trying to parse the data according to what the extension says it is, and nothing lines up.
    Trying to use .ttf or .ttc also doesn't work. A Mac legacy suitcase TrueType font is not built the same as a .ttf or .ttc font. Either is technically correct (it is a TrueType font), but that's the only similarity. What's happening in that case is Mac legacy TT fonts have all of the data in the resource fork. When you add .ttf or .ttc to the name, the OS and any font manager then tries to find the data in the data fork. Nothing there.

  • How can I find a photo from the backup file in my pc?

    How can I find a photo from the backup file in my pc?
    I have accidentally erased a photo. It happened after the backup.

    I am not aware you can extract a single photo or a single app's content from the backup, you can either restore the whole backup to your phone or not restore. If you restore your last backup to your phone then any content that is currently on your phone will be replaced with what was on it at the time that the backup was made - so if you do decide to restore, first copy off any purchases to your computer's iTunes via File > Transfer Purchases, and copy any documents/files that you've udpated on the phone since the backup.

  • How to add multiple images to a JLabel from the jar file

    I want to add multiple images in a JLabel but the icon property only allows me to add one. I thought I could use html rendering to add the images I need by using the <img> tab, but I need to use a URL that points to the image.
    How do I point to an image inside the jar file? If I can't, is there another way to show multiple images in a JLabel from the jar file?

    Thanks, it works perfectly. It's a really smart way of fixing the problem too :)
    I also found your toggle button icon classes which is something I've also had a problem with.
    Thanks.

  • Browse files and dirs in the JAR-file

    Hi! I'm stuck with a problem concerning browsing a JAR file to find all images, fonts and sound clips. I think this is a pretty straight-forward task, except when I consider that the file I want to browse, is the same file the browser is stored in and running from. I have searched for hours on the internet now, and I still haven't figured out a way to be able to browse my JAR file.
    Here is the code I use when I'm not running my project in a JAR-file:
         * Load and cache all files (*.ttf, *.png and *.wav) from the resource-directory
        public void loadResources() throws FileNotFoundException {
            // log available VRAM
            log.println("Available VRAM before loading resources: " + graphicsDevice.getAvailableAcceleratedMemory() + " bytes", Log.INIT);
            // determine whether or not we are dealing with the contents of a jar-file
            jar = getClass().getResource("").getProtocol().startsWith("jar");
            // browse all directories
            long start, end;
            int loadTime = -1;
            start = System.nanoTime();
            browseDirectory(".." + separator + "resources");
            end = System.nanoTime();
            loadTime = Math.abs((int)(end - start) / 1000000);
            resourcesLoaded = true;
            // log
            log.println("Resources loaded in " + loadTime + " ms", Log.INIT);
            // log available VRAM
            log.println("Available VRAM after loading resources: " + graphicsDevice.getAvailableAcceleratedMemory() + " bytes", Log.INIT);
         * Browse a directory and load and cache all it's files
         * @param path The directory to browse
        private void browseDirectory(String path) {
            // log
            log.println("Browsing directory: " + path.replaceFirst("\\W*", ""), Log.INIT);
            try {
                if (jar) {
                    // TODO: enable JAR-browsing by getting the input stream from the JAR-file, then browse through all entries
                    throw new RuntimeException("Cannot browse JAR-files yet!");
                else {
                    File dir = new File(getClass().getResource(path).toURI());
                    // browse through the directory
                    String[] files = dir.list();
                    File file;
                    for (String name: files) {
                        file = new File(dir.getAbsolutePath() + separator + name);
                        // if this is a new sub-directory, browse it
                        if (file.isDirectory()) browseDirectory(path + separator + file.getName());
                        // otherwise, add the file
                        else addFile(path, name);
            catch (Exception e) { e.printStackTrace(); }
        } But, as you may see, I need a similar code to browse the JAR-file....please help me!
    lhk

    I worked it out by trying and failing:
          * Browse the JAR-file and load all it's relevant files
         private void browseJar() {
              try {
                   // convert the resource directory path to a JAR-compatible path
                   String jarDir = dir.replaceAll("\\" + separator, String.valueOf(jarSeparator));
                   // get the jar-file and it's entries
                   Enumeration<JarEntry> entries = new JarFile(new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI())).entries();
                   // browse the contents of the file
                   JarEntry entry;
                   int nameIndex;
                   String name = null;
                   String path = null;
                   while (entries.hasMoreElements()) {
                        // get the entry
                        entry = entries.nextElement();
                        // we only process relevant entries
                        if (entry.getName().startsWith(jarDir)) {
                             nameIndex = entry.getName().lastIndexOf(jarSeparator);
                             name = entry.getName().substring(nameIndex + 1);
                             // if we find a new directory, we get it's path
                             if (entry.isDirectory()) {
                                  path = entry.getName().substring(jarDir.length(), nameIndex);
                                  if (path.startsWith(String.valueOf(jarSeparator))) path = path.substring(1) + jarSeparator;
                                  // log (the system-compatible path)
                                  log.println("Browsing directory: " + dir + separator + path.replaceAll(String.valueOf(jarSeparator), "\\" + separator), Log.INIT);
                             // otherwise, we add the resource
                             else addFile(path, name);
              catch (Exception e) { e.printStackTrace(); }
         }As may be seen in the code, I discovered that the regular file separator could not be used in jar paths, which I found strange. I tried a lot to make the regular separator work, but couldn't manage it. Anyway, this code works for me.

  • How to open a new window from the login window?

    hi,
    can someone tell me how to open a new window from an existing window, here by window i mean frame. The case is i hv two java files - oracle.java and FDoptions.java. The first frame is in the Login.java. The oracle.java file has a button "Login", when it is clicked, i want to open the next frame which is in the file FDoptions.java. Can some one help me with this? I m giving the code below -
    oracle.java
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    * The application's main frame.
    public class oracle {
        private JFrame frame;
        private JPanel logInPanel;
        private JButton clearButton;
        private JButton logInButton;
        private JButton newuserButton;
        private JButton forgotpasswordButton;
        private JTextField userNameTextField;
        private JPasswordField passwordTextField;
        public oracle() {
            initComponents();
        private final void initComponents() {
            JLabel userNameLabel = new JLabel("User name: ");
            JLabel passwordLabel = new JLabel("Password: ");
            userNameTextField = new JTextField();
            passwordTextField = new JPasswordField();
            JPanel userInputPanel = new JPanel(new GridLayout(2, 2, 5, 5));
            userInputPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20));
            userInputPanel.add(userNameLabel);
            userInputPanel.add(userNameTextField);
            userInputPanel.add(passwordLabel);
            userInputPanel.add(passwordTextField);
            logInButton = new JButton(new LogInAction());
            clearButton = new JButton(new ClearAction());
            newuserButton = new JButton(new NewUserAction());
            forgotpasswordButton = new JButton(new ForgotPassword());
            JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
            JPanel buttonPanel1 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
            buttonPanel.add(logInButton);
            buttonPanel.add(clearButton);
            buttonPanel1.add(newuserButton);
            buttonPanel1.add(forgotpasswordButton);
            logInPanel = new JPanel(new BorderLayout());
            logInPanel.add(userInputPanel, BorderLayout.NORTH);
            logInPanel.add(buttonPanel, BorderLayout.CENTER);
            logInPanel.add(buttonPanel1,BorderLayout.SOUTH);
            frame = new JFrame("FD Tracker");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(500, 500);
            frame.setContentPane(logInPanel);
            frame.pack();
            frame.setVisible(true);
        private void performLogIn() {
            // Log in the user
            System.out.println("Username: " + userNameTextField.getText());
            char[] password = passwordTextField.getPassword();
            System.out.print("Password: ");
            for(char c : password) {
                System.out.print(c);
            System.out.println();
        private void performClear() {
            // Clear the panel
            System.out.println("Clearing the panel");
            userNameTextField.setText("");
            passwordTextField.setText("");
        private final class LogInAction extends AbstractAction {
            public LogInAction() {
                super("Log in");
            @Override
            public void actionPerformed(ActionEvent e) {
                performLogIn();
        private final class ClearAction extends AbstractAction {
            public ClearAction() {
                super("Clear");
            @Override
            public void actionPerformed(ActionEvent e) {
                performClear();
        private final class NewUserAction extends AbstractAction{
             public NewUserAction(){
                 super("New User");
             @Override
             public void actionPerformed(ActionEvent e){
                 JFrame newuser = new JFrame("NewUser");
        private final class ForgotPassword extends AbstractAction{
            public ForgotPassword(){
                super("Forgot Password");
            @Override
            public void actionPerformed(ActionEvent e){
                JFrame forgotpassword = new JFrame("Forgot Password");
        public static void main(String args[]) {
            new oracle();
         FDoptions.java
    import java.awt.FlowLayout;
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.BorderFactory;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class Fdoptions{
        private JFrame fdoptions;
        private JPanel fdoptpanel;
        private JButton enterfdbutton;
        private JButton viewfdbutton;
        public Fdoptions() {
            initComponents();
        private final void initComponents(){
            fdoptpanel = new JPanel(new BorderLayout());
            fdoptpanel.setBorder(BorderFactory.createEmptyBorder(80,50,80,50));
            enterfdbutton = new JButton(new EnterFDAction());
            viewfdbutton = new JButton(new ViewFDAction());
           JPanel enterbuttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
           JPanel viewbuttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
            enterbuttonpanel.add(enterfdbutton);
            viewbuttonpanel.add(viewfdbutton);
            fdoptpanel.add(enterbuttonpanel,BorderLayout.NORTH);
            fdoptpanel.add(viewbuttonpanel,BorderLayout.SOUTH);
            fdoptions = new JFrame("FD Options");
            fdoptions.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            fdoptions.setSize(1000,1000);
            fdoptions.setContentPane(fdoptpanel);
            fdoptions.pack();
            fdoptions.setVisible(true);
        private void performEnter(){
        private void performView(){
        private final class EnterFDAction extends AbstractAction{
            public EnterFDAction(){
                super("Enter new FD");
            public void actionPerformed(ActionEvent e){
                performEnter();
        private final class ViewFDAction extends AbstractAction{
            public ViewFDAction(){
                super("View an existing FD");
            public void actionPerformed(ActionEvent e){
                performView();
        public static void main(String args[]){
            new Fdoptions();
    }

    nice day,
    these lines..., despite the fact that this example is about something else, shows you two ways
    1/ modal JDialog
    2/ two JFrame
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    * Parent Modal Dialog. When in modal mode, this dialog
    * will block inputs to the "parent Window" but will
    * allow events to other components
    * @see javax.swing.JDialog
    public class PMDialog extends JDialog {
        private static final long serialVersionUID = 1L;
        protected boolean modal = false;
        private WindowAdapter parentWindowListener;
        private Window owner;
        private JFrame blockedFrame = new JFrame("No blocked frame");
        private JFrame noBlockedFrame = new JFrame("Blocked Frame");
        public PMDialog() {
            noBlockedFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            noBlockedFrame.getContentPane().add(new JButton(new AbstractAction("Test button") {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent evt) {
                    System.out.println("Non blocked button pushed");
                    blockedFrame.setVisible(true);
                    noBlockedFrame.setVisible(false);
            noBlockedFrame.setSize(200, 200);
            noBlockedFrame.setVisible(true);
            blockedFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
            blockedFrame.getContentPane().add(new JButton(new AbstractAction("Test Button") {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent evt) {
                    final PMDialog pmd = new PMDialog(blockedFrame, "Partial Modal Dialog", true);
                    pmd.setSize(200, 100);
                    pmd.setLocationRelativeTo(blockedFrame);
                    pmd.getContentPane().add(new JButton(new AbstractAction("Test button") {
                        private static final long serialVersionUID = 1L;
                        @Override
                        public void actionPerformed(ActionEvent evt) {
                            System.out.println("Blocked button pushed");
                            pmd.setVisible(false);
                            blockedFrame.setVisible(false);
                            noBlockedFrame.setVisible(true);
                    pmd.setVisible(true);
                    System.out.println("Returned from Dialog");
            blockedFrame.setSize(200, 200);
            blockedFrame.setLocation(300, 0);
            blockedFrame.setVisible(false);
        public PMDialog(Dialog parent, String title, boolean isModal) {
            super(parent, title, false);
            initDialog(parent, title, isModal);
        public PMDialog(Frame parent, String title, boolean isModal) {
            super(parent, title, false);
            initDialog(parent, title, isModal);
        private void initDialog(Window parent, String title, boolean isModal) {
            owner = parent;
            modal = isModal;
            parentWindowListener = new WindowAdapter() {
                @Override
                public void windowActivated(WindowEvent e) {
                    if (isVisible()) {
                        System.out.println("Dialog.getFocusBack()");
                        getFocusBack();
        private void getFocusBack() {
            Toolkit.getDefaultToolkit().beep();
            super.setVisible(false);
            super.pack();
            super.setLocationRelativeTo(owner);
            super.setVisible(true);
            //super.toFront();
        @Override
        public void dispose() {
            owner.setEnabled(true);
            owner.setFocusableWindowState(true);
            super.dispose();
        @Override
        @SuppressWarnings("deprecation")
        public void hide() {
            owner.setEnabled(true);
            owner.setFocusableWindowState(true);
            super.hide();
        @Override
        public void setVisible(boolean visible) {
            boolean blockParent = (visible && modal);
            owner.setEnabled(!blockParent);
            owner.setFocusableWindowState(!blockParent);
            super.setVisible(visible);
            if (blockParent) {
                System.out.println("Adding listener to parent ...");
                owner.addWindowListener(parentWindowListener);
                try {
                    if (SwingUtilities.isEventDispatchThread()) {
                        System.out.println("EventDispatchThread");
                        EventQueue theQueue = getToolkit().getSystemEventQueue();
                        while (isVisible()) {
                            AWTEvent event = theQueue.getNextEvent();
                            Object src = event.getSource();
                            if (event instanceof ActiveEvent) {
                                ((ActiveEvent) event).dispatch();
                            } else if (src instanceof Component) {
                                ((Component) src).dispatchEvent(event);
                    } else {
                        System.out.println("OUTSIDE EventDispatchThread");
                        synchronized (getTreeLock()) {
                            while (isVisible()) {
                                try {
                                    getTreeLock().wait();
                                } catch (InterruptedException e) {
                                    break;
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("Error from EDT ... : " + ex);
            } else {
                System.out.println("Removing listener from parent ...");
                owner.removeWindowListener(parentWindowListener);
                owner.setEnabled(true);
                owner.setFocusableWindowState(true);
        @Override
        public void setModal(boolean modal) {
            this.modal = modal;
        public static void main(String args[]) {
            new PMDialog();
    }

  • How to open a document out side the .war file

    Hi all,
    I have initially stored a document outside the WEB-INF in the .war file to retrieve it from a jsp file of the same war file. But now the file has been stored at a location on the same server and outside the .war file. how can I retrieve the file path and location outside the war file from the jsp. I ve previously used the following code when retrieving from a directory "docs" of the same .war file as:
                      <td  class="FormLableLeft"><a href="#" onClick=window.open("/docs/<%=colData.get("DOCUMENT_NAME")%>")><%=colData.get("File_NAME")%></a> </td>please suggest me how to retrieve the document located outside the war.

    Create a servlet which reads the file from the local file system and writes it to the outputstream of the response after having set the response headers accordingly. Then simply call that servlet by URL along with the file ID as request parameter or pathinfo. You may find this example useful: [http://balusc.blogspot.com/2007/07/fileservlet.html].

  • How to extract any picture (frame) from the video file

    I am writing an application that is going to show the grid of tiles. Each tile should have picture that is frame from some particular video.
    Basically something similar to Photos or Videos - standard Windows Phone app.
    The question is how can i extract any picture from the video to put it as picture of the tile or button?

    I pinged you offline.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Extract BPEL process from the JAR file deployed to BPEL Server

    Hello All-
    We have a BPEL process deployed in our production environment but unfortunately we do not have a back-up copy in our test environment.
    I got the BPEL deployment JAR file from the production server but I am unable to extract the BPEL Process as well as the XSL file.
    I used WINRAR to extract but it was showing that the JAR file is not a valid archive. We need the prod deployed version of the XSL as well as the BPEL process for a change and we are unable to proceed.
    If anybody has faced similar kind of issue, please let me know how can it be resolved. Also please let me know if there are any tools which can extract the files.
    PLease note that we are on BPEL 10.1.2.0.2
    Appreciate your help and thanks in advance.
    Thanks,
    Dibya

    Hi Dibya
    jar -xvf <filename> will work as others said.
    However, please make sure you have another TEST/DEV Environment running in par with PROD.
    Always, suggested to test first on the TEST/DEV Env for applying any new patches/config changes...then appropriately migrate to actual PROD Environments.
    Also, always take a complete backup before you do some R&D on the SOA server.
    Regards
    A

  • How do I remove an entry from the "Store Files" drop down list in the "Import Settings" section of Aperture 3.3.2

    The dropdown list "Store Files" in the "Import Settings" section of Aperture 3.3.2 displays the history of the entries previously added to the list. Some of the entries are no longer valid and I'm trying to delete them but I can't find a way to do this. This is a screenshot. Does anyone know how to do this?

    Once again - the Jive system ate my bullet points and messed up the formatting
    Is the MacOS X version in your signature correct? Then you cannot be using Aperture 3.3.2?
    You should not be seeing duplicate entries in the "Store Files" pop-up menu. This looks like your Aperture Preferences file is corrupted and needs fixing.
    Quit Aperture (and log off and on again, if you are running MacOS X 10.7 or later)
    Then reveal your User Library (from the Finder's main menu bar, the "Go" menu. Hold down the options-key until the library apears in the drop-down menu)
    In the Library folder select the "Preferences folder and locate the file "~/Library/Preferences/com.apple.Aperture.plist"
    Now you can either
    remove the com.apple.Aperture.plist file to the Desktop, to force Aperture to create a new one, but you will have to set again your Preferences from the "Preferences" panel,
    or make a backup copy of the file and edit it, if you are an experienced programmer and have Xcode installed. To fix the drop-down list you need to edit the item "RecentReferenceFolders" and delete the redundant folder names. Enter "recent" into the search field to find it quickly. If you click an item in the list, plus/minus buttons should appear. But only try this, if you know how to edit property lists, otherwise it will be much safer to delete the faulty list and to set your preferences again from the "Preferences" panel.
    Regards
    Léonie

  • "no manifiest section for signature file entry" when run the Jar file

    I built an application by using JBuilder 8.0 and it works fine. But when I deploy it into a jar file, whenever I run it, the following exception appears:
    Exception in thread "main" java.lang.SecurityException: no manifiest section for signature file entry javax/security/cert/Certificate.class
    at sun.securtiy.util.SignatureFileVerifier.verifySection
    Because I didn't do anything about the security when build the application. I am really confused. Can somebody help?

    I had a similiar problem using NetBeans. There must be a way to view the properties of your jar from Jbuilder and set its manifest. I am very new to this myself, but all I did was edit another manifest and copied into mine. Here is my example manifest:
    Manifest-Version: 1.0
    Main-Class: J3Ed
    The first line is the default line for a manifest. It is very simple and there is much more that could be added, but is not always necessary. I recommend reading the documentation :
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.html
    Also if you have an archiving utility such as powerarchiver or winzip, open your JAR and check to see that you have a MANIFEST.MF file. If you do then edit it where needed, if not create one and its relative location should be set to META-INF/MANIFEST.MF.
    Hope this helps.

  • How to open local system folder from the browser

    Hi All,
    I'm working on some stuff, wherein the user downloads the files from internet to his local machine. I'm able to catch the path of the folder where user wants to download the file from SaveAs prompt. Now my requirement is , i want to provide a link button or
    a button on the web page and assign this is folder path dynamically so that when the user clicks on it, it should open the local system folder where he has downloaded the files.
    string myDocspath
    =Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    string windir
    = Environment.GetEnvironmentVariable("WINDIR");
    System.Diagnostics.Process prc
    = new System.Diagnostics.Process();
    prc.StartInfo.FileName = windir + @"\explorer.exe";
    prc.StartInfo.Arguments = myDocspath;
    prc.Start();
    Work fine with local system, if i host the application in IIS , the above code snippet wont work
    Thanks in advance,
    Suraj Kumar 
    Software Engineer

    Hello,
     local resources is disabled in all modern browsers due to security restrictions.
     if the reply help you mark it as your answer.
     Free No OLE C#
    Word,  PDF, Excel, PowerPoint Component(Create,
    Modify, Convert & Print) 

  • Opening a dialog window from the JSX file

    I can open a new window in a normal jsx script with
    var dlgMain = new Window();
    dlgMain.show();
    But this code will give an EvalScript error when run inside a JSX file in an HTML5 extension. (What I actually need is to open a file selector window and get the full path of the file). How can I do this with an HTML5 extension?

    Solved with the following code:
                        var inFolder = File.openDialog("Select File");
                        var idPlc = charIDToTypeID("Plc ");
                        var desc1 = new ActionDescriptor();
                        var idnull = charIDToTypeID("null");
                        desc1.putPath(idnull, new File(inFolder));
                        var idFTcs = charIDToTypeID("FTcs");
                        var idQCSt = charIDToTypeID("QCSt");
                        var idQcsa = charIDToTypeID("Qcsa");
                        desc1.putEnumerated(idFTcs, idQCSt, idQcsa);
                        var idOfst = charIDToTypeID("Ofst");
                        var desc2 = new ActionDescriptor();
                        var idHrzn = charIDToTypeID("Hrzn");
                        var idPxl = charIDToTypeID("#Pxl");
                        desc2.putUnitDouble(idHrzn, idPxl, 0.000000);
                        var idVrtc = charIDToTypeID("Vrtc");
                        var idPxl = charIDToTypeID("#Pxl");
                        desc2.putUnitDouble(idVrtc, idPxl, -0.000000);
                        var idOfst = charIDToTypeID("Ofst");
                        desc1.putObject(idOfst, idOfst, desc2);
                        executeAction(idPlc, desc1, DialogModes.NO);

  • How do I read the images I bundled into the jar file?

    I just wrote an applet that uses
         Toolkit tk = Toolkit.getDefaultToolkit();
         tk.getImage("blah.gif");to load a bunch of image files. The class file and gif images were bundled into a jar file to minimize the number of connections the browser has to make to the server.
    The applet works fine in appletviewer but trips a java.security.AccessControlException: access denied (java.io.FilePermission select.gif read) when run in a browser. I know you normally use Applet.getImage(URL) to load images but wont that circumvent the JAR file and make a seperate connection to the server for each image? That would defeat the purpose of using a JAR file.
    How do I access the image files I bundled into the JAR file?

    From your Applet class, write the following:
    URL imgUrl = getClass().getResource("blah.gif");
    Image img = getImage(imgUrl);The returned URL will be from the Applet class ClassLoader, which will look into the specified archive (jar) file.

  • ServiceBus java callout - how to pack the JAR file with libraries?

    Hello
    I want to use a Java Callout from a Service Bus flow.
    What is the correct way to pack the JAR file with its nessecary libraries?
    I tried different methods to pack my JAR, but yet, as though the Java runs perfectly from the Workshop (Eclipse) , when I am trying to use the exported Jar on the ServiceBus flow, it fails with an ClassNotFoundException.
    I would really appreciate your advice here.
    Thanks
    Koby

    Well.. Looking inside my exported JAR file, I got all of the files there inside, including the jar file containing the library.
    What I'm trying to do is run a simple java program that connect through SSH and therefore use an SSH library.
    On the workshop I got it as an imported library JAR. And it works perfectly there.
    Any idea?
    Here's the complete error I get:
    <BEA-382515> <Callout to java method "public static java.lang.String sshpackage.SshProg.remoteScriptInvoke(java.lang.String,java.lang.String,java.lang.String,java.lang.String)" resulted in exception: null
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at stages.transform.runtime.JavaCalloutRuntimeStep$1.run(JavaCalloutRuntimeStep.java:158)
    Truncated. see log file for complete stacktrace
    java.lang.NoClassDefFoundError: ch/ethz/ssh2/Connection
    at sshpackage.SshProg.remoteScriptInvoke(SshProg.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    Truncated. see log file for complete stacktrace
    java.lang.ClassNotFoundException: ch.ethz.ssh2.Connection
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at com.bea.wli.sb.resources.archive.HookedJarClassLoader.loadClass(HookedJarClassLoader.java:251)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    Truncated. see log file for complete stacktrace
    Edited by: kobyssh on 04:12 01/02/2010

Maybe you are looking for

  • Once a form has been signed with a digital signature, why can't you insert a bookmark?

    We are using Adobe 9 on Windows XP, I'm not sure what the forms are created in. I understand why you wouldn't allow a form to be changed once it's been signed digitally (because the person is attesting to the contents as they are when the person sign

  • IPhoto DVD

    Recently installed iPhoto 08. I only have about 60% of the original folders showing up and I can't locate the remainders. Secondly, I tried to backup what was left to DVD and it won't permit me to drag and drop icons from iPhoto to DVD. A white circl

  • Critical abap hr req - How to find the previous org unit of the employee?

    Hi Experts , I need small inputs from your end... I need to find the employee org unit based on the latest one..... i just want to know if an employe is Transfered from the org unit .....we can check it from the ORG unit. My requirement is to now cap

  • HOW TO CREATE SEVERAL folder for the generation and READING FILE

    HOW TO CREATE SEVERAL folder for the generation and READING FILE WITH THE COMMAND utl_File. please give an example to create 3 folders or directories ... I appreciate your attention ... Reynel Martinez Salazar

  • Adding Text datasource

    Hi, i have this situation. there exist flat file datasource that  has the option of loading master data, text and hierarchy. right now there is only infopackage for loading master data. I have tried right click - create infopackage for loading text b