Problem in file association and main-class in JWS

Hello , all
I have a problem in JWS with file association and main-class. I have a java application that has two entry classes, one is appmain.class that is required to launch from web, and the other is player.class that is required to launch when user double-click the .abc extension file.
In JWS 5.0+, there is a association element in JNLP syntax that can be used to make the file association with .abc extension. But how can I declare the main-class in JNLP file?
If I declare the application-desc element as <application-desc main-class="player">, the player.class will be launched from web. But if I declare it as <application-desc main-class="appmain">, the .abc extension wil be associated to the appmain.class.
Does anyone know how to solve this problem? Thank you for your kindly help.

One way is to define a third main that refers
to the other two, as appropriate. E.G. if the
web based main does not include -open as
its arguments, it is easy.class WebStartSpringboard {
  /** Call web based main unless args include -open. */
  public static void main(String[] args) {
    if (args[0].equals("-open") ) {
      OpenFileBasedClass.main(args);
    } else {
      WebBasedClass.main(args);
}Other measures might be taken for a situation
where the web based version does include a
-open argument.

Similar Messages

  • How can I assign image file name from Main() class

    I am trying to create library class which will be accessed and used by different applications (with different image files to be assigned). So, what image file to call should be determined by and in the Main class.
    Here is the Main class
    import org.me.lib.MyJNIWindowClass;
    public class Main {
    public Main() {
    public static void main(String[] args) {
    MyJNIWindowClass mw = new MyJNIWindowClass();
    mw.s = "clock.gif";
    And here is the library class
    package org.me.lib;
    public class MyJNIWindowClass {
    public String s;
    ImageIcon image = new ImageIcon("C:/Documents and Settings/Administrator/Desktop/" + s);
    public MyJNIWindowClass() {
    JLabel jl = new JLabel(image);
    JFrame jf = new JFrame();
    jf.add(jl);
    jf.setVisible(true);
    jf.pack();
    I do understand that when I am making reference from main() method to MyJNIWindowClass() s first initialized to null and that is why clock could not be seen but how can I assign image file name from Main() class for library class without creating reference to Main() from MyJNIWindowClass()? As I said, I want this library class being accessed from different applications (means different Main() classes).
    Thank you.

    Your problem is one of timing. Consider this simple example.
    public class Example {
        public String s;
        private String message = "Hello, " + s;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example();
            ex.s = "world";
            System.out.println(ex.toString());
    }When this code is executed, the following happens in order:
    1. new Example() is executed, causing an object to constructed. In particular:
    2. field s is given value null (since no value is explicitly assigned.
    3. field message is given value "Hello, null"
    4. Back in method main, field s is now given value "world", but that
    doesn't change message.
    5. Finally, "Hello, null" is output.
    The following fixes the above example:
    public class Example {
        private String message;
        public Example(String name) {
            message = "Hello, " + name;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example("world");
            System.out.println(ex.toString());
    }

  • Manifest file and main class location problem

    my main class is in not in the root of the jar file, it is down a package tree structure, and whenever I run the jar it says
    Failed to load Main-Class manifest attribute from
    xxxxx.jar
    How do I specify the location of the main class? like this??
    Main-Class: com/Utilities/visual/Model
    thanks for your help.

    It should be
    Main-Class: com.Utilities.visual.Model
    and make sure your manifest file has an empty line at the end of your file (i.e. press enter after the last line in your manifest line).

  • Jar files and Main-Class attribute

    Sorry, I know there are other topics regarding this argument but none of them helped me solving my problem.
    I've tried a thousand time in every possible way, but I still can't run my application from a jar file. I've got a package called client, whose main class is called Client. The package contains a sub-package called Icons. I've put everything into a jar file and added this manifest:
    Manifest version: 1.0
    Name: client/
    Sealed: True
    Main-Class: client.Client
    But it won't work. I've tried to erase the Sealed part, I've tried "Main-Class: Client" and also "client/Client", I've tried putting into the jar the client directory and I've tried omitting it, but the answer is always the same:
    Failed to load main-class header etc.
    Can anyone help me? Please, I'm almost desperate!
    Thanks

    Here's the verbose-mode description of what I did.
    jar -cfv client.jar clientaggiunto manifesto
    aggiunta in corso di: client/(in = 0) (out= 0)(archiviato 0%)
    aggiunta in corso di: client/.nbattrs(in = 767) (out= 310)(compresso 59%)
    aggiunta in corso di: client/Client.class(in = 533) (out= 340)(compresso 36%)
    aggiunta in corso di: client/Client.java(in = 288) (out= 140)(compresso 51%)
    aggiunta in corso di: client/ClientForm$1.class(in = 691) (out= 383)(compresso 44%)
    aggiunta in corso di: client/ClientForm$10.class(in = 678) (out= 380)(compresso 43%)
    aggiunta in corso di: client/ClientForm$11.class(in = 689) (out= 385)(compresso 44%)
    aggiunta in corso di: client/ClientForm$2.class(in = 686) (out= 379)(compresso 44%)
    aggiunta in corso di: client/ClientForm$3.class(in = 686) (out= 381)(compresso 44%)
    aggiunta in corso di: client/ClientForm$4.class(in = 686) (out= 380)(compresso 44%)
    aggiunta in corso di: client/ClientForm$5.class(in = 686) (out= 383)(compresso 44%)
    aggiunta in corso di: client/ClientForm$6.class(in = 718) (out= 399)(compresso 44%)
    aggiunta in corso di: client/ClientForm$7.class(in = 718) (out= 400)(compresso 44%)
    aggiunta in corso di: client/ClientForm$8.class(in = 718) (out= 399)(compresso 44%)
    aggiunta in corso di: client/ClientForm$9.class(in = 718) (out= 398)(compresso 44%)
    aggiunta in corso di: client/ClientForm.class(in = 33070) (out= 13510)(compresso 59%)
    aggiunta in corso di: client/ClientForm.form(in = 131398) (out= 4521)(compresso96%)
    aggiunta in corso di: client/ClientForm.java(in = 73435) (out= 6863)(compresso 90%)
    aggiunta in corso di: client/Icons/(in = 0) (out= 0)(archiviato 0%)
    aggiunta in corso di: client/Icons/brick.gif(in = 1044) (out= 1049)(compresso 0%)
    aggiunta in corso di: client/Icons/corpo.gif(in = 4011) (out= 3400)(compresso 15%)
    aggiunta in corso di: client/Icons/door.gif(in = 1092) (out= 1097)(compresso 0%)
    aggiunta in corso di: client/Icons/floor.gif(in = 1102) (out= 1107)(compresso 0%)
    aggiunta in corso di: client/Icons/mappa.gif(in = 20901) (out= 20575)(compresso 1%)
    aggiunta in corso di: client/Icons/paesaggio.gif(in = 18962) (out= 18603)(compresso 1%)
    aggiunta in corso di: client/Icons/sole.gif(in = 7063) (out= 6546)(compresso 7%)
    aggiunta in corso di: client/Icons/trap.gif(in = 1062) (out= 1067)(compresso 0%)
    aggiunta in corso di: client/Icons/void.gif(in = 842) (out= 847)(compresso 0%)
    aggiunta in corso di: client/Listener.class(in = 1869) (out= 1136)(compresso 39%)
    aggiunta in corso di: client/Listener.java(in = 2296) (out= 708)(compresso 69%)
    aggiunta in corso di: client/manifesto.txt(in = 62) (out= 58)(compresso 6%)
    aggiunta in corso di: client/ScorciatoieDialog$1.class(in = 740) (out= 391)(compresso 47%)
    aggiunta in corso di: client/ScorciatoieDialog$PopupListener.class(in = 1579) (out= 773)(compresso 51%)
    aggiunta in corso di: client/ScorciatoieDialog.class(in = 3524) (out= 1638)(compresso 53%)
    aggiunta in corso di: client/ScorciatoieDialog.form(in = 8500) (out= 910)(compresso 89%)
    aggiunta in corso di: client/ScorciatoieDialog.java(in = 5676) (out= 1222)(compresso 78%)
    jar umf mainclass.txt client.jar[NOTE: mainclass.txt only contains the line "Main-Class: client.Client"]
    java -jar client.jarFailed to load Main-Class manifest attribute from
    client.jar
    I've also tried to manually create a MANIFEST.MF file that only contained the following lines:
    Manifest Version: 1.0
    Main-Class: client.Client
    guess what was the result?
    java -jar client.jarException in thread "main" java.io.IOException: invalid manifest format
    at java.util.jar.Manifest.read(Manifest.java:193)
    at java.util.jar.Manifest.<init>(Manifest.java:52)
    at java.util.jar.JarFile.getManifest(JarFile.java:158)
    >
    the same procedure with the addition of "Name: client/" before the main-class attribute generated the usual "Failed to load Main-Class manifest attribute" result. So now what?!? I'm getting crazy....

  • Jar files and Main-Class headers

    I think I already posted this, but I can't find it on the forum...my apologies if it's already there and I'm just blind or something.
    I have a bunch of classes in the directory C:/chess/server , and I want to make a .jar file with these classes. The class with the main method is server/ChessServer.class . From which folder should I create a jar file with these classes, and how exactly should I label the Main-Class header in the manifest file? Also, what's the purpose of the "Name:" header?
    I know the topic is posted a lot, but I've tried many different ways and I can't get this to work. I get many variations on the "NoClassDefFoundError". I know the classes themselves are fine because they work perfectly when they're not in a .jar file.
    Thanks in advance!

    I tried that, and it still doesn't work. I used the command C:\chess> jar 0cmf manifest.mf MuChess.jar server . Manifest.mf is:
    Main-Class: server.ChessServer
    Sealed: true
    When I try to run it with C:\chess> java -jar MuChess.jar , I get:
    Exception in thread "main" java.lang.NoClassDefFoundError: server/ChessServer (w
    rong name: ChessServer)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    When I unpack the file with my excraction utility, I get get two folders: One is "server", and contains all the files it should--including ChessServer--, and the other is "META-INF" and contains the following MANIFEST.MF file:
    Manifest-Version: 1.0
    Sealed: true
    Created-By: 1.4.1_03 (Sun Microsystems Inc.)
    Main-Class: server.ChessServer
    Any ideas?

  • Problem with file association

    I have read on this forum that people have problem with the file association when they haved installed StarOffice 8. I have the same problem.
    I install StarOffice on a computer as network administrator - every thing looks fine. When i then log off and log on as a usual user the file association for MS Office files (.doc, .xls, .ppt) are gone. I will not have the users to change the file association by their own because they don't know how to do.
    I know we have the same problem when we first install StarOffice 7. I got a register hack that changed the association. Now i have tried to change the path's in the registerhack and run it again - but it wont work for SO8. :(
    Is there anyone out here who know a solution for this problem?
    As i mention earlier I have seen many people in the forum with the same problem - but I haven't seen a solution for it.
    // Stefan

    I came across the same problem on windows XP SP2 machines.
    I created a registry key that forces the file associations as follows:
    Windows Registry Editor Version 5.00
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.doc\shell&#93;
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.doc\shell\open&#93;
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.doc\shell\open\command &#93;
    @="\"C:\\Program Files\\Sun\\StarOffice 8\\program\\soffice.exe\" \"%1\""
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xls\shell&#93;
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xls\shell\open&#93;
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xls\shell\open\command &#93;
    @="\"C:\\Program Files\\Sun\\StarOffice 8\\program\\soffice.exe\" \"%1\""
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.ppt\shell&#93;
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.ppt\shell\open&#93;
    &#91;HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.ppt\shell\open\command &#93;
    @="\"C:\\Program Files\\Sun\\StarOffice 8\\program\\soffice.exe\" \"%1\""

  • Java .class files - Moving the Main Class .class file to a new location

    Novice question....so much so that I hope it's even coherent...
    In a Java program which references many associated .class files (e.g. bicycleMain.class, bicycleSub1.class, bicycleSub2.class, etc....), do the associated .class files always have to be located in the same directory as the Main .class file?
    What I'm getting at is - If I've developed an application consisting of several .class files on my own Windows PC and I want to put the compiled application out on our Windows File Server so that anyone can execute my application, how would I go about doing this?
    Say I put the compiled .class files in H:\PROJECTS\JAVA\COMPILED\, will other people be able to execute the application from their PCs by simply issuing the command line:
    'java h:\projects\java\compiled\bicycleMain'
    Any insights would be very helpful in getting me oriented. Thanks in advance.

    Interesting...so are you saying the command line might look something like this:
    java -classpath h:\projects\java\compiled bicycleMain
    And if I want other people to be able to execute the application without specifying the -classpath option then they would need to manually update the ClassPath environment variable on their individual PCs first?

  • Installer problems - Could not find the main class

    Hello
    I am trying to install openmq on vista and having problems. I've had the same problem with a nightly build of 4.3 and stable 4.2 build. The install kicks off fine until I get to the part where the install happens and then I get:
    Java Virtual Machine Launcher : Could not find the main class. Program will exit
    I have several sun JREs/JDKs installed and have tried all of them, the installer itself is not impacted:
    jre 1.7.0
    jdk 1.7.0
    jre 1.6.0.7
    jre 1.6.0.7 and jre 1.6.0.7
    Am I missing something obvious or is there a way of installing without the java installer ?
    Much obliged
    Edited by: Alphawave on Oct 14, 2008 11:39 AM

    Hi,
    I've seen this error before on vista. In the past the users saw this message when they didn't have write permission on the directory they were installing to. Even with administrator privileges, they still need write permissions.
    A quick test is to:
    login as the user you are installing as.
    cd to the directory you are installing into.
    touch foo // to see if you can write to the dir.
    Thanks.

  • Default file associations and RTF (rich text format)

    I use pop3 email accounts for work.
    I receive daily emails with .rtf (rich text format) file attachments.
    When I open the emails, the attachments are listed.
    I touch to open and QuickOffice loads to open them.
    According to the QuickOffice website, QuickOffice does not support rtf files.. and it certainly does error on them. Why does QuickOffice open at all? I do not need any of its functions except the one it doesn’t have.
    I have installed at present, this list of file managers.
    Android’s default file manager
    OI File Manager
    Astro file manager
    Cool reader
    All of these applications support rtf files.
    How do I set the file association for rtf files to an application which supports them?
    Thanks for reading.

    I have the same problem any help would be appreciated

  • Problem of file association while copying files from the network.

    Hello,
    I have a network shared folder with Quark Xpress files on it. I own an Imac with MacOSX 10.4.3 where Quark Xpress is not installed but I want to transfer Quark files from this network share to an other.
    When I do this, the file association is missing on the copied file. The original has still the Quark icon, but the copied file has a blank icon and when trying to execute it from a mac with Quark Xpress installed, it does not recognize it (?). It's kind of a file association loose.
    For information, when I do the same manipulation using a mac with OS9 and Quark installed, I have no problem with the file association in output.
    Hope someone had the same situation to help me. In anyway, sorry for my English, I tried to do my best to explain my problem !

    Zip the files. Select the files, Finder->File->Make Archive, transfer them, and unzip them using the Finder or Stuffit Expander.

  • Refering FXML file element into Main class in Javafx

    Hi,
      Is it possible to refer FXML file elements or components  in main class in javafx?
       if possible then how?

    Typically you define a controller class to interact with the UI components. You can inject components into the controller by defining them as fields annotated with @FXML, and then define a fx:id attribute for those elements in the FXML file with attribute values matching the variable name in the controller class. There's a example in the "Adding Rows to the Table" section of the FXML tutorial.

  • Problem with file association in Photoshop

    I am using Adobe Photoshop CS4, and I also have Adobe After Effects on my computer (which I don't use).  For some reason, when I click on a photograph in Adobe Bridge, the After Effects program opens, but the photo I want to open in Photoshop does not open.  I have reset the file associations in Photoshop, but Bridge ignores the settings and will only open After Effects.  How can I prevent this and return to having Photoshop open my photographs?
    Thank you for your help.

    Might try posting in the Bridge forum.
    If you're runign a Macinotsh, you an trash the bridge.plist but that's not always a good idea so don't do that till you know there's no better answer.

  • Performance problems with File Adapter and XI freeze

    Hi NetWeaver XI geeks,
    We are deploying a XI based product and encounter some huge performance problems. Here after the scenario and the issues:
    - NetWeaver XI 2004
    - SAP 4.6c
    - Outbound Channel
    - No mapping used and only the iDocs Adapter is involved in the pipeline processing
    - File Adapter
    - message file size < 2Ko
    We have zeroed down the problem to Idoc adapter’s performance.
    We are using a file channel and  every 15 seconds a file in a valid Idoc format is placed in a folder, Idoc adapter picks up the file from this folder and sends it  to the SAP R/3 instance.
    For few minutes (approx 5 mins) it works (the CPU usage is less then 20% even if processing time seems huge : <b>5sec/msg</b>) but after this time the application gets blocked and the CPU gets overloaded at 100% (2 processes disp_worker.exe at 50% each).
    If we inject several files in the source folder at the same time or if we decrease the time gap (from 15 seconds to 10 seconds) between creation of 2 Idoc files , the process blocks after posting  2-3 docs to SAP R/3.
    Could you point us some reasons that could provoke that behavior?
    Basically looking for some help in improving performance of the Idoc adapter.
    Thanks in advance for your help and regards,
    Adalbert

    Hi Bhavesh,
    Thanks for your suggestions. We will test...
    We wonder if the hardware is not the problem of this extremely poor performance.
    Our XI server is:
    •     Windows 2003 Server
    •     Processors: 2x3GHZ
    •     RAM: 4GB (the memory do not soak)
    The messages are well formed iDocs = single line INVOICES.
    Some posts are talking 2000 messages processed in some seconds... whereas we got 5 sec per message.
    Tnanks for your help.
    Adalbert

  • Problem using file sharing and screen sharing in Leopard

    I have Mac OS 10.5 Leopard installed on 4 computers in a Home Network and have a problem with sharing files and using screen sharing. Here is my setup.
    MacBook Pro with my logon ID
    MacBook Pro with my fiancee's logon ID
    Mac Mini with both of our logon ID's
    Mac Pro with both of our logon ID's
    The problem I have is I am able to access the Mac Mini computer where we have an external Hard Drive connected for data. She is also able to access it. The only problem is we have it set up to only share this external USB drive. Yet for both of us it shares the external drive along with the internal Macintosh HD. Fortunately this is not a very big deal but since I'm not sharing all those drives why is it doing this?
    Also, I am able to connect from the Mac Mini for example to my MBP and vice versa for screen sharing along with file sharing. Yet if she tries to connect to the Mac Pro from her MBP and vice versa it won't. It simply times out and will never connect for screen sharing or file sharing but yet the Finder shows the Mac Pro. We have a 2nd hard drive in the Mac Pro which is the one set up for file sharing. I am also unable to connect to the Mac Pro's HD. Everything appears to be set up correctly. For my MBP on the Finder it shows the Mac Pro but once again I am unable to connect to it for screen sharing or file sharing.
    Also, not sure if it's related but even for her MBP she is unable to connect to it from any other computer in our network although it's set up for file sharing and screen sharing so I'm not sure if it's related to her logon ID. Then again as mentioned above neither of us can connect to the Mac Pro.
    I tried to make the above sound as simple as possible. I am relatively new to networking and of course Leopard but even on the Mac Pro all settings sound the same as on the Mac Mini where we can both connect to. The only big difference is on the Mini we are connect to a USB external drive, on the Mac Pro an internal drive. Is there something I could have overlooked or are there known issues with Leopard's sharing features?
    We both have .mac but since we are using this on an internal network (some wi-fi, some wired, all through an Airport Base Station Extreme) I would think this has nothing to do with Back to my Mac.
    I appreciate any help with the above.

    FaceTime doesn't do any of that, so I'll assume you mean Messages.
    From the Messages menu bar, select
    Video ▹ Connection Doctor
    In the window that opens, select
    Show: Capabilities
    There should be a checkmark on the line with the words "1-on-1 video chat." Select
    Show: Network Status
    You should have two green dots.
    Make sure that you and the other party meet the applicable requirements shown in these support articles:
    Share your screen
    Requirements for audio chats, video chats, and screen sharing
    See also:
    Fix video chat issues

  • Unable to download from AppStore, updates,etc.Messages 'the installer is damaged' to 'there might be a problem with file ownership and permissions.' I am the owner and only user of a new MBP. What could be going on?

    Is anyone having the same type of problems I'm having with Lion. I have a new MacBook Pro, received 7 weeks ago, preinstalled with Leopard 10.6.7. I didn't migrate anything from my old iMac, wanted a clean install from the Apple Store. While there, I asked for the upgrade to Lion 10.7, however their system was down.
    I  installed it myself, wirelessly about a week later, and Apple emailed me a receipt. Now, I've had to call support directly last week when I lost Mail, Address Book, was unable to open Preview or iTunes, among other problems. Seemed fixed after a session that baffled even the store tech.  Now I am unable to download or install the recent Mac updates for Lion, from the App Store, could not install Adobe Reader, etc. Messages range from 'A network error has occured - Check your Internet connection and try again' to 'The Installer is damaged and cannot open the package. There may be a problem with file ownership or permissions.'  All fail and I'll probably have to call Apple again. I am frustrated beyond words.  Logs 'Install's runner tool is not properly configured as a setuid tool', domain errors, 'attempt to write a readonly database, and on and on. I have barely done a thing on this computer except search online for help with these problems. Safari gives me a 'You are not connected to the internet' too often. Diagnostics disagrees. I do see wi-fi problems in the forum. Disk and permissions were fine at the beginning of the earlier problems, checked first by support tech. I'm not sure if support tech even knew. I was just happy they were fixed. Anyone have these download and/or install problems after a 'clean bill of health' so to speak, only a week ago?

    Let's try the following user tip with that one:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

Maybe you are looking for