Make java app. NOT use ".bat","sh","exe"-jar get params from manifest!!

Right now a jar file's manifest can have a "main-class" which makes the jar truly executable - you can double-click it. The problem is, if you need environment variables, there is no way to pass them in to your main-class' "args."
So why don't we make it so when the jar's manifest is read, that in addition to "main-class" you can have "main-args"?
That would mean everyone would no longer need to bundle java apps with ".exe" or ".bat" or ".sh" files!!! We could have truly Java applications, that are executables!!!
Just package them in a jar, have a main class and the args for it!!
what does everyone think?

Unfortunatly, it won't happen.....
Sun has been pushing property files ever since they disabled getEnv. You are probably better off designing some sort of Runtime.exec("echo $VARIABLE") or such to catch the environment variables during init. Or you could just start using property files like sun would want.

Similar Messages

  • Java apps not working right

    I lately have found problems with Java apps not working correctly. For example, in Yahoo Widgets I cannot get any widget preferences to display; in Apple's Java Preferences for J2SE 5.0 the preference window opens but is blank; and in JBidwatcher the buttons are missing in main and preference windows.
    When I log in as another user I find all those apps work properly, so it seems to be something wrong within my User folder. I tried reinstalling the Java J2SE50ReIease4 but it didn't help. Is there something I can delete and/or reinstall to fix this problem?

    Ditto here,
    I made the mistake of thinking I could throw away the preferences in the Java folder and new pref's would automatically replace the missing pref's, much to my surprise no such thing happened. My settup is the same as yours, except my OS is 10.4.8.
    Someone please help.
    Thanks,
    BJZTX
    G5 D2GHz   Mac OS X (10.4.7)   G4 Notebook 10.3

  • Why can I not use the channel name, which is obtained from the function of DAQmx Task, as the input of the channel name for the function of Get Channel Information of DAQ?

    Why can I not use the channel name, which is obtained from the function of DAQmx Task, as the input of the channel name for the function of Get Channel Information of DAQ?

    Not a lot of details here, but my guess is this isn't working for you because you are wiring in the task to the Active Channels Property and not the actual Channel Name. I have attatched a screenshot of what I believe you are trying to do. The Task has 2 channels in it, so I need to index off one of the channels and wire it into the active channels input of the Channel Property node. Then I can read information about that channel
    Attachments:
    channel_name.JPG ‏69 KB

  • I have CS 6 installed on a Win 7 OS machine. I can not connect to the internet to get updates from within the program. How do I fix this?

    I have CS 6 installed on a Win 7 OS machine. I can not connect to the internet to get updates from within the program. How do I fix this?

    IP routing doesn't work the way many folks might initially think it does; functional IP routing requires manual configuration and the establishment of static routes and default routes specific to the local network configurations, and it's very easy to get it wrong, or to get the default route swapped. Multiple NIC boxes don't magically work, either. (Been there, done that, wondered what happened to my network when the paths got reordered or my route settings were messed up, etc.)
    Routing configuration errors can be quite subtle, too. (Again, voice of experience. Ever had a thousand-seat office LAN accidentally routing through your desktop? As the, um, unnamed guilty party discovered, getting into that configuration was subtle. Seeing the performance crater on the fellow's box and on the LAN was obvious.)
    Knowing how IP routing works is a prerequisite to getting this configuration to work; there's manual configuration required. Clearly something has gone weird here.
    What to do? Read up on IP routing. I'll again suggest the threads and the manual mentioned earlier.
    And in general, I prefer to avoid using my comparatively expensive Mac boxes as sub-optimal IP routers or as firewall boxes. General-purpose operating systems and generic x86 boxes are going to be inherently poor IP routers. Dedicated routers (or embedded or surplus x86 boxes with routing software loaded) offload the Mac boxes here, and are also typically easier to configure manage. And "real" IP routers can have hardware specific to efficiently routing packets. Use of an outboard firewall or firewall-router box also greatly simplifies gateway routing, too; it's a configuration that many folks and many businesses tend to use.

  • Forgot icloud password, how to get it recover without any question and also alternative email becuase someone hacked my alternative email id. need password for using icloud hopefully i will get result from you as your earliest.

    forgot icloud password, how to get it recover without any question and also alternative email because someone hacked my alternative email id. need password for using icloud hopefully i will get result from you as your earliest.

    I'm sorry, but I know nothing about iCloud email. I stayed away from iCloud email and only use iCloud for limited purposes.
    But take a look at this discussion and read the response from randers4. He is one of the iCloud experts in the Apple Support Communities.
    https://discussions.apple.com/message/24358339#24358339
    If that doesn't help, you might be better off posting in here where there are other more knowledgable iCloud users.
    https://discussions.apple.com/community/icloud/icloud_on_my_ios_device

  • Launch Java app through a bat file

    Hi,
    Because I have to launch my Java App through a batch file, I don't know if I can create a new java class to execute this bat file to launch my Java App? Is that gonna work?
    Henry.

    Yes I created a batch file and tested. If I execute my batch file, the java app will be lauched as expected.
    Here is my java class that execute my batch file
    import java.io.*;
    public class LaunchTest {
    public static void main(String args[])
    String cmd[] = new String[3];
    try
    String osName = System.getProperty("os.name" );
    //System will detect current operating system
    if( osName.equals( "Windows NT" ) || osName.equals( "Windows 2000" ) )
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C";
    cmd[2] = "c:\\Run.bat"; //Run.bat will set classpath and launch my java app
    else if( osName.equals( "Windows 95" ) || osName.equals( "Windows 98" ) )
    cmd[0] = "command.exe" ;
    cmd[1] = "/C";
    cmd[2] = "c:\\Run.bat";//Run.bat will set classpath and launch my java app
    Runtime rt = Runtime.getRuntime();
    //running the commands
    Process proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERROR");
    // kick them off
    errorGobbler.start();
                   // any error???
    int exitVal = proc.waitFor();
    catch (Throwable t)
    t.printStackTrace();
    System.out.println("error...");
    And here is my batch file
    @echo off
    set path=e:\jbuilder4\jdk1.3\bin
    set classpath=E:\JBuilder4\jdom-b7\jdom-b7\build\jdom.jar;E:\JBuilder4\jdom-b7\jdom-b7\lib\xerces.jar;.
    d:
    cd AutoTest\classes
    java FirmwareTestPack.FirmwareMainClass
    exit
    When I run the java class above, Dos prompt popped up for a second then disappeared. It did not launch my Firmware pplication.
    Thank you.

  • Opening a file from a java app (not applet)

    My program can't find the text file I'm trying to open in my stand-alone java app. I am specifying it like this:
    File filename = new File("myfile.txt");
    FileReader = new FileReader(filename);
    It is in the same directly as the class files. It won't find it when it's in a jar file either. I had a similar problem with an applet a lont time ago, but that turned out to be a security issue, which I assume normal apps don't have.
    So, what's up with this?

    If system become larger, there are duplicated files
    can be found in different directories.
    Using classpath may cause problem, if there are
    duplicated file name.
    If you are coding, you should know exact location of
    the file to be opened.
    "system become larger" - huh? You control the classpath on a per-app basis, not one huge monolithic classpath containing all jars/folders for all apps.
    It's common, well-designed practice to use the classpath. It's bad practice to hard-code directory names and expect all deployments of the app to follow the same directory naming convention. I wouldn't want you to dictate to me where to put the file on my hard drive. I should be able to install it anywhere I want, and let it find it (via the classpath, in this instance).

  • Java apps not displaying correctly

    Hi.
    I'm having a problem with Java apps, as they seem to simply not display correctly. They are supposed to be Aqua, but it doesn't exactly work, since the actual controls don't appear, but besides that the program seems to carry out what it's supposed to (besides not displaying it correctly.)
    I tried removing some Java-related setting files and stuff, but it still doesn't exactly work as it should.

    The problem isn't with the Window Manager you use, but the java runtime you have installed. If you have openjdk6 installed, try removing it and install jre and jdk instead. If you have jre and jdk installed, install openjdk6 and see what happens.
    I think you're using openjdk6, since I remember hearing problems using it and topcoder.
    Last edited by CursedMonkey (2009-05-21 19:11:54)

  • Java app not working

    I have a MacBook Pro laptop and after I followed your advice I constantly get a message that reads, "Alert! This update requires Mac OS X version 10.6. My latest version is 10.8.2. It is too late for me to phone AppleCare. Community, please help with this problem.
    Thank you,
    Marlin

    I'm not sure exactly what you're trying to do or what advice you're following. It sounds like you are trying to install a Java update for Mac OS X 10.6, which you can't do because you're not using 10.6.
    Are you trying to upgrade Java or downgrade Java or what? What app is not working? What problem are you trying to solve?

  • How to make an app that uses plugins???

    Hello All,
    I am relatively new to programing and i have never done some thing like this so what i would like to know is.
    How can i make an app that can get/load plugins from a folder and then use them to copy files from one place to another(i got he copy part down just need the plugin part.
    And then i need to know how to parse the location of the file that needs to be copied and the folder it needs to be copied to into the plugin.
    Thanks in advance.

    What you do it to define a common interface which plugins have to implement. Typically you place the .class files for the plugins in a special directory (not on the class path) and you create a URLClassLoader to load the plugin classes. Class names (FQNs) for plugins are usually in some kind of configuration file.
    One you load the class you'll usually create a single instance (with Class.newInstance()) and cast it to the common interface. It's simpler to use a no-args constructor and define some kind of initialize method in the interface to initialise the plugin. Typically you pass some kind of context object when you initialize the plugin, which the plugin can use to comunicate with the framework.

  • Production Client Side Apps not using Sun JVM?

    Just wondering if anyone here deploys a non-Sun JVM to client machines?
    The impression I get is that everyone tends to just stick with the Sun JVM because is easily available and reliable.
    However, I'm considering suggesting that our clients move to a different JVM for the performance reasons described below:
    I wrote a series of performance tests to measure the time taken to repeat certain common tasks from our apps. I was surprised to find that the BEA JRockit JVM outperformed the SUn JVM by a long, long way in certain tasks, and was slower in none.
    Here's a selection of (subjective) results:
    Log Lines written per second - Sun 21,000 BEA 29,000
    Time taken to call (100000000) methods - Sun .907s BEA .269s
    Time taken to call (100000000) sync methods - Sun 17s BEA 12.4s
    Time to create big byte array - Sun 125ms BEA 32ms

    i would go for the intel/dual-proc optimisation answer for the difference.
    Although 50%? Logging to files uses most time with file access. Didn't know that was optimized either. (learning new stuff every day :-)
    But then again, 1 great thing about Java: write once, run anywhere (on any JVM, except for mickeysoft: they have their own neat thingie called the M$ VM, which downgrades performance by a 1000% and uses the 1.1.3 spec)
    As a thumb rule: either provide the JVM of your choice to your customers and make it mandatory to use that one, or make sure that it runs with (reasonable) performance under the slowest JVM. (p.s. 99% of the users use the Sun JVM for what i've seen, so if you let your clients choose: Sun's the way to go).

  • IPad mini apps not using the internet.

    There is an issue with my sister's iPad mini where when she's connected to our home internet, only some of her apps use the internet and others don't. For example, while Safari and My Singing Monsters work (thats pretty well the only two apps that work with the internet), the App store, iTunes, Google, Youtube and every other app that requires internet doesn't. She's connected to our internet (it even says in Wi-fi that she's connected) but for some reason almost all her apps (not every app) acts as if she had no connection. Our internet is fine. It works with every other device in our house so its something to do with the iPad mini itself. Pretty well, she has internet connection but most of the apps act as if she doesn't.

    Hello Zoruzero,
    The first thing I would suggest checking is ... another Wi-Fi network.  Does your sister have the same issue when she is in a different location? (home, work, local coffeehouse?).
    Here are the basic troubleshooting steps for Wi-Fi connectivity:
    If your iPhone, iPad, or iPod touch won’t connect to a Wi-Fi network - Apple Support
    http://support.apple.com/en-us/HT204051
    Make sure your router is on and that you're within range.
    If you're too far from your router you won't get a signal, so make sure you're within range. 
    Make sure Wi-Fi is on and that you can see your network.
    Tap Setting > Wi-Fi and make sure Wi-Fi is turned on. Tap the name of your Wi-Fi network to join. A blue checkmark beside a network name means you're connected.
    Get help if you can't turn on Wi-Fi.
    If prompted, type in your Wi-Fi password.
    If prompted, enter the password for your Wi-Fi network. Learn what to do if you don’t know your password.
    Check all of your cables and connections.
    If you still can’t connect to your network or get online, make sure your router is connected to the modem and turned on.
    Restart.
    For more help, try restarting your device, router, or cable/DSL modem. After each step, check to see if you fixed the issue.
      • Restart your iOS device.
      • Unplug your router and plug it back in.
      • Unplug your cable or DSL modem and plug it back in.
    Still can’t connect?
    Reset your Network Settings. Tap Settings > General > Reset > Reset Network Settings. This also resets Wi-Fi networks and passwords, cellular settings, and VPN and APN settings that you’ve used before.
    Get more help
    If someone else set up your network, ask them for help. If you’re using a network at a company, school, hotel, store, or other free Wi-Fi location, find an employee for assistance.
    If you're connected to a Wi-Fi network but you can’t get online, try to use your Wi-Fi network on other devices. If you can’t get online using your other devices, there might be a service outage. Call your cable company or internet provider for help.
    Try connecting to a Wi-Fi network in a different location. If your device can connect, you’ll need to get help with your Wi-Fi network. If it can’t connect to any Wi-Fi networks, contact Apple.
    Update your Wi-Fi router with the latest firmware and make sure the router supports your Apple product. For more information, contact the manufacturer of your router.
    Hope this helps ...
    - Judy

  • How to increase heap size in java code, not using "java -Xms64m "

    Im writing a java programme for loading the german dictionary. my dictionary is very huge(around 300000+ words).
    while loading the dictioanry im getting error "OutOfMemoryError" .
    I found one solution to increase the heap size, but i want to increase the heap size in java programmer itself, not outside jar file. so i could not use "-Xms64m" option of jvm.
    Can anyone tell me how can i do this

    sunlover1984 wrote:
    Im writing a java programme for loading the german dictionary. my dictionary is very huge(around 300000+ words).
    while loading the dictioanry im getting error "OutOfMemoryError" .
    I found one solution to increase the heap size, but i want to increase the heap size in java programmer itself, not outside jar file. so i could not use "-Xms64m" option of jvm.
    Can anyone tell me how can i do thisThat option is a startup option for the JVM. That means if your jar is already loaded then you are already too late to try and call it.

  • Disable IO in java app (not java -D)

    I don't want any program to be allowed anything more than a standard applet except when it is specified in a policy.
    The code (posted below) listens to my policy file when run as an applet but ignores the java.security and java.policy when started with java.
    The command "java test" gives me no exceptions at all, the default (I guess) is to allowe java apps to do what they want.
    So my question is can I set the security or policy so it won't allowe anything unless specified in a policy file?
    import java.util.Properties;
    import java.applet.Applet;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    public class test extends Applet implements Runnable {
                public test(){
                    new Thread(this).start();
             public static void main(String argv1[]) {
                  new test();
                public void run(){
                     try{
                          System.out.println("java.home is: " + System.getProperty("java.home"));
                          System.out.println("user.home is: " + System.getProperty("user.home"));
                              File fle = new File(System.getProperty("user.home") + System.getProperty("file.separator") + "sometext.txt");
                                 FileOutputStream outFile = new FileOutputStream(fle);
                   outFile.write("hello, this is written by Java".getBytes());
                   outFile.close();
                              FileInputStream inFile = new FileInputStream(fle);
                              int b = inFile.read();
                      while(b!=-1){
                                   System.out.print((char) b);
                                   b = inFile.read();
                          inFile.close();
                     }catch(Exception e){
                          e.printStackTrace();
    // java.security:
    security.provider.1=sun.security.provider.Sun
    security.provider.2=com.sun.net.ssl.internal.ssl.Provider
    security.provider.3=com.sun.rsajca.Provider
    security.provider.4=com.sun.crypto.provider.SunJCE
    security.provider.5=sun.security.jgss.SunProvider
    securerandom.source=file:/dev/random
    login.configuration.provider=com.sun.security.auth.login.ConfigFile
    policy.provider=sun.security.provider.PolicyFile
    policy.url.1=file:${java.home}/lib/security/java.policy
    # the following line gives me an opportunity to give special prifs to programms and applets
    # policy.url.2=file:${java.home}/lib/security/localApplet.policy
    # don't want to allowe the user to change policy
    # policy.allowSystemProperty=true
    policy.expandProperties=true
    policy.ignoreIdentityScope=false
    keystore.type=jks
    system.scope=sun.security.provider.IdentityDatabase
    package.access=sun.
    ssl.KeyManagerFactory.algorithm=SunX509
    ssl.TrustManagerFactory.algorithm=SunX509
    networkaddress.cache.negative.ttl=10
    java.policy:
    // you guessed correct thisone is empty

    Thanx for taking the time to respond.
    Sorry, I see my pref post was wrong. The code is OK but the java.policy looks loke this:
    // Standard extensions get all permissions by default
    //grant codeBase "file:${java.home}/lib/ext/*" {
    //     permission java.security.AllPermission;
    // default permissions granted to all domains
    grant {
         permission java.lang.RuntimePermission "usePolicy";
    };The usePolicy means that applets allways use policy to see what permissions they have.
    Compiled test.class and made a html file containter:
    <applet code="test.class" width="100" height="100"></applet>
    When I run: appletviewer test.htm
    Sure enough I get a security exception:
    java.security.AccessControlException: access denied (java.util.PropertyPermission java.home read)
    when I run the same code like this:
    java test.class there is no exception at all, I was wondering how can I force all classes to use policy?
    I think you can set your applications security manager to anything you
    want.
    If you can work out the Applets security manager class, you should be
    able to instantiate it and set it for your application.I didn't work out the Applets security manager if you are referring to: security.provider.1=sun.security.provider.Sun in the java.security.
    I just configured the policy.
    Sorry for the wrong info in my pref post that might have you thinking I rewrote/subclassed the security provider.
    http://java.sun.com/docs/books/tutorial/security1.2/tour2/step2.html
    Tells me how to use -D but there is nothing on allways forcing policy on any class.

  • HT1923 In a hurry, I purchased or downloaded an application, now how to uninstall the same if I found it not useful.  Is deleting the icon sufficient from the screen of mobile phone? Please suggest.

    In a hurry, if I have purchased or downloaded any application, can I uninstall it completely if I found it not useful.  Is deleting I-con from the mobile screen sufficient? Please suggest. 

    Sorry, but what sort of "application" are you referring to, and on what system or device?

Maybe you are looking for