Setting the L&F located in jar files

Hi.
How can you set the L&F to a custom Look And Feel located inside a jar file?
I used the following to accomplish that:
java -classpath "C:\LookAndFeelSwaper\lf.jar;C:\LookAndFeelSwaper" LaFSwaperI have a class located in "C:\LookAndFeelSwaper" which uses the L&F in "C:\LookAndFeelSwaper\lf.jar".
I want to have the same effect by changing the source code and not in the java command as written above.
My goal is to give the user the option to switch from L&Fs, which have been downloaded.
Thanks in advance,
SIJP

Step 1: Create a class loader
File file = getJarFile();  //The location of the jar with the look and feel
ClassLoader cl = new URLClassLoader(new URL[] { file.toURL() });
Step 2: Create an instance of the custom look and feel
Class clazz = cl.forName("plaf.MyLookAndFeel");
LookAndFeel laf = (LookAndFeel)clazz.getInstance();
Step 3: Use the UIManager class to set the look and feel.
UIManager.setLookAndFeel(laf);That should do it for you .

Similar Messages

  • 1.5 How to globally set the System Cache location

    FROM ANOTHER USER ON ANOTHER BOARD:
    This one did not get answered completely.
    ************************* Question:
    Hello,
    I want to deploy JWS on a client PC with Microsoft XP OS. This client have multiple users. JWS put a file deployment.properties in the directory "documents and setting" for the current user.
    How can I create a uniquely file deployment.properties for all users of this client (new and existing profiles) ?
    Create a directory "documents and setting/all users/application data/sun/java/deployment/" with the file deployment.properties don't work.
    Create a directory "documents and setting/default user/application data/sun/java/deployment/" with the file deployment.properties is working but is not good for the existing users. This is good uniquely for new users.
    is there a solution ?
    King regards,
    funchung
    ************************* ANSWER:
    For windows, the system config file is at:
    {Windows Directory}\Sun\Java\Deployment\
    The value of the {Windows Directory} is determined by using the Win32 API GetWindowsDirectory.
    So for example, on XP, the system config file is:
    c:\WINDOWS\Sun\Java\Deployment\deployment.properties
    The settings in this system config file will be used by all users on the system.
    ***************************** HIS REPLY
    I've tried this and it doesn't seem to work.
    I've also tried createing a deployment.config file as per the http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/properties.html article and this doesn't work for me.
    Has anyone done this successfully??
    ******************************** MY REPLY:
    This is true.
    I can get the system install to work if I add the parameter:
    deployment.system.cachedir=C\:\\testcache
    to the deployment.properties file found under:
    C:\Documents and Settings\username\Application Data\Sun\Java\Deployment
    but it will NOT work by adding it to the:
    C:\WINDOWS\Sun\Java\Deployment
    directory. It just creates a new default one in the user's folder.
    What am I doing wrong?
    If there is not a way to globally set the System Cache location, then this isn't much better than the user cache for being able to "install" the software once on the PC and let any user that signs in access that application.
    We had high hopes for this, since this functionality was taken away from us once the java cache started being stored in the user's folders.
    More details:
    I just tried setting the mandatory=true setting and it tells me that it is not allowed to start because it can't find the
    deployment.properties in the same folder (full path is displayed) but I know it is there, because it is the same folder. I even double checked the spelling.
    Maybe there is a bug in the way it finds that properties file, or maybe I need to include something in that file that I didn't find in documentation?
    All it has in it is the one line:
    deployment.system.cachedir=C\:\\testcache
    Can anybody help shed light on this?
    It seems to be a bug that it can't find the deployment.properties file in the 'system' folder.
    -Chris

    I now found more on another thread:
    http://forum.java.sun.com/thread.jspa?messageID=3500778&#3500778
    You can close this one.
    Sorry.

  • Setting the shared templates location by Deploying Office 365 Midsized Business "using a network share" from a on-premise location

    I found the question "Deploy Office 365 pro plus using a network share or from a on-premise locaiton" the most useful of the resources
    on MS yet - but I am having difficulties getting the files to download for a local deployment.
    The root of the issue, that I cannot find anywhere, is how do I set the shared templates location for users in the organization.  First I thought a GPO, but I cannot find that setting in the GPO in MS.
    Then I thought modifying the REG- but it is in a binary key which could include other information I may not want modified(Or does it matter?)
    Then I looked for ways to download the deployment but launching from an elevated prompt as IT (Domain level) returns a useless error to paraphrase- 'sorry MSOffice didn't install- do you have enough disk space'.
    I have downloaded the GPO objects, but not installed them, likely I will need those later though.
    Just want to path all the users to a central repository of office/excel/access/outlook templates in addition to their local templates. Concise help in steps or sites that have solved the issue are Greatly appreciated : )

    Hi,
    you can use the GPO ADMX templates to configure the "Workgroup templates path".
    This actually configures a registry setting named: "sharedtemplates".
    The registry value/type/data is:
    HKEY_CURRENT_USER\Software\Policies\Microsoft\office\15.0\common\general
    Name: sharedtemplates
    Type: REG_EXPAND_SZ (Expandable String Value)
    Data: <UNC path to folder>
    From the GPO reference workbook/sheet, for Office:
    http://social.technet.microsoft.com/wiki/contents/articles/4976.selected-content-relating-to-group-policy-administrative-templates-adm-and-admx.aspx
    Filename: office15.admx 
    Scope: User 
    Path: Microsoft Office 2013\Shared paths 
    Policy Setting Name: Workgroup templates path 
    Supported on: At least Windows Server 2008 R2 or Windows 7 
    Category: Shared paths 
    Explain Text: Specifies the location of workgroup templates. 
    Registry Key: HKCU\software\policies\microsoft\office\15.0\common\general!sharedtemplates
    Note: it is supported to populate this setting, with a UNC path, but not with a web path.
    e.g.: \\server01\shared\templates <this is valid>
    e.g.: http://server01/shared/templates <this is not valid>
    This constraint (for web URIs) can be difficult to work around. If you are using SharePoint, and think WebDAV might work, it doesn't seem to work for us :(
    Of course, if you have SharePoint, there are much better ways to handle document templates, but, our users are familiar with this File -> New -> from template type of method...
    It can also be set manually by a user:
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • How to use the COMM API in a JAR file

    I have developed an application, using the NetBeans IDE, to communicate with a modem over the COM1 serial port using the Java Comm API. The application works fine within the IDE, but when a JAR file is created and "double-clicked", the application launches correctly, but when the code is executed to "talk" over the COM1 serial port - nothing happens. No exceptions and no warnings are thrown. My environment is XP, SP1.
    The manifest file is as follows:
    Manifest-Version: 1.0
    Class-Path: ../j2sdk1.4.2/jre/lib/ext/TimerBean.jar ../j2sdk1.4.2/jre/
    lib/ext/AbsoluteLayout.jar ../j2sdk1.4.2/jre/lib/ext/comm.jar
    Created-By: NetBeans IDE
    Specified-By: Projects/TheApp/Files/TheApp.jarContent
    Main-Class: Main
    According to the Comm API installation instructions, the following files are copied:
    copy comm.jar \j2sdk1.4.2\jre\lib\ext
    copy wind32com.dll \j2sdk1.4.2\bin
    copy javax.comm.properties \j2sdk1.4.2\jre\lib
    I suspect it has something to do with the paths.
    Any help would be greatly appreciated. Thanks.

    Thanks for your input, but after trying what you suggested the problem still exists. I think your right to be suspicous of the javax.comm.properties file. The application, that worked in the IDE, exhibits the same behavoir as the JAR file if the javax.comm.properties file is removed from the ../jre/lib directory. In other words it compiles correctly in the IDE, but when executed, nothing happens when the code that "talks" to the serial port is run.
    I've tried moving the javax.comm.properties file into the working directory. Also, the CLASSPATH and PATH system variables were modified to include the path to javax.comm.properties.
    If you have anymore ideas, please let me know.
    Thanks.

  • Deployment Rule Set Centrally Managed location of .jar file?

    Hello,
    We are currently looking at implementing the Deployment Rule Set in our company and I was wondering if there is a way to centrally manage the Deployment Rule Set?
    Having to keep up with deploying the jar file for every change and expiring certificates isn't ideal
    Thanks!

    And your OS doesn't have a file search feature, which might have given you the answer faster than waiting for a response on these columns?
    db

  • Locating a JAR file

    Has this happened to you? You search the internet for some concept in Java and find a nice piece of code that illustrates perfectly what you want to do. So you do a little cut-n-pasting and off you go. But then you're suddenly stopped in your tracks due to an error in an import statement. Scratching your head, you stare at the import statement wondering where that particular package is located. You've got 6 million JAR files to search containg that illusive package. With nothing more to go on, you go looking for any JAR file on your system that might come even the slightest bit close to containing that package you desire - without luck. So there you sit, still sratching a bald spot on your head wondering how the heck you're going to find that JAR file. And here I sit too, slightly balder, and still searching.
    This happens all too often I'm affraid. Where oh where is the JAR to package cross reference search engine web site tool thingy I so desire? Being president of the "procrastinators society for ..", I have no desire to take on such a dubious project. I'm hoping someone out there with a bit more energy than I to taken on such a task and someone else to have researched and found that gem of a utility web site I spoke of and would kindly educate me on such web site.
    Thanks a bunch!

    You've got 6 million JAR files to search containg that illusive package.
    Load them all into your IDE's classpath. Then do a Java type search. Most IDE's will take you directly to the relevant JAR(s).
    - Saish

  • Location of jar file for com.sapportals.wcm.service.IService

    Hi,
    Can somebody tell me that from where can I get the jar file for <b>com.sapportals.wcm.service.IService</b>
    Regards,
    Manish

    Hi Manish,
    I think you'll find it in <b>bc.sf.framework_api.jar</b>
    located in <b>..j2eeclusterserver0appssap.comirjservlet_jspirj
    ootWEB-INFportalportalappscom.sap.netweaver.bc.sflib</b>
    I'd also recommend trying JAR class finder.  More details here: JAR Class Finder
    Cheers.

  • How to make the browser reload an updated jar-file?

    Hi there,
    Previosly when running applets using MSIE, all needed to reload an updated jar-file was pressing CTRL+F5
    Currently I've been assigned to re-develop some of my old applets and now I realize that the old CTRL+F5 won't do the trick any more since the old jar file is still in the cache and the new jar file is not loaded.
    I learned the hard way that all I can do is to manually clear the cache of the browser (Tools | Options | Delete files) and restart the browser and after that the new jar file is correctly loaded.
    Cache settings of the browser is set to "Reload on every visit to the page"
    Currently running Win2k, MSIE 6.0 SP1 and MSJVM 3809 but the problem also exists on Win2k, MSIE 6.0 and MSJVM 3186.
    Isn't there any easier way to do this?
    Currently I don't even mind not caching the jar-files at all as long as I don't get my development work trashed by having to restart the browser after every new build...
    Why has the old CTRL+F5 behaviour been changed?
    BR
    /Jonas

    I have been closing IE and reopening it for 7 months now. I don't of any other way to reload an applet.
    Jason

  • How do I change the default save location for new files in Pages back from iCloud to my Documents folder?

    I just upgraded OSX to Mountain Lion and Pages to 4.2, and because OSX is syncing with my iCloud account, when I go to save a new file in Pages it defaults to try to save to my iCloud account rather than giving me the folder structure on my hard-drive that I prefer. It requires two extra steps to save to the proper place in my Documents folder on my hard drive.
    Is there a way to reset the default so that when I go to save a new file, the folder structure opens to the last saved folder (like it does in other non-iCloud applications) rather than defaulting to my iCloud, and to do it without just removing documents from my iCloud account entirely?
    I checked the Preferences for both Pages and iCloud and found nothing about this.

    What I meant is turn off Documents and Data in iCloud in OS X. Keep it on on your iOS devices. iCloud will sync documents between the iOS devices and make them available on the iCloud web site, but it won't mess up iWorks' open and save dialog boxes. It also won't assume that you want all your documents in iCloud, which I think is undesirable anyway.
    Keep iOS and OS X separate, and use the web site to move files between the two as necessary.
    iOS iWork is different from OS X iWork. There are fewer fonts on an iOS device. iOS iWork programs have slightly different feature sets than OS X iWork programs, and the file formats are different. iCloud automatically converts the file format when necessary, but if you make a habit of saving things directly to iCloud, you are limited to the lowest common denominator between the two versions of iWorks. So why would anyone want iWork on the Mac to open and save documents on iCloud by default?
    If you want to store files in the cloud and sync them on your Macs, SugarSync is a much better solution. It lets you choose your sync folders, it doesn't make you reorganize your files, it lets you sync all file types, it doesn't convert files to a different format and back, and it stores everything in the cloud, too. Just the simle act of saving a file backs it up and syncs it. I wouldn't live without it. iCloud is best with iTunes purchases and synchronizing Mac settings and iOS files; I woudln't live without it. The two make an unbeatable combination.

  • Can I set the default save location in text edit to dropbox?

    I'm happy with dropbox for now and want to set the default save folder to a dropbox folder but I cannot see how to do this.
    Can it be done? Or do I need a 3 party text editor?
    Thanks
    Tom

    You cannot. Because this option both takes much longer and reduces the quality of files, it has to be chosen specifically.
    In any case, when you save a PDF file from Word. this process does not involve Acrobat or Adobe software in any way.

  • In a JSP how can access an XML where the XML is present in JAR file in the

    All,
    The Requirement is as below,
    I have a JSP LaunchMe.jsp, and I have a jar utils.jar. both are present in my deployable war file.
    And I have an XML Details.XML present in the utils.jar file.
    Here I want to access Details.xml in the LaunchMe.jsp.
    Can any one please let me know how can I do this.
    Thanks,
    Subramanyam V

    Yes. You have to understand that to read a FILE (one that is seen as a file by your OS), you probably use a FileInputStream, which is a special case of InputStream. When the 'file' is not a FILE anymore, but an entry in a jar (the OS does not see it, only utilities like WinZip or jar see it), you cannot use a FileInputStream, but some other InputStream. Which one? The one returned by getResourceAsStream(), whatever this is (you don't really care). And all the rest will nicely fall into place.

  • How  to include the inner classes in a jar file in netbeans ide

    Dear java friends
    how to say to netbeans ide that it has to include the
    inner classes in the jar file.
    (i have one single applet class
    with two inner classes that show up
    in the build/classes file but not in the jar).
    The applet works in the viewer but not
    in the browser (I believe because the
    xxx$yyy etc should be in the jar)
    willemjav

    First, please stop posting the same question multiple times:
    Duplicate of http://forum.java.sun.com/thread.jspa?threadID=5269782&messageID=10127496#10127496
    with an answer.
    Second, If your problem is that you can't do this in NetBeans, you need to post to somewhere that provides NetBeans support - like the NetBeans website's mailing list. These forums do not support NetBeans (or any other IDE) - they are Java language forums.

  • TDMS : How to set the background colour programatically for .tdms file

    Hello every one 
    is there any method to set the background colour of .tdms file programatically
    Thank you
    Raja

    Hi Raja,
    "TDMS" is a file on your harddisc. How should a file have a background color?
    Or the other way around:
    How do you set the background color of a simple text file?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • High number of "The connection has timed out" errors. Where do I set the time out period (variable and file name) - windows 7

    I usually use a wireless network at home and have very few time out problems with Firefox.
    I am travelling and using Optus Wireless broadband where the average ping to a site is 700+ms .
    I suspect that this is the cause of the high number of timeouts I am experiencing.
    Optus say there are no problems so I think I will have to set the timeout to a longer period.
    Please advise what variable name/s (and in which file) the timeout is set for LOADING PAGES.
    Thanks in anticipation.
    Greg Atkinson.
    By the way the same is happening in IE8
    and on many sites other than the Yahoo one below.
    ================Full Error Page ==============
    URL is http://au.mg4.mail.yahoo.com/dc/launch?.gx=1&.rand=81jkv757qfdqt
    =========================================
    The connection has timed out
    The server at au.mg4.mail.yahoo.com is taking too long to respond.
    * The site could be temporarily unavailable or too busy. Try again in a few moments.
    * If you are unable to load any pages, check your computer's network connection.
    * If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

    Having the same problem 4 out of 5 times I try to navigate to a new site I get the error "connection has timed out".
    My I phone works fine on the same wireless connection so it must be something to do with the computer. The problem occurs on IE, firefox, and google chrome.
    I too would like to know how to how to either fix this problem or failing that to extend the length of time before the connection times out (which is currently only about 5 seconds).
    Please help!
    Thanks in advance

  • Location JDBC jar file while building Jetspeed2

    Hi,
    At the moment I'm trying to get Jetspeed2 installed. Reading the manuals it seems soooo easy. I installed Jetspeed using the default installation method, and wanted to change the database from derby to MySQL.
    To change the database from derby to MySQL I need to start an Ant script. As a result of running this script, I got the following error:
    java.lang.IllegalStateException: -> Unable to start DBCPCDatasourceComponent: -> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    (tabs and -> added for readability)
    There is a mysql-connector-java-5.1.6-bin.jar in Tomcat's shared/lib directory. This jar file is also part of my systems classpath.
    Does anyone have a suggestion in which way I can look?
    Abel

    Found it.
    Place the jar files in
    {jetspeed-home}/shared/libThat must be a hidden, undocumented feature. Mindreading and/or clairvoyance is an important ability.

Maybe you are looking for